pub struct HmsCore { /* private fields */ }Expand description
Lock ordering: ShardSet (read) -> Shard.vectors -> Shard.ivf -> Shard.nsg. Arena lock is independent (managed internally by PersistentArena).
Implementations§
Source§impl HmsCore
impl HmsCore
Sourcepub fn synthesize_concepts(&self) -> Vec<ConceptCandidate>
pub fn synthesize_concepts(&self) -> Vec<ConceptCandidate>
Cluster similar vectors and return concept candidates with centroids and coherence scores.
Source§impl HmsCore
impl HmsCore
Sourcepub fn memorize_triplet(
&self,
id: String,
h: String,
r: String,
t: String,
) -> Result<()>
pub fn memorize_triplet( &self, id: String, h: String, r: String, t: String, ) -> Result<()>
Encode a (head, relation, tail) triplet as h XOR r XOR t and memorize it.
Sourcepub fn memorize_sequence(&self, id: String, sequence: &[String]) -> Result<()>
pub fn memorize_sequence(&self, id: String, sequence: &[String]) -> Result<()>
Encode an ordered sequence using position-based permutation and memorize it.
Sourcepub fn query_triplet(
&self,
h: String,
r: String,
k: u32,
) -> Result<Vec<RetrievalResult>>
pub fn query_triplet( &self, h: String, r: String, k: u32, ) -> Result<Vec<RetrievalResult>>
Query for tails matching head XOR relation.
Sourcepub fn find_analogy(
&self,
a: &str,
b: &str,
c: &str,
k: u32,
) -> Vec<RetrievalResult>
pub fn find_analogy( &self, a: &str, b: &str, c: &str, k: u32, ) -> Vec<RetrievalResult>
Find analogy: A is to B as C is to ? Returns k closest matches.
Sourcepub fn query_sequence(
&self,
partial: &[String],
k: u32,
) -> Result<Vec<RetrievalResult>>
pub fn query_sequence( &self, partial: &[String], k: u32, ) -> Result<Vec<RetrievalResult>>
Query for sequences matching a partial sequence prefix.
Source§impl HmsCore
impl HmsCore
Sourcepub fn query(&self, query_vec: &EntangledHVec, k: u32) -> Vec<RetrievalResult>
pub fn query(&self, query_vec: &EntangledHVec, k: u32) -> Vec<RetrievalResult>
Query the memory system for the k most similar vectors.
Sourcepub fn query_batch(
&self,
queries: &[EntangledHVec],
k: u32,
) -> Vec<Vec<RetrievalResult>>
pub fn query_batch( &self, queries: &[EntangledHVec], k: u32, ) -> Vec<Vec<RetrievalResult>>
Process multiple queries in parallel using rayon.
Sourcepub fn analyze_components(&self, vector: &EntangledHVec) -> Vec<RetrievalResult>
pub fn analyze_components(&self, vector: &EntangledHVec) -> Vec<RetrievalResult>
Analyze components of a vector by finding its nearest neighbors. Filters by similarity threshold from QueryConfig (default 0.05).
Source§impl HmsCore
impl HmsCore
Sourcepub fn new(
dimensions: u32,
storage_path: Option<String>,
config: Option<HmsConfig>,
) -> Result<Self>
pub fn new( dimensions: u32, storage_path: Option<String>, config: Option<HmsConfig>, ) -> Result<Self>
Create a new HMS instance. If storage_path is None, uses the current directory.
Sourcepub fn bundle<V: Borrow<EntangledHVec>>(&self, vectors: &[V]) -> EntangledHVec
pub fn bundle<V: Borrow<EntangledHVec>>(&self, vectors: &[V]) -> EntangledHVec
Bundle vectors respecting the PrivacyConfig. When dp_enabled, uses Laplace noise with the configured epsilon.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Returns the dimensionality of the hypervector space.
Sourcepub fn encode_text(&self, text: &str) -> EntangledHVec
pub fn encode_text(&self, text: &str) -> EntangledHVec
Encode text into a sparse hypervector using character trigrams.
Sourcepub fn analyze_text(&self, text: &str) -> TextMetrics
pub fn analyze_text(&self, text: &str) -> TextMetrics
Compute word, sentence, syllable, and character-class counts for text.
Sourcepub fn calculate_readability(&self, metrics: &TextMetrics) -> f64
pub fn calculate_readability(&self, metrics: &TextMetrics) -> f64
Compute Flesch Reading Ease score from text metrics.
Sourcepub fn delete(&self, id: &str) -> Result<bool>
pub fn delete(&self, id: &str) -> Result<bool>
Delete a vector by ID. Returns true if it existed. Crash-safe: tombstone is persisted first.
pub fn memorize_meaning(&self, id: &str, text: &str) -> Result<()>
Sourcepub fn compact(&self) -> Result<()>
pub fn compact(&self) -> Result<()>
Compact the arena log by rewriting only live vectors. Blocks all writes during compaction.
Sourcepub fn memorize(&self, id: String, vector: EntangledHVec) -> Result<()>
pub fn memorize(&self, id: String, vector: EntangledHVec) -> Result<()>
Store a vector with the given ID. Persists to the arena log and updates all indices.
Sourcepub fn memorize_vector(&self, id: String, dense: &[f32]) -> Result<()>
pub fn memorize_vector(&self, id: String, dense: &[f32]) -> Result<()>
Convert a dense f32 vector to sparse and memorize it.
Sourcepub fn memorize_scalar(
&self,
id: String,
value: f64,
min: f64,
max: f64,
) -> Result<()>
pub fn memorize_scalar( &self, id: String, value: f64, min: f64, max: f64, ) -> Result<()>
Encode a bounded scalar value as a hypervector and memorize it.
Sourcepub fn vector_count(&self) -> u64
pub fn vector_count(&self) -> u64
Returns the total number of stored vectors across all shards.
pub fn add_relation(&self, rel: &Relation) -> Result<()>
pub fn remove_relation( &self, source_id: &str, relation_type: &str, target_id: &str, ) -> bool
pub fn declare_relation_type(&self, rel_type: RelationType)
pub fn traverse( &self, start_id: &str, relation_type: Option<&str>, max_depth: u32, at_time: f64, ) -> Vec<GraphPath>
pub fn outgoing_relations( &self, source_id: &str, relation_type: Option<&str>, at_time: f64, ) -> Vec<Relation>
pub fn incoming_relations( &self, target_id: &str, relation_type: Option<&str>, at_time: f64, ) -> Vec<Relation>
pub fn relation_count(&self) -> usize
pub fn federated_query( &self, peer_paths: &[String], query_vec: &EntangledHVec, k: u32, ) -> Result<Vec<RetrievalResult>>
pub fn structural_query( &self, known: &[(&str, &EntangledHVec)], target_role: &str, ) -> Vec<StructuralResult>
pub fn multi_hop(&self, start: &str, relations: &[&str]) -> Vec<MultiHopResult>
pub fn meaning_cleanup(&self, noisy: &EntangledHVec) -> Option<(String, f64)>
pub fn declare_rule( &self, name: &str, input_relations: Vec<String>, output_relation: String, )
pub fn meaning_enabled(&self) -> bool
pub fn meaning_atom_count(&self) -> usize
pub fn meaning_composite_count(&self) -> usize
pub fn meaning_triple_count(&self) -> usize
pub fn meaning_rule_count(&self) -> usize
pub fn register_role(&mut self, name: &str, shift: usize) -> Result<()>
pub fn start_cognition(&self) -> Result<()>
pub fn stop_cognition(&self)
pub fn cognition_running(&self) -> bool
pub fn cognition_cycle_count(&self) -> u64
pub fn take_insights(&self) -> Vec<Insight>
pub fn cognition_insight_count(&self) -> usize
pub fn run_cognition_once(&self) -> Vec<Insight>
pub fn govern_memory(&self) -> GovernanceReport
pub fn cognition_enabled(&self) -> bool
Sourcepub fn ivf_trained(&self) -> bool
pub fn ivf_trained(&self) -> bool
Returns true if the IVF index has been trained.
Sourcepub fn train_ivf(&self) -> Result<()>
pub fn train_ivf(&self) -> Result<()>
Train the IVF index on current vectors. Persists the index to disk.
Sourcepub fn nsg_trained(&self) -> bool
pub fn nsg_trained(&self) -> bool
Returns true if the NSG graph index has been trained.
Sourcepub fn train_nsg(&self) -> Result<()>
pub fn train_nsg(&self) -> Result<()>
Train the NSG graph index on current vectors. Persists the index to disk.
Sourcepub fn audit_since(&self, timestamp_ms: u64) -> Result<Vec<AuditEntry>>
pub fn audit_since(&self, timestamp_ms: u64) -> Result<Vec<AuditEntry>>
Query the audit log for entries since timestamp_ms.
Returns an empty vec if audit logging is disabled.
Sourcepub fn factorize_diffusion(
&self,
product: &EntangledHVec,
domain_codebooks: &[Vec<EntangledHVec>],
max_iter: usize,
) -> Vec<Option<EntangledHVec>>
pub fn factorize_diffusion( &self, product: &EntangledHVec, domain_codebooks: &[Vec<EntangledHVec>], max_iter: usize, ) -> Vec<Option<EntangledHVec>>
Decompose a product vector into factors from domain codebooks using diffusion.
Auto Trait Implementations§
impl !Freeze for HmsCore
impl !RefUnwindSafe for HmsCore
impl !UnwindSafe for HmsCore
impl Send for HmsCore
impl Sync for HmsCore
impl Unpin for HmsCore
impl UnsafeUnpin for HmsCore
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.