@@ -100,7 +100,6 @@ import Simplex.Messaging.Server.MsgStore.Types
100100import Simplex.Messaging.Server.NtfStore
101101import Simplex.Messaging.Server.QueueStore
102102import Simplex.Messaging.Server.QueueStore.QueueInfo
103- import Simplex.Messaging.Server.QueueStore.STM
104103import Simplex.Messaging.Server.Stats
105104import Simplex.Messaging.TMap (TMap )
106105import qualified Simplex.Messaging.TMap as TM
@@ -841,7 +840,7 @@ runClientTransport h@THandle {params = thParams@THandleParams {thVersion, sessio
841840 c <- liftIO $ newClient msType clientId q thVersion sessionId ts
842841 runClientThreads msType ms active c clientId `finally` clientDisconnected c
843842 where
844- runClientThreads :: STMQueueStore (MsgStore s ) => SMSType s -> MsgStore s -> TVar (IM. IntMap (Maybe AClient )) -> Client (MsgStore s ) -> IS. Key -> M ()
843+ runClientThreads :: MsgStoreClass (MsgStore s ) => SMSType s -> MsgStore s -> TVar (IM. IntMap (Maybe AClient )) -> Client (MsgStore s ) -> IS. Key -> M ()
845844 runClientThreads msType ms active c clientId = do
846845 atomically $ modifyTVar' active $ IM. insert clientId $ Just (AClient msType c)
847846 s <- asks server
@@ -897,7 +896,7 @@ cancelSub s = case subThread s of
897896 _ -> pure ()
898897 ProhibitSub -> pure ()
899898
900- receive :: forall c s . (Transport c , STMQueueStore s ) => THandleSMP c 'TServer -> s -> Client s -> M ()
899+ receive :: forall c s . (Transport c , MsgStoreClass s ) => THandleSMP c 'TServer -> s -> Client s -> M ()
901900receive h@ THandle {params = THandleParams {thAuth}} ms Client {rcvQ, sndQ, rcvActiveAt, sessionId} = do
902901 labelMyThread . B. unpack $ " client $" <> encode sessionId <> " receive"
903902 sa <- asks serverActive
@@ -997,7 +996,7 @@ data VerificationResult s = VRVerified (Maybe (StoreQueue s, QueueRec)) | VRFail
997996-- - the queue or party key do not exist.
998997-- In all cases, the time of the verification should depend only on the provided authorization type,
999998-- a dummy key is used to run verification in the last two cases, and failure is returned irrespective of the result.
1000- verifyTransmission :: forall s . STMQueueStore s => s -> Maybe (THandleAuth 'TServer, C. CbNonce ) -> Maybe TransmissionAuth -> ByteString -> QueueId -> Cmd -> M (VerificationResult s )
999+ verifyTransmission :: forall s . MsgStoreClass s => s -> Maybe (THandleAuth 'TServer, C. CbNonce ) -> Maybe TransmissionAuth -> ByteString -> QueueId -> Cmd -> M (VerificationResult s )
10011000verifyTransmission ms auth_ tAuth authorized queueId cmd =
10021001 case cmd of
10031002 Cmd SRecipient (NEW k _ _ _ _) -> pure $ Nothing `verifiedWith` k
@@ -1074,7 +1073,7 @@ forkClient Client {endThreads, endThreadSeq} label action = do
10741073 action `finally` atomically (modifyTVar' endThreads $ IM. delete tId)
10751074 mkWeakThreadId t >>= atomically . modifyTVar' endThreads . IM. insert tId
10761075
1077- client :: forall s . STMQueueStore s => THandleParams SMPVersion 'TServer -> Server -> s -> Client s -> M ()
1076+ client :: forall s . MsgStoreClass s => THandleParams SMPVersion 'TServer -> Server -> s -> Client s -> M ()
10781077client
10791078 thParams'
10801079 Server {subscribedQ, ntfSubscribedQ, subscribers}
@@ -1768,7 +1767,7 @@ processServerMessages = do
17681767 stored'' <- getQueueSize ms rId q
17691768 liftIO $ closeMsgQueue q
17701769 pure (stored'', expired'')
1771- processValidateQueue :: RecipientId -> JournalQueue -> IO MessageStats
1770+ processValidateQueue :: RecipientId -> JournalQueue 'MSMemory -> IO MessageStats
17721771 processValidateQueue rId q =
17731772 runExceptT (getQueueSize ms rId q) >>= \ case
17741773 Right storedMsgsCount -> pure newMessageStats {storedMsgsCount, storedQueues = 1 }
@@ -1777,7 +1776,7 @@ processServerMessages = do
17771776 exitFailure
17781777
17791778-- TODO this function should be called after importing queues from store log
1780- importMessages :: forall s . STMQueueStore s => Bool -> s -> FilePath -> Maybe Int64 -> IO MessageStats
1779+ importMessages :: forall s . MsgStoreClass s => Bool -> s -> FilePath -> Maybe Int64 -> IO MessageStats
17811780importMessages tty ms f old_ = do
17821781 logInfo $ " restoring messages from file " <> T. pack f
17831782 LB. readFile f >>= runExceptT . foldM restoreMsg (0 , Nothing , (0 , 0 , M. empty)) . LB. lines >>= \ case
0 commit comments