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<BitVec>>>,
) -> Result<Self, Error>
pub async fn init_with_bits( context: E, config: Config, bits: Option<BTreeMap<u64, &Option<BitVec>>>, ) -> Result<Self, Error>
Initialize a new Ordinal instance with a collection of BitVecs (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 BitVec is provided for a section, all records in that section are considered available if and only if the BitVec is set for the record. If a section is provided but no BitVec 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 missing_items(&self, start: u64, max: usize) -> Vec<u64>
pub fn missing_items(&self, start: u64, max: usize) -> Vec<u64>
Get up to the next max
missing items after start
.
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
.
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§
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
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