Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Monad m => MonadAgentStore s m where
- createRcvConn :: s -> TVar ChaChaDRG -> ConnData -> RcvQueue -> SConnectionMode c -> m ConnId
- createSndConn :: s -> TVar ChaChaDRG -> ConnData -> SndQueue -> m ConnId
- getConn :: s -> ConnId -> m SomeConn
- getAllConnIds :: s -> m [ConnId]
- getRcvConn :: s -> SMPServer -> RecipientId -> m SomeConn
- deleteConn :: s -> ConnId -> m ()
- upgradeRcvConnToDuplex :: s -> ConnId -> SndQueue -> m ()
- upgradeSndConnToDuplex :: s -> ConnId -> RcvQueue -> m ()
- setRcvQueueStatus :: s -> RcvQueue -> QueueStatus -> m ()
- setRcvQueueActive :: s -> RcvQueue -> VerificationKey -> m ()
- setSndQueueStatus :: s -> SndQueue -> QueueStatus -> m ()
- updateSignKey :: s -> SndQueue -> SignatureKey -> m ()
- createConfirmation :: s -> TVar ChaChaDRG -> NewConfirmation -> m ConfirmationId
- acceptConfirmation :: s -> ConfirmationId -> ConnInfo -> m AcceptedConfirmation
- getAcceptedConfirmation :: s -> ConnId -> m AcceptedConfirmation
- removeConfirmations :: s -> ConnId -> m ()
- createInvitation :: s -> TVar ChaChaDRG -> NewInvitation -> m InvitationId
- getInvitation :: s -> InvitationId -> m Invitation
- acceptInvitation :: s -> InvitationId -> ConnInfo -> m ()
- deleteInvitation :: s -> ConnId -> InvitationId -> m ()
- updateRcvIds :: s -> ConnId -> m (InternalId, InternalRcvId, PrevExternalSndId, PrevRcvMsgHash)
- createRcvMsg :: s -> ConnId -> RcvMsgData -> m ()
- updateSndIds :: s -> ConnId -> m (InternalId, InternalSndId, PrevSndMsgHash)
- createSndMsg :: s -> ConnId -> SndMsgData -> m ()
- updateSndMsgStatus :: s -> ConnId -> InternalId -> SndMsgStatus -> m ()
- getPendingMsgData :: s -> ConnId -> InternalId -> m (SndQueue, MsgBody)
- getPendingMsgs :: s -> ConnId -> m [PendingMsg]
- getMsg :: s -> ConnId -> InternalId -> m Msg
- checkRcvMsg :: s -> ConnId -> InternalId -> m ()
- updateRcvMsgAck :: s -> ConnId -> InternalId -> m ()
- data RcvQueue = RcvQueue {}
- data SndQueue = SndQueue {}
- data ConnType
- data Connection (d :: ConnType) where
- RcvConnection :: ConnData -> RcvQueue -> Connection CRcv
- SndConnection :: ConnData -> SndQueue -> Connection CSnd
- DuplexConnection :: ConnData -> RcvQueue -> SndQueue -> Connection CDuplex
- ContactConnection :: ConnData -> RcvQueue -> Connection CContact
- data SConnType :: ConnType -> Type where
- connType :: SConnType c -> ConnType
- data SomeConn = forall d. SomeConn (SConnType d) (Connection d)
- newtype ConnData = ConnData {}
- data NewConfirmation = NewConfirmation {}
- data AcceptedConfirmation = AcceptedConfirmation {}
- data NewInvitation = NewInvitation {}
- data Invitation = Invitation {}
- type PrevExternalSndId = Int64
- type PrevRcvMsgHash = MsgHash
- type PrevSndMsgHash = MsgHash
- data RcvMsgData = RcvMsgData {}
- data SndMsgData = SndMsgData {}
- data PendingMsg = PendingMsg {
- connId :: ConnId
- msgId :: InternalId
- type BroadcastId = ByteString
- data Msg
- data RcvMsg = RcvMsg {}
- newtype InternalRcvId = InternalRcvId {}
- type ExternalSndId = Int64
- type ExternalSndTs = UTCTime
- type BrokerId = MsgId
- type BrokerTs = UTCTime
- data RcvMsgStatus
- type AckBrokerTs = UTCTime
- type AckSenderTs = UTCTime
- data SndMsg = SndMsg {}
- newtype InternalSndId = InternalSndId {}
- data SndMsgStatus
- type SentTs = UTCTime
- type DeliveredTs = UTCTime
- data MsgBase = MsgBase {}
- newtype InternalId = InternalId {}
- type InternalTs = UTCTime
- data StoreError
Store management
class Monad m => MonadAgentStore s m where Source #
Store class type. Defines store access methods for implementations.
createRcvConn :: s -> TVar ChaChaDRG -> ConnData -> RcvQueue -> SConnectionMode c -> m ConnId Source #
createSndConn :: s -> TVar ChaChaDRG -> ConnData -> SndQueue -> m ConnId Source #
getConn :: s -> ConnId -> m SomeConn Source #
getAllConnIds :: s -> m [ConnId] Source #
getRcvConn :: s -> SMPServer -> RecipientId -> m SomeConn Source #
deleteConn :: s -> ConnId -> m () Source #
upgradeRcvConnToDuplex :: s -> ConnId -> SndQueue -> m () Source #
upgradeSndConnToDuplex :: s -> ConnId -> RcvQueue -> m () Source #
setRcvQueueStatus :: s -> RcvQueue -> QueueStatus -> m () Source #
setRcvQueueActive :: s -> RcvQueue -> VerificationKey -> m () Source #
setSndQueueStatus :: s -> SndQueue -> QueueStatus -> m () Source #
updateSignKey :: s -> SndQueue -> SignatureKey -> m () Source #
createConfirmation :: s -> TVar ChaChaDRG -> NewConfirmation -> m ConfirmationId Source #
acceptConfirmation :: s -> ConfirmationId -> ConnInfo -> m AcceptedConfirmation Source #
getAcceptedConfirmation :: s -> ConnId -> m AcceptedConfirmation Source #
removeConfirmations :: s -> ConnId -> m () Source #
createInvitation :: s -> TVar ChaChaDRG -> NewInvitation -> m InvitationId Source #
getInvitation :: s -> InvitationId -> m Invitation Source #
acceptInvitation :: s -> InvitationId -> ConnInfo -> m () Source #
deleteInvitation :: s -> ConnId -> InvitationId -> m () Source #
updateRcvIds :: s -> ConnId -> m (InternalId, InternalRcvId, PrevExternalSndId, PrevRcvMsgHash) Source #
createRcvMsg :: s -> ConnId -> RcvMsgData -> m () Source #
updateSndIds :: s -> ConnId -> m (InternalId, InternalSndId, PrevSndMsgHash) Source #
createSndMsg :: s -> ConnId -> SndMsgData -> m () Source #
updateSndMsgStatus :: s -> ConnId -> InternalId -> SndMsgStatus -> m () Source #
getPendingMsgData :: s -> ConnId -> InternalId -> m (SndQueue, MsgBody) Source #
getPendingMsgs :: s -> ConnId -> m [PendingMsg] Source #
getMsg :: s -> ConnId -> InternalId -> m Msg Source #
checkRcvMsg :: s -> ConnId -> InternalId -> m () Source #
updateRcvMsgAck :: s -> ConnId -> InternalId -> m () Source #
Instances
Queue types
A receive queue. SMP queue through which the agent receives messages from a sender.
A send queue. SMP queue through which the agent sends messages to a recipient.
SndQueue | |
|
Connection types
Type of a connection.
data Connection (d :: ConnType) where Source #
Connection of a specific type.
- RcvConnection is a connection that only has a receive queue set up, typically created by a recipient initiating a duplex connection.
- SndConnection is a connection that only has a send queue set up, typically created by a sender joining a duplex connection through a recipient's invitation.
- DuplexConnection is a connection that has both receive and send queues set up, typically created by upgrading a receive or a send connection with a missing queue.
RcvConnection :: ConnData -> RcvQueue -> Connection CRcv | |
SndConnection :: ConnData -> SndQueue -> Connection CSnd | |
DuplexConnection :: ConnData -> RcvQueue -> SndQueue -> Connection CDuplex | |
ContactConnection :: ConnData -> RcvQueue -> Connection CContact |
Instances
Eq (Connection d) Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: Connection d -> Connection d -> Bool # (/=) :: Connection d -> Connection d -> Bool # | |
Show (Connection d) Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> Connection d -> ShowS # show :: Connection d -> String # showList :: [Connection d] -> ShowS # |
data SConnType :: ConnType -> Type where Source #
SCRcv :: SConnType CRcv | |
SCSnd :: SConnType CSnd | |
SCDuplex :: SConnType CDuplex | |
SCContact :: SConnType CContact |
Connection of an unknown type. Used to refer to an arbitrary connection when retrieving from store.
forall d. SomeConn (SConnType d) (Connection d) |
Confirmation types
data NewConfirmation Source #
data AcceptedConfirmation Source #
Invitations
data NewInvitation Source #
data Invitation Source #
Message integrity validation types
type PrevExternalSndId = Int64 Source #
Corresponds to last_external_snd_msg_id
in connections
table
type PrevRcvMsgHash = MsgHash Source #
Corresponds to last_rcv_msg_hash
in connections
table
type PrevSndMsgHash = MsgHash Source #
Corresponds to last_snd_msg_hash
in connections
table
Message data containers - used on Msg creation to reduce number of parameters
data RcvMsgData Source #
data SndMsgData Source #
data PendingMsg Source #
PendingMsg | |
|
Instances
Show PendingMsg Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> PendingMsg -> ShowS # show :: PendingMsg -> String # showList :: [PendingMsg] -> ShowS # |
Broadcast types
type BroadcastId = ByteString Source #
Message types
A message in either direction that is stored by the agent.
A message received by the agent from a sender.
RcvMsg | |
|
newtype InternalRcvId Source #
Instances
Eq InternalRcvId Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: InternalRcvId -> InternalRcvId -> Bool # (/=) :: InternalRcvId -> InternalRcvId -> Bool # | |
Show InternalRcvId Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> InternalRcvId -> ShowS # show :: InternalRcvId -> String # showList :: [InternalRcvId] -> ShowS # | |
FromField InternalRcvId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite | |
ToField InternalRcvId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite toField :: InternalRcvId -> SQLData # |
type ExternalSndId = Int64 Source #
type ExternalSndTs = UTCTime Source #
data RcvMsgStatus Source #
Instances
Eq RcvMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: RcvMsgStatus -> RcvMsgStatus -> Bool # (/=) :: RcvMsgStatus -> RcvMsgStatus -> Bool # | |
Show RcvMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> RcvMsgStatus -> ShowS # show :: RcvMsgStatus -> String # showList :: [RcvMsgStatus] -> ShowS # | |
ToField RcvMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite toField :: RcvMsgStatus -> SQLData # |
type AckBrokerTs = UTCTime Source #
type AckSenderTs = UTCTime Source #
A message sent by the agent to a recipient.
SndMsg | |
|
newtype InternalSndId Source #
Instances
Eq InternalSndId Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: InternalSndId -> InternalSndId -> Bool # (/=) :: InternalSndId -> InternalSndId -> Bool # | |
Show InternalSndId Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> InternalSndId -> ShowS # show :: InternalSndId -> String # showList :: [InternalSndId] -> ShowS # | |
FromField InternalSndId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite | |
ToField InternalSndId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite toField :: InternalSndId -> SQLData # |
data SndMsgStatus Source #
Instances
Eq SndMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: SndMsgStatus -> SndMsgStatus -> Bool # (/=) :: SndMsgStatus -> SndMsgStatus -> Bool # | |
Show SndMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> SndMsgStatus -> ShowS # show :: SndMsgStatus -> String # showList :: [SndMsgStatus] -> ShowS # | |
ToField SndMsgStatus Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite toField :: SndMsgStatus -> SQLData # |
type DeliveredTs = UTCTime Source #
Base message data independent of direction.
MsgBase | |
|
Instances
newtype InternalId Source #
Instances
Eq InternalId Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: InternalId -> InternalId -> Bool # (/=) :: InternalId -> InternalId -> Bool # | |
Show InternalId Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> InternalId -> ShowS # show :: InternalId -> String # showList :: [InternalId] -> ShowS # | |
FromField InternalId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite | |
ToField InternalId Source # | |
Defined in Simplex.Messaging.Agent.Store.SQLite toField :: InternalId -> SQLData # |
type InternalTs = UTCTime Source #
Store errors
data StoreError Source #
Agent store error.
SEInternal ByteString | IO exceptions in store actions. |
SEUniqueID | failed to generate unique random ID |
SEConnNotFound | Connection alias not found (or both queues absent). |
SEConnDuplicate | Connection alias already used. |
SEBadConnType ConnType | Wrong connection type, e.g. "send" connection when "receive" or "duplex" is expected, or vice versa.
|
SEConfirmationNotFound | Confirmation not found. |
SEInvitationNotFound | Invitation not found |
SEMsgNotFound | Message not found |
SEBadQueueStatus | Currently not used. The intention was to pass current expected queue status in methods, as we always know what it should be at any stage of the protocol, and in case it does not match use this error. |
SENotImplemented | Used in |
Instances
Eq StoreError Source # | |
Defined in Simplex.Messaging.Agent.Store (==) :: StoreError -> StoreError -> Bool # (/=) :: StoreError -> StoreError -> Bool # | |
Show StoreError Source # | |
Defined in Simplex.Messaging.Agent.Store showsPrec :: Int -> StoreError -> ShowS # show :: StoreError -> String # showList :: [StoreError] -> ShowS # | |
Exception StoreError Source # | |
Defined in Simplex.Messaging.Agent.Store toException :: StoreError -> SomeException # fromException :: SomeException -> Maybe StoreError # displayException :: StoreError -> String # |