pub struct JsonStorage { /* private fields */ }Expand description
JSON-backed corpus storage. Wraps a MemoryStorage with load/save
against a file. On-disk format matches Ruby + Go byte-for-byte
(modulo serde key-ordering inside maps, which neither runtime
preserves through json marshal/unmarshal).
Implementations§
Trait Implementations§
Source§impl Storage for JsonStorage
impl Storage for JsonStorage
fn max_values(&self) -> usize
fn increment_host(&mut self, host: &str)
fn increment_path_length(&mut self, length: usize)
fn increment_raw_shape(&mut self, shape: &str)
fn increment_fingerprint(&mut self, shape: &str)
fn observe_position(&mut self, pos: &Position, value: &str, t: SegmentType)
fn add_to_cluster( &mut self, key: &str, host: &str, scheme: &str, shape: &str, iri: &Identifier, )
fn host_counts(&self) -> HashMap<String, usize>
fn path_length_counts(&self) -> HashMap<usize, usize>
fn raw_shape_counts(&self) -> HashMap<String, usize>
fn fingerprint_counts(&self) -> HashMap<String, usize>
fn position_stats_for(&self, pos: &Position) -> Option<PositionStats>
fn each_position_stats(&self, f: &mut dyn FnMut(&Position, &PositionStats))
fn clusters(&self) -> Vec<Cluster>
fn cluster_for(&self, key: &str) -> Option<Cluster>
fn cluster_size(&self) -> usize
fn record_observation(&mut self, canonical: &str)
fn each_observed_iri(&self, f: &mut dyn FnMut(&str))
fn observed_iri_count(&self) -> usize
fn clear_materialized_views(&mut self)
fn record_activated_recognizer(&mut self, dump: Value)
fn each_activated_recognizer(&self, f: &mut dyn FnMut(&Value))
fn activated_recognizer_count(&self) -> usize
fn flush(&mut self) -> Result<()>
fn save_to(&mut self, path: &str) -> Result<()>
fn path(&self) -> Option<String>
Source§fn for_each_host(&self, f: &mut dyn FnMut(&str, usize))
fn for_each_host(&self, f: &mut dyn FnMut(&str, usize))
Visit each (host, count) without materializing a HashMap. Default
falls back to a full materialization for backends that can’t stream.
fn for_each_raw_shape(&self, f: &mut dyn FnMut(&str, usize))
fn for_each_fingerprint(&self, f: &mut dyn FnMut(&str, usize))
Source§fn batch_begin(&mut self) -> Result<()>
fn batch_begin(&mut self) -> Result<()>
Wraps a closure in a single backend transaction. SQLite turns
O(observations) fsyncs into one; Memory + JSON are no-ops.
fn batch_commit(&mut self) -> Result<()>
fn close(&mut self) -> Result<()>
Auto Trait Implementations§
impl Freeze for JsonStorage
impl RefUnwindSafe for JsonStorage
impl Send for JsonStorage
impl Sync for JsonStorage
impl Unpin for JsonStorage
impl UnsafeUnpin for JsonStorage
impl UnwindSafe for JsonStorage
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
Mutably borrows from an owned value. Read more