{-# LANGUAGE FunctionalDependencies #-}
module Simplex.Messaging.Server.MsgStore where
import Data.Time.Clock
import Simplex.Messaging.Protocol (Encoded, MsgBody, RecipientId)
data Message = Message
{ Message -> Encoded
msgId :: Encoded,
Message -> UTCTime
ts :: UTCTime,
Message -> Encoded
msgBody :: MsgBody
}
class MonadMsgStore s q m | s -> q where
getMsgQueue :: s -> RecipientId -> m q
delMsgQueue :: s -> RecipientId -> m ()
class MonadMsgQueue q m where
writeMsg :: q -> Message -> m ()
tryPeekMsg :: q -> m (Maybe Message)
peekMsg :: q -> m Message
tryDelPeekMsg :: q -> m (Maybe Message)