pub struct VecWSet<K, R>{ /* private fields */ }Expand description
An immutable collection of (key, weight) pairs without timing information.
Implementations§
Source§impl<K, R> VecWSet<K, R>
impl<K, R> VecWSet<K, R>
pub fn from_parts( factories: VecWSetFactories<K, R>, keys: Box<DynVec<K>>, diffs: Box<DynVec<R>>, ) -> Self
Trait Implementations§
Source§impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Archive for VecWSet<K, R>
impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Archive for VecWSet<K, R>
Source§impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Batch for VecWSet<K, R>
impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Batch for VecWSet<K, R>
Source§type Timed<T: Timestamp> = VecKeyBatch<K, T, R>
type Timed<T: Timestamp> = VecKeyBatch<K, T, R>
A batch type equivalent to
Self, but with timestamp type T instead of Self::Time.Source§type Batcher = MergeBatcher<VecWSet<K, R>>
type Batcher = MergeBatcher<VecWSet<K, R>>
A type used to assemble batches from disordered updates.
Source§type Builder = VecWSetBuilder<K, R>
type Builder = VecWSetBuilder<K, R>
A type used to assemble batches from ordered update sequences.
Source§fn dyn_from_tuples(
factories: &Self::Factories,
time: Self::Time,
tuples: &mut Box<DynWeightedPairs<DynPair<Self::Key, Self::Val>, Self::R>>,
) -> Self
fn dyn_from_tuples( factories: &Self::Factories, time: Self::Time, tuples: &mut Box<DynWeightedPairs<DynPair<Self::Key, Self::Val>, Self::R>>, ) -> Self
Assemble an unordered vector of weighted items into a batch.
Source§fn from_batch<BI>(
batch: &BI,
timestamp: &Self::Time,
factories: &Self::Factories,
) -> Self
fn from_batch<BI>( batch: &BI, timestamp: &Self::Time, factories: &Self::Factories, ) -> Self
Creates a new batch as a copy of
batch, using timestamp for all of
the new batch’s timestamps This is useful for adding a timestamp to a
batch, or for converting between different batch implementations
(e.g. writing an in-memory batch to disk). Read moreSource§fn from_arc_batch<BI>(
batch: &Arc<BI>,
timestamp: &Self::Time,
factories: &Self::Factories,
) -> Arc<Self>
fn from_arc_batch<BI>( batch: &Arc<BI>, timestamp: &Self::Time, factories: &Self::Factories, ) -> Arc<Self>
Like
from_batch, but avoids cloning the batch if the output type is identical to the input type.Source§fn from_cursor<C>(
cursor: C,
timestamp: &Self::Time,
factories: &Self::Factories,
key_capacity: usize,
value_capacity: usize,
) -> Self
fn from_cursor<C>( cursor: C, timestamp: &Self::Time, factories: &Self::Factories, key_capacity: usize, value_capacity: usize, ) -> Self
Creates a new batch as a copy of the tuples accessible via
cursor``, using timestamp` for all of the new batch’s timestamps.Source§fn filter(&self, predicate: &dyn Fn(&Self::Key, &Self::Val) -> bool) -> Self
fn filter(&self, predicate: &dyn Fn(&Self::Key, &Self::Val) -> bool) -> Self
Returns elements from
self that satisfy a predicate.Source§fn persisted(&self) -> Option<Self>
fn persisted(&self) -> Option<Self>
If this batch is not on storage, but supports writing itself to storage,
this method writes it to storage and returns the stored version.
Source§fn file_reader(&self) -> Option<Arc<dyn FileReader>>
fn file_reader(&self) -> Option<Arc<dyn FileReader>>
This functions returns the file that can be used to restore the batch’s
contents. Read more
fn from_path( _factories: &Self::Factories, _path: &StoragePath, ) -> Result<Self, ReaderError>
Source§impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> BatchReader for VecWSet<K, R>
impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> BatchReader for VecWSet<K, R>
Source§type Cursor<'s> = VecWSetCursor<'s, K, R>
type Cursor<'s> = VecWSetCursor<'s, K, R>
The type used to enumerate the batch’s contents.
type Factories = VecWSetFactories<K, R>
fn factories(&self) -> Self::Factories
Source§fn consuming_cursor(
&mut self,
key_filter: Option<Filter<Self::Key>>,
value_filter: Option<GroupFilter<Self::Val>>,
) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
fn consuming_cursor( &mut self, key_filter: Option<Filter<Self::Key>>, value_filter: Option<GroupFilter<Self::Val>>, ) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
Acquires a merge cursor for the batch’s contents.
Source§fn approximate_byte_size(&self) -> usize
fn approximate_byte_size(&self) -> usize
The memory or storage size of the batch in bytes. Read more
Source§fn filter_stats(&self) -> BloomFilterStats
fn filter_stats(&self) -> BloomFilterStats
Statistics of the Bloom filter used by Cursor::seek_key_exact.
The Bloom filter (kept in memory) is used there to quickly check
whether a key might be present in the batch, before doing a
binary tree lookup within the batch to be exactly sure.
The statistics include for example the size in bytes and the hit rate.
Only some kinds of batches use a filter; others should return
BloomFilterStats::default().Source§fn sample_keys<RG>(
&self,
rng: &mut RG,
sample_size: usize,
sample: &mut DynVec<Self::Key>,
)where
RG: Rng,
fn sample_keys<RG>(
&self,
rng: &mut RG,
sample_size: usize,
sample: &mut DynVec<Self::Key>,
)where
RG: Rng,
Returns a uniform random sample of distincts keys from the batch. Read more
fn keys(&self) -> Option<&DynVec<Self::Key>>
Source§fn push_cursor(
&self,
) -> Box<dyn PushCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
fn push_cursor( &self, ) -> Box<dyn PushCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
Acquires a PushCursor for the batch’s contents.
Source§fn merge_cursor(
&self,
key_filter: Option<Filter<Self::Key>>,
value_filter: Option<GroupFilter<Self::Val>>,
) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
fn merge_cursor( &self, key_filter: Option<Filter<Self::Key>>, value_filter: Option<GroupFilter<Self::Val>>, ) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + '_>
Acquires a MergeCursor for the batch’s contents.
Source§fn merge_cursor_with_snapshot<'a, S>(
&'a self,
key_filter: Option<Filter<Self::Key>>,
value_filter: Option<GroupFilter<Self::Val>>,
snapshot: &'a Option<Arc<S>>,
) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + 'a>
fn merge_cursor_with_snapshot<'a, S>( &'a self, key_filter: Option<Filter<Self::Key>>, value_filter: Option<GroupFilter<Self::Val>>, snapshot: &'a Option<Arc<S>>, ) -> Box<dyn MergeCursor<Self::Key, Self::Val, Self::Time, Self::R> + Send + 'a>
Similar to
merge_cursor, but invoked in the context of a spine merger.
Takes the current spine snapshot as an extra argument and uses it to evaluate value_filter precisely.Source§fn location(&self) -> BatchLocation
fn location(&self) -> BatchLocation
Where the batch’s data is stored.
Source§fn cache_stats(&self) -> CacheStats
fn cache_stats(&self) -> CacheStats
Storage cache access statistics for this batch only. Read more
Source§fn maybe_contains_key(&self, _hash: u64) -> bool
fn maybe_contains_key(&self, _hash: u64) -> bool
A method that returns either true (possibly in the batch) or false
(definitely not in the batch).
Source§fn partition_keys(&self, num_partitions: usize, bounds: &mut DynVec<Self::Key>)
fn partition_keys(&self, num_partitions: usize, bounds: &mut DynVec<Self::Key>)
Returns num_partitions-1 keys from the batch that partition the batch into num_partitions
approximately equal size ranges 0..key1, key1..key2, … , key_num_partitions-1..last_key_in_the_batch. Read more
Source§async fn fetch<B>(
&self,
keys: &B,
) -> Option<Box<dyn CursorFactory<Self::Key, Self::Val, Self::Time, Self::R>>>
async fn fetch<B>( &self, keys: &B, ) -> Option<Box<dyn CursorFactory<Self::Key, Self::Val, Self::Time, Self::R>>>
Creates and returns a new batch that is a subset of this one, containing
only the key-value pairs whose keys are in
keys. May also return
None, the default implementation, if the batch doesn’t want to
implement this method. In particular, a batch for which access through
a cursor is fast should return None to avoid the expense of copying
data. Read moreSource§impl<K, R> Builder<VecWSet<K, R>> for VecWSetBuilder<K, R>
impl<K, R> Builder<VecWSet<K, R>> for VecWSetBuilder<K, R>
Source§fn with_capacity(
factories: &VecWSetFactories<K, R>,
key_capacity: usize,
_value_capacity: usize,
) -> Self
fn with_capacity( factories: &VecWSetFactories<K, R>, key_capacity: usize, _value_capacity: usize, ) -> Self
Creates an empty builder with estimated capacities for keys and
key-value pairs. Only
tuple_capacity >= key_capacity makes sense but
implementations must tolerate contradictory capacity requests.Source§fn push_key_mut(&mut self, key: &mut K)
fn push_key_mut(&mut self, key: &mut K)
Adds key
key.Source§fn push_time_diff(&mut self, _time: &(), weight: &R)
fn push_time_diff(&mut self, _time: &(), weight: &R)
Adds time-diff pair
(time, weight).Source§fn push_time_diff_mut(&mut self, _time: &mut (), weight: &mut R)
fn push_time_diff_mut(&mut self, _time: &mut (), weight: &mut R)
Adds time-diff pair
(time, weight).fn num_keys(&self) -> usize
fn num_tuples(&self) -> usize
Source§fn new_builder(factories: &Output::Factories) -> Self
fn new_builder(factories: &Output::Factories) -> Self
Creates a new builder with an initial capacity of 0.
Source§fn for_merge<'a, B, I>(
factories: &Output::Factories,
batches: I,
location: Option<BatchLocation>,
) -> Self
fn for_merge<'a, B, I>( factories: &Output::Factories, batches: I, location: Option<BatchLocation>, ) -> Self
Creates an empty builder to hold the result of merging
batches. Optionally, location can specify the preferred location for
the result of the merge.Source§fn push_val_mut(&mut self, val: &mut Output::Val)
fn push_val_mut(&mut self, val: &mut Output::Val)
Adds value
val.Source§fn push_diff_mut(&mut self, weight: &mut Output::R)
fn push_diff_mut(&mut self, weight: &mut Output::R)
Adds time-diff pair
(), weight.Source§fn push_val_diff(&mut self, val: &Output::Val, weight: &Output::R)
fn push_val_diff(&mut self, val: &Output::Val, weight: &Output::R)
Adds time-diff pair
(), weight and value val.Source§impl<K, R> Checkpoint for VecWSet<K, R>
impl<K, R> Checkpoint for VecWSet<K, R>
Source§impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Deserialize<VecWSet<K, R>, Deserializer> for ()
impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Deserialize<VecWSet<K, R>, Deserializer> for ()
Source§fn deserialize(
&self,
_deserializer: &mut Deserializer,
) -> Result<VecWSet<K, R>, <Deserializer as Fallible>::Error>
fn deserialize( &self, _deserializer: &mut Deserializer, ) -> Result<VecWSet<K, R>, <Deserializer as Fallible>::Error>
Deserializes using the given deserializer
Source§impl<K, R> DynFilterMap for VecWSet<K, R>
impl<K, R> DynFilterMap for VecWSet<K, R>
Source§type DynItemRef<'a> = &'a K
type DynItemRef<'a> = &'a K
A borrowed version of the record type, e.g.,
(&K, &V) for a stream of
(key, value, weight) tuples or &K if the value type is ().fn item_ref<'a>(key: &'a Self::Key, _val: &'a Self::Val) -> Self::DynItemRef<'a>
fn item_ref_keyval(item_ref: Self::DynItemRef<'_>) -> (&Self::Key, &Self::Val)
fn dyn_filter<C: Circuit>( stream: &Stream<C, Self>, filter_func: Box<dyn Fn(Self::DynItemRef<'_>) -> bool>, ) -> Stream<C, Self>
fn dyn_map_generic<C: Circuit, O>( stream: &Stream<C, Self>, output_factories: &O::Factories, map_func: Box<dyn Fn(Self::DynItemRef<'_>, &mut DynPair<O::Key, O::Val>)>, ) -> Stream<C, O>
fn dyn_flat_map_generic<C: Circuit, O>( stream: &Stream<C, Self>, output_factories: &O::Factories, func: Box<dyn FnMut(Self::DynItemRef<'_>, &mut dyn FnMut(&mut O::Key, &mut O::Val))>, ) -> Stream<C, O>
Source§impl<K: DataTrait + ?Sized, R: WeightTraitTyped + ?Sized> NegByRef for VecWSet<K, R>
impl<K: DataTrait + ?Sized, R: WeightTraitTyped + ?Sized> NegByRef for VecWSet<K, R>
fn neg_by_ref(&self) -> Self
Source§impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> NumEntries for VecWSet<K, R>
impl<K: DataTrait + ?Sized, R: WeightTrait + ?Sized> NumEntries for VecWSet<K, R>
Source§const CONST_NUM_ENTRIES: Option<usize> = Leaf<K, R>::CONST_NUM_ENTRIES
const CONST_NUM_ENTRIES: Option<usize> = Leaf<K, R>::CONST_NUM_ENTRIES
Returns
Some(n) if Self has constant size or None otherwise.Source§fn num_entries_shallow(&self) -> usize
fn num_entries_shallow(&self) -> usize
Returns the number of entries in
self.Source§fn num_entries_deep(&self) -> usize
fn num_entries_deep(&self) -> usize
Recursively computes the number of entries in a container by
calling this method on each entry in
self. Read moreSource§fn serialize(
&self,
_serializer: &mut Serializer,
) -> Result<Self::Resolver, <Serializer as Fallible>::Error>
fn serialize( &self, _serializer: &mut Serializer, ) -> Result<Self::Resolver, <Serializer as Fallible>::Error>
Writes the dependencies for the object and returns a resolver that can create the archived
type.
Source§impl<K, R> SizeOf for VecWSet<K, R>
impl<K, R> SizeOf for VecWSet<K, R>
Source§fn size_of_children(&self, context: &mut Context)
fn size_of_children(&self, context: &mut Context)
Gets the size of all “children” owned by this value, not including the
size of the value itself. Read more
Source§fn size_of_with_context(&self, context: &mut Context)
fn size_of_with_context(&self, context: &mut Context)
Adds the size of the current value to the given
Context,
including both the size of the value itself and all of its childrenimpl<K, R> Eq for VecWSet<K, R>
Auto Trait Implementations§
impl<K, R> Freeze for VecWSet<K, R>
impl<K, R> !RefUnwindSafe for VecWSet<K, R>
impl<K, R> Send for VecWSet<K, R>
impl<K, R> Sync for VecWSet<K, R>
impl<K, R> Unpin for VecWSet<K, R>
impl<K, R> UnsafeUnpin for VecWSet<K, R>
impl<K, R> !UnwindSafe for VecWSet<K, R>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive, it may be unsized. Read moreSource§type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
Source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
Creates the archived version of the metadata for this value at the given position and writes
it to the given output. Read more
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CustomError for T
impl<T> CustomError for T
Source§impl<T> DeserializableDyn for Twhere
T: ArchivedDBData,
impl<T> DeserializableDyn for Twhere
T: ArchivedDBData,
Source§unsafe fn deserialize_from_bytes_with(
&mut self,
bytes: &[u8],
pos: usize,
deserializer: &mut Deserializer,
)
unsafe fn deserialize_from_bytes_with( &mut self, bytes: &[u8], pos: usize, deserializer: &mut Deserializer, )
Deserialize
self from the given slice and offset. Read moreSource§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Z> IndexedZSetReader for Z
impl<Z> IndexedZSetReader for Z
Source§fn iter(&self) -> IndexedZSetIterator<'_, Self> ⓘ
fn iter(&self) -> IndexedZSetIterator<'_, Self> ⓘ
Returns an iterator over updates in the indexed Z-set.
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>
Converts
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>
Converts
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializeDyn for Twhere
T: ArchivedDBData,
impl<T> SerializeDyn for Twhere
T: ArchivedDBData,
fn serialize( &self, serializer: &mut CompositeSerializer<FBufSerializer<FBuf>, FallbackScratch<HeapScratch<65536>, AllocScratch>, SharedSerializeMap>, ) -> Result<usize, <CompositeSerializer<FBufSerializer<FBuf>, FallbackScratch<HeapScratch<65536>, AllocScratch>, SharedSerializeMap> as Fallible>::Error>
Source§impl<T, S> SerializeUnsized<S> for T
impl<T, S> SerializeUnsized<S> for T
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.
Source§impl<B> WithSnapshot for Bwhere
B: Batch,
impl<B> WithSnapshot for Bwhere
B: Batch,
type Batch = B
fn into_ro_snapshot(self) -> SpineSnapshot<B>
Source§fn ro_snapshot(&self) -> SpineSnapshot<<B as WithSnapshot>::Batch>
fn ro_snapshot(&self) -> SpineSnapshot<<B as WithSnapshot>::Batch>
Returns a read-only, non-merging snapshot of the current trace
state.