simplex-chat-6.5.0.19
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simplex.Chat.Messages.Batch

Synopsis

Documentation

data MsgBatch Source #

Constructors

MsgBatch ByteString [SndMessage] 

data BatchMode Source #

Constructors

BMJson 
BMBinary 

Instances

Instances details
Show BatchMode Source # 
Instance details

Defined in Simplex.Chat.Messages.Batch

Methods

showsPrec :: Int -> BatchMode -> ShowS

show :: BatchMode -> String

showList :: [BatchMode] -> ShowS

Eq BatchMode Source # 
Instance details

Defined in Simplex.Chat.Messages.Batch

Methods

(==) :: BatchMode -> BatchMode -> Bool

(/=) :: BatchMode -> BatchMode -> Bool

encodeBatchElement :: Maybe SignedMsg -> ByteString -> ByteString Source #

Encode a batch element with optional signature prefix. Dual of elementP's //'{'cases.

encodeFwdElement :: GrpMsgForward -> VerifiedMsg 'Json -> ByteString Source #

Encode a batch element for relay groups: >GrpMsgForward[/sigs]body.

encodeBinaryBatch :: [ByteString] -> ByteString Source #

batchMessages :: BatchMode -> Int -> [Either ChatError SndMessage] -> [Either ChatError MsgBatch] Source #

Batches SndMessages in [Either ChatError SndMessage] into batches of ByteStrings. BMJson mode: JSON arrays like [msg1,msg2,...] BMBinary mode: Binary format =count(len:2body)* Preserves original errors in the list. If a single element is passed, it is returned as is. If an element exceeds maxLen, it is returned as ChatError. Elements are encoded with signature prefix via encodeBatchElement.

batchDeliveryTasks1 :: VersionRangeChat -> Int -> NonEmpty MessageDeliveryTask -> (ByteString, [Int64], [Int64]) Source #

Batches delivery tasks into (batch, [taskIds], [largeTaskIds]). Always uses binary batch format for relay groups.