pub struct Ordinal<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> { /* private fields */ }Expand description
Implementation of Ordinal.
Implementations§
Source§impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> Ordinal<E, V>
impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> Ordinal<E, V>
Sourcepub async fn init(context: E, config: Config) -> Result<Self, Error>
pub async fn init(context: E, config: Config) -> Result<Self, Error>
Initialize a new Ordinal instance.
Sourcepub async fn init_with_bits(
context: E,
config: Config,
bits: Option<BTreeMap<u64, &Option<BitMap>>>,
) -> Result<Self, Error>
pub async fn init_with_bits( context: E, config: Config, bits: Option<BTreeMap<u64, &Option<BitMap>>>, ) -> Result<Self, Error>
Initialize a new Ordinal instance with a collection of BitMaps (indicating which records should be considered available).
If a section is not provided in the BTreeMap, all records in that section are considered unavailable. If a BitMap is provided for a section, all records in that section are considered available if and only if the BitMap is set for the record. If a section is provided but no BitMap is populated, all records in that section are considered available.
Sourcepub async fn put(&mut self, index: u64, value: V) -> Result<(), Error>
pub async fn put(&mut self, index: u64, value: V) -> Result<(), Error>
Add a value at the specified index (pending until sync).
Sourcepub async fn get(&self, index: u64) -> Result<Option<V>, Error>
pub async fn get(&self, index: u64) -> Result<Option<V>, Error>
Get the value for a given index.
Sourcepub fn next_gap(&self, index: u64) -> (Option<u64>, Option<u64>)
pub fn next_gap(&self, index: u64) -> (Option<u64>, Option<u64>)
Get the next gap information for backfill operations.
Sourcepub fn ranges(&self) -> impl Iterator<Item = (u64, u64)> + '_
pub fn ranges(&self) -> impl Iterator<Item = (u64, u64)> + '_
Get an iterator over all ranges in the Ordinal.
Sourcepub fn first_index(&self) -> Option<u64>
pub fn first_index(&self) -> Option<u64>
Retrieve the first index in the Ordinal.
Sourcepub fn last_index(&self) -> Option<u64>
pub fn last_index(&self) -> Option<u64>
Retrieve the last index in the Ordinal.
Sourcepub fn missing_items(&self, start: u64, max: usize) -> Vec<u64>
pub fn missing_items(&self, start: u64, max: usize) -> Vec<u64>
Returns up to max missing items starting from start.
This method iterates through gaps between existing ranges, collecting missing indices
until either max items are found or there are no more gaps to fill.
Sourcepub async fn prune(&mut self, min: u64) -> Result<(), Error>
pub async fn prune(&mut self, min: u64) -> Result<(), Error>
Prune indices older than min by removing entire blobs.
Pruning is done at blob boundaries to avoid partial deletions. A blob is pruned only if
all possible indices in that blob are less than min.
Trait Implementations§
Source§impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> StoreMut for Ordinal<E, V>
impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> StoreMut for Ordinal<E, V>
Source§async fn update(
&mut self,
key: Self::Key,
value: Self::Value,
) -> Result<(), Self::Error>
async fn update( &mut self, key: Self::Key, value: Self::Value, ) -> Result<(), Self::Error>
Source§impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> StorePersistable for Ordinal<E, V>
impl<E: Storage + Metrics + Clock, V: CodecFixed<Cfg = ()>> StorePersistable for Ordinal<E, V>
Auto Trait Implementations§
impl<E, V> Freeze for Ordinal<E, V>where
E: Freeze,
impl<E, V> !RefUnwindSafe for Ordinal<E, V>
impl<E, V> Send for Ordinal<E, V>where
V: Send,
impl<E, V> Sync for Ordinal<E, V>where
V: Sync,
impl<E, V> Unpin for Ordinal<E, V>
impl<E, V> !UnwindSafe for Ordinal<E, V>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more