pub struct ReactiveIndex<K, V>{
pub node_id: NodeId,
/* private fields */
}Expand description
Reactive sorted index with primary key lookup and secondary sort order.
Emits Vec<IndexRow<K, V>> snapshots via a Core state node on every mutation.
Fields§
§node_id: NodeIdImplementations§
Source§impl<K, V> ReactiveIndex<K, V>
impl<K, V> ReactiveIndex<K, V>
pub fn new( core: &Core, intern: InternFn<Vec<IndexRow<K, V>>>, opts: ReactiveIndexOptions<K, V>, ) -> Self
pub fn size(&self) -> usize
pub fn has(&self, primary: &K) -> bool
pub fn get(&self, primary: &K) -> Option<V>
Sourcepub fn upsert(
&self,
core: &Core,
primary: K,
secondary: String,
value: V,
) -> bool
pub fn upsert( &self, core: &Core, primary: K, secondary: String, value: V, ) -> bool
Insert or update a row. Returns true if inserted (new primary key),
false if updated or skipped by equals idempotency.
Sourcepub fn upsert_with(
&self,
core: &Core,
primary: K,
secondary: String,
value: V,
opts: &UpsertOptions<K, V>,
) -> bool
pub fn upsert_with( &self, core: &Core, primary: K, secondary: String, value: V, opts: &UpsertOptions<K, V>, ) -> bool
Insert or update a row with per-call options.
If opts.equals (or the factory-level equals) returns true for the
existing row vs the proposed row, the upsert is a no-op (no emission).
Sourcepub fn upsert_many(&self, core: &Core, rows: Vec<(K, String, V)>)
pub fn upsert_many(&self, core: &Core, rows: Vec<(K, String, V)>)
Batch upsert. Rows matching the factory-level equals are skipped. If ALL rows are skipped, no emission occurs.
pub fn delete(&self, core: &Core, primary: &K)
pub fn delete_many(&self, core: &Core, primaries: &[K])
pub fn clear(&self, core: &Core)
pub fn to_ordered(&self) -> Vec<IndexRow<K, V>>
pub fn to_primary_map(&self) -> Vec<(K, V)>
Sourcepub fn range_by_primary(&self, start: &K, end: &K) -> Vec<V>where
K: Ord,
pub fn range_by_primary(&self, start: &K, end: &K) -> Vec<V>where
K: Ord,
Values of all rows whose primary key sorts within [start, end)
(inclusive start, exclusive end), in ascending primary-key order
(D205). start >= end or no matches → empty vec. The K: Ord bound
is method-scoped so it does not constrain ReactiveIndex<K, V> itself.