diff --git a/src/Simplex/Messaging/Agent/Store.hs b/src/Simplex/Messaging/Agent/Store.hs index 97a25ea3a..d891c1e2e 100644 --- a/src/Simplex/Messaging/Agent/Store.hs +++ b/src/Simplex/Messaging/Agent/Store.hs @@ -70,6 +70,7 @@ class Monad m => MonadAgentStore s m where getMsg :: s -> ConnId -> InternalId -> m Msg checkRcvMsg :: s -> ConnId -> InternalId -> m () updateRcvMsgAck :: s -> ConnId -> InternalId -> m () + deleteMsg :: s -> ConnId -> InternalId -> m () -- * Queue types diff --git a/src/Simplex/Messaging/Agent/Store/SQLite.hs b/src/Simplex/Messaging/Agent/Store/SQLite.hs index aba154090..de978d8ea 100644 --- a/src/Simplex/Messaging/Agent/Store/SQLite.hs +++ b/src/Simplex/Messaging/Agent/Store/SQLite.hs @@ -514,6 +514,11 @@ instance (MonadUnliftIO m, MonadError StoreError m) => MonadAgentStore SQLiteSto |] (RcvMsgAcknowledged, connId, msgId) + deleteMsg :: SQLiteStore -> ConnId -> InternalId -> m () + deleteMsg st connId msgId = + liftIO . withTransaction st $ \db -> + DB.execute db "DELETE FROM messages WHERE conn_alias = ? AND internal_id = ?;" (connId, msgId) + -- * Auxiliary helpers instance ToField QueueStatus where toField = toField . serializeQueueStatus