pub struct Ordinal<E: Context, V: CodecFixed<Cfg = ()>>(/* private fields */);Expand description
Implementation of Ordinal.
Mutating functions consume the store and return it only on success: an error (or a dropped future) destroys the handle.
Implementations§
Source§impl<E: Context, V: CodecFixed<Cfg = ()>> Ordinal<E, V>
impl<E: Context, V: CodecFixed<Cfg = ()>> Ordinal<E, V>
Sourcepub async fn init(
context: E,
config: Config,
bits: Option<BTreeMap<u64, &Option<BitMap>>>,
) -> Result<Self, Error>
pub async fn init( 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.
Passing Some(BTreeMap::new()) or None removes all stored sections and starts empty.
Sourcepub async fn put(self, index: u64, value: V) -> Result<Self, Error>
pub async fn put(self, index: u64, value: V) -> Result<Self, 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 ranges_from(&self, from: u64) -> impl Iterator<Item = (u64, u64)> + '_
pub fn ranges_from(&self, from: u64) -> impl Iterator<Item = (u64, u64)> + '_
Get an iterator over ranges that overlap or follow from.
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(self, min: u64) -> Result<Self, Error>
pub async fn prune(self, min: u64) -> Result<Self, 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§
Auto Trait Implementations§
impl<E, V> !RefUnwindSafe for Ordinal<E, V>
impl<E, V> !UnwindSafe for Ordinal<E, V>
impl<E, V> Freeze for Ordinal<E, V>
impl<E, V> Send for Ordinal<E, V>
impl<E, V> Sync for Ordinal<E, V>
impl<E, V> Unpin for Ordinal<E, V>
impl<E, V> UnsafeUnpin for Ordinal<E, V>where
Box<Inner<E, V>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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