mod cursor;
mod decode;
mod encode;
#[cfg(test)]
mod decode_proptest;
pub use decode::{decode_beamr_sync_frame, decode_sync_message};
pub use encode::{encode_beamr_sync_frame, encode_sync_message};
pub(crate) use cursor::MessageCursor;
pub(crate) use decode::clamp_capacity;
#[cfg(not(feature = "wasm"))]
pub(crate) use encode::encode_beamr_push_response_frame;
use crate::sync_codec::message::{
BatchWriteAck, BatchWriteProposal, Nack, Prepare, Promise, PullRequest, PushResponse,
RootExchangeRequest, RootExchangeResponse, ShardSyncRequest, WriteAck, WriteProposal,
};
use crate::sync_codec::target::{TargetNodeRequest, TargetNodeResponse};
pub(crate) const SYNC_CONTROL_FRAME: &[u8] = b"haematite.sync.v1";
pub(crate) const SYNC_PROTOCOL_VERSION: u8 = 1;
pub(crate) const MESSAGE_ROOT_REQUEST: u8 = 1;
pub(crate) const MESSAGE_ROOT_RESPONSE: u8 = 2;
pub(crate) const MESSAGE_PULL_REQUEST: u8 = 3;
pub(crate) const MESSAGE_PUSH_RESPONSE: u8 = 4;
pub(crate) const MESSAGE_TARGET_NODE_REQUEST: u8 = 5;
pub(crate) const MESSAGE_TARGET_NODE_RESPONSE: u8 = 6;
pub(crate) const MESSAGE_WRITE_PROPOSAL: u8 = 7;
pub(crate) const MESSAGE_WRITE_ACK: u8 = 8;
pub(crate) const MESSAGE_PREPARE: u8 = 9;
pub(crate) const MESSAGE_PROMISE: u8 = 10;
pub(crate) const MESSAGE_NACK: u8 = 11;
pub(crate) const MESSAGE_SHARD_SYNC_REQUEST: u8 = 12;
pub(crate) const MESSAGE_BATCH_WRITE_PROPOSAL: u8 = 13;
pub(crate) const MESSAGE_BATCH_WRITE_ACK: u8 = 14;
pub(crate) const ACK_OUTCOME_APPLIED: u8 = 0;
pub(crate) const ACK_OUTCOME_REJECTED: u8 = 1;
pub(crate) const WIRE_USIZE_BYTES: usize = 8;
pub(crate) const MIN_TRANSFER_BYTES: usize = 32 + WIRE_USIZE_BYTES;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SyncMessage {
RootRequest(RootExchangeRequest),
RootResponse(RootExchangeResponse),
PullRequest(PullRequest),
PushResponse(PushResponse),
ShardSyncRequest(ShardSyncRequest),
TargetNodeRequest(TargetNodeRequest),
TargetNodeResponse(TargetNodeResponse),
WriteProposal(WriteProposal),
WriteAck(WriteAck),
BatchWriteProposal(BatchWriteProposal),
BatchWriteAck(BatchWriteAck),
Prepare(Prepare),
Promise(Promise),
Nack(Nack),
}