pub struct OrderedAppender { /* private fields */ }Expand description
Single-threaded deterministic appender over a RedexFile.
Cheap to construct; holds a cloned RedexFile handle internally.
Implementations§
Source§impl OrderedAppender
impl OrderedAppender
Sourcepub fn new(file: RedexFile) -> OrderedAppender
pub fn new(file: RedexFile) -> OrderedAppender
Wrap a RedexFile. The appender doesn’t hold any exclusive
resource; callers who care about determinism should ensure
they use only one OrderedAppender per file.
Sourcepub fn file(&self) -> &RedexFile
pub fn file(&self) -> &RedexFile
The underlying file. Useful for tail / read_range operations from the same handle.
Sourcepub fn append(&self, payload: &[u8]) -> Result<u64, RedexError>
pub fn append(&self, payload: &[u8]) -> Result<u64, RedexError>
Append one payload (heap segment). Returns the assigned seq. Holds the file’s state lock across seq allocation.
Sourcepub fn append_inline(&self, payload: &[u8; 8]) -> Result<u64, RedexError>
pub fn append_inline(&self, payload: &[u8; 8]) -> Result<u64, RedexError>
Append a fixed 8-byte inline payload. Same ordering contract
as Self::append.
Sourcepub fn append_batch(
&self,
payloads: &[Bytes],
) -> Result<Option<u64>, RedexError>
pub fn append_batch( &self, payloads: &[Bytes], ) -> Result<Option<u64>, RedexError>
Append a batch. The whole batch lands under one lock hold — seqs are strictly contiguous within the batch AND strictly ordered relative to other ordered writers.
Returns Some(first_seq) on non-empty input, None on empty.
Trait Implementations§
Source§impl Clone for OrderedAppender
impl Clone for OrderedAppender
Source§fn clone(&self) -> OrderedAppender
fn clone(&self) -> OrderedAppender
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more