mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-25 14:12:33 +00:00
* StoreLog (WIP) * add log records to map * revert Protocol change * revert Server change * fix parseLogRecord * optionally save/restore queues to/from store log * refactor * refactor delQueueAndMsgs * move store log to /var/opt/simplex * use ini file
36 lines
1.1 KiB
Haskell
36 lines
1.1 KiB
Haskell
{-# LANGUAGE DataKinds #-}
|
|
{-# LANGUAGE KindSignatures #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
module Simplex.Messaging.Server.QueueStore where
|
|
|
|
import Simplex.Messaging.Protocol
|
|
|
|
data QueueRec = QueueRec
|
|
{ recipientId :: QueueId,
|
|
senderId :: QueueId,
|
|
recipientKey :: RecipientPublicKey,
|
|
senderKey :: Maybe SenderPublicKey,
|
|
status :: QueueStatus
|
|
}
|
|
|
|
data QueueStatus = QueueActive | QueueOff deriving (Eq)
|
|
|
|
class MonadQueueStore s m where
|
|
addQueue :: s -> RecipientPublicKey -> (RecipientId, SenderId) -> m (Either ErrorType ())
|
|
getQueue :: s -> SParty (a :: Party) -> QueueId -> m (Either ErrorType QueueRec)
|
|
secureQueue :: s -> RecipientId -> SenderPublicKey -> m (Either ErrorType ())
|
|
suspendQueue :: s -> RecipientId -> m (Either ErrorType ())
|
|
deleteQueue :: s -> RecipientId -> m (Either ErrorType ())
|
|
|
|
mkQueueRec :: RecipientPublicKey -> (RecipientId, SenderId) -> QueueRec
|
|
mkQueueRec recipientKey (recipientId, senderId) =
|
|
QueueRec
|
|
{ recipientId,
|
|
senderId,
|
|
recipientKey,
|
|
senderKey = Nothing,
|
|
status = QueueActive
|
|
}
|