| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Chat.Messages.Batch
Synopsis
- data MsgBatch = MsgBatch ByteString [SndMessage]
- data BatchMode
- encodeBatchElement :: Maybe SignedMsg -> ByteString -> ByteString
- encodeFwdElement :: GrpMsgForward -> VerifiedMsg 'Json -> ByteString
- encodeBinaryBatch :: [ByteString] -> ByteString
- batchMessages :: BatchMode -> Int -> [Either ChatError SndMessage] -> [Either ChatError MsgBatch]
- batchDeliveryTasks1 :: VersionRangeChat -> Int -> NonEmpty MessageDeliveryTask -> (ByteString, [Int64], [Int64])
Documentation
Constructors
| MsgBatch ByteString [SndMessage] |
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.