pub struct TypedRedexFile<T> { /* private fields */ }Expand description
Typed wrapper over a RedexFile. T is the domain event type;
it must be Serialize + DeserializeOwned for postcard.
Implementations§
Source§impl<T> TypedRedexFile<T>
impl<T> TypedRedexFile<T>
Source§impl<T: Serialize> TypedRedexFile<T>
impl<T: Serialize> TypedRedexFile<T>
Sourcepub fn append(&self, value: &T) -> Result<u64, RedexError>
pub fn append(&self, value: &T) -> Result<u64, RedexError>
Serialize with postcard and append. Returns the assigned seq.
Sourcepub fn append_batch(&self, values: &[T]) -> Result<Option<u64>, RedexError>
pub fn append_batch(&self, values: &[T]) -> Result<Option<u64>, RedexError>
Serialize a batch and append atomically (all entries land in the index contiguously or none do).
Returns Some(first_seq) on non-empty input, None on empty
input — propagates the underlying RedexFile::append_batch
contract.
Source§impl<T: DeserializeOwned + Send + 'static> TypedRedexFile<T>
impl<T: DeserializeOwned + Send + 'static> TypedRedexFile<T>
Sourcepub fn tail(
&self,
from_seq: u64,
) -> impl Stream<Item = Result<(u64, T), RedexError>> + Send + 'static
pub fn tail( &self, from_seq: u64, ) -> impl Stream<Item = Result<(u64, T), RedexError>> + Send + 'static
Tail the file from from_seq onward, yielding (seq, value)
pairs. Deserialization errors surface as
RedexError::Encode items — the stream continues.
Sourcepub fn read_range(
&self,
start: u64,
end: u64,
) -> Vec<Result<(u64, T), RedexError>>
pub fn read_range( &self, start: u64, end: u64, ) -> Vec<Result<(u64, T), RedexError>>
Read the half-open range [start, end), returning (seq, value)
pairs. Deserialization errors are returned per-entry —
callers decide whether to skip or abort.
Trait Implementations§
Source§impl<T> Clone for TypedRedexFile<T>
impl<T> Clone for TypedRedexFile<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TypedRedexFile<T>
impl<T> !UnwindSafe for TypedRedexFile<T>
impl<T> Freeze for TypedRedexFile<T>
impl<T> Send for TypedRedexFile<T>
impl<T> Sync for TypedRedexFile<T>
impl<T> Unpin for TypedRedexFile<T>
impl<T> UnsafeUnpin for TypedRedexFile<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more