pub struct NativeStore { /* private fields */ }Expand description
The default MemoryStore: the native, file-backed engine
(velesdb-core’s Database/AgentMemory, requiring the persistence
feature). Existing callers of MemoryService::open see no change — this
is exactly what they already ran.
Implementations§
Source§impl NativeStore
impl NativeStore
Sourcepub fn open<P: AsRef<Path>>(
path: P,
dimension: usize,
) -> Result<Self, MemoryError>
pub fn open<P: AsRef<Path>>( path: P, dimension: usize, ) -> Result<Self, MemoryError>
Open (or create) a native store at path, sized for dimension.
§Errors
Returns MemoryError if the store cannot be opened.
Trait Implementations§
Source§impl MemoryStore for NativeStore
Available on crate feature persistence only.
impl MemoryStore for NativeStore
persistence only.Source§fn store(
&self,
id: u64,
content: &str,
embedding: &[f32],
) -> Result<(), MemoryError>
fn store( &self, id: u64, content: &str, embedding: &[f32], ) -> Result<(), MemoryError>
Source§fn store_with_metadata(
&self,
id: u64,
content: &str,
embedding: &[f32],
metadata: &Metadata,
) -> Result<(), MemoryError>
fn store_with_metadata( &self, id: u64, content: &str, embedding: &[f32], metadata: &Metadata, ) -> Result<(), MemoryError>
metadata, no expiry. Read moreSource§fn store_with_ttl(
&self,
id: u64,
content: &str,
embedding: &[f32],
ttl_seconds: u64,
) -> Result<(), MemoryError>
fn store_with_ttl( &self, id: u64, content: &str, embedding: &[f32], ttl_seconds: u64, ) -> Result<(), MemoryError>
ttl_seconds, no metadata. Read moreSource§fn update_metadata(
&self,
id: u64,
metadata: &Metadata,
) -> Result<(), MemoryError>
fn update_metadata( &self, id: u64, metadata: &Metadata, ) -> Result<(), MemoryError>
metadata into an already-stored fact’s payload, preserving any
durable TTL. Used to combine metadata with an expiry (store both in
two calls rather than needing every metadata×TTL combination as a
separate primitive). Read moreSource§fn store_with_metadata_and_ttl(
&self,
id: u64,
content: &str,
embedding: &[f32],
metadata: &Metadata,
ttl_seconds: u64,
) -> Result<(), MemoryError>
fn store_with_metadata_and_ttl( &self, id: u64, content: &str, embedding: &[f32], metadata: &Metadata, ttl_seconds: u64, ) -> Result<(), MemoryError>
Source§fn get(&self, id: u64) -> Result<Option<(String, Vec<f32>)>, MemoryError>
fn get(&self, id: u64) -> Result<Option<(String, Vec<f32>)>, MemoryError>
None if unknown/expired. Read moreSource§fn get_metadata(&self, id: u64) -> Result<Option<Metadata>, MemoryError>
fn get_metadata(&self, id: u64) -> Result<Option<Metadata>, MemoryError>
_veles_*)
included, so the service layer can check the hub flag before
stripping them for the caller — or None when the fact is
unknown/expired. Read moreSource§fn get_metadata_batch(
&self,
ids: &[u64],
) -> Result<Vec<Option<Metadata>>, MemoryError>
fn get_metadata_batch( &self, ids: &[u64], ) -> Result<Vec<Option<Metadata>>, MemoryError>
Self::get_metadata: one storage round trip for every id
in ids, results in the same order and length (an unknown or expired
id maps to None). Same raw-payload semantics as the single-id form. Read moreSource§fn query_filtered(
&self,
embedding: &[f32],
k: usize,
filter: &Metadata,
offset: usize,
) -> Result<Vec<(u64, f32, String)>, MemoryError>
fn query_filtered( &self, embedding: &[f32], k: usize, filter: &Metadata, offset: usize, ) -> Result<Vec<(u64, f32, String)>, MemoryError>
k ids, narrowed to facts whose metadata
exactly matches every key in filter. Read moreSource§fn query_excluding(
&self,
embedding: &[f32],
k: usize,
exclude: &Metadata,
) -> Result<Vec<(u64, f32, String)>, MemoryError>
fn query_excluding( &self, embedding: &[f32], k: usize, exclude: &Metadata, ) -> Result<Vec<(u64, f32, String)>, MemoryError>
k ids, dropping facts whose metadata matches
every key in exclude. Read moreSource§fn query_columnar(
&self,
embedding: &[f32],
k: usize,
filters: &[ColumnFilter],
) -> Result<Vec<Recollection>, MemoryError>
fn query_columnar( &self, embedding: &[f32], k: usize, filters: &[ColumnFilter], ) -> Result<Vec<Recollection>, MemoryError>
ColumnStore predicates (ranges
and comparisons, not just equality) — the engine behind
crate::service::MemoryService::recall_where. Read moreSource§fn relate(&self, from: u64, to: u64, relation: &str) -> Result<u64, MemoryError>
fn relate(&self, from: u64, to: u64, relation: &str) -> Result<u64, MemoryError>
from -> to. Returns the edge id. Read moreSource§fn relations(&self, id: u64) -> Result<Vec<MemoryEdge>, MemoryError>
fn relations(&self, id: u64) -> Result<Vec<MemoryEdge>, MemoryError>
id. Read moreSource§fn incoming_relations(&self, id: u64) -> Result<Vec<MemoryEdge>, MemoryError>
fn incoming_relations(&self, id: u64) -> Result<Vec<MemoryEdge>, MemoryError>
id — the mirror of Self::relations, with
the same liveness rule applied to the far end (here the source). Read moreSource§fn relations_bounded(
&self,
id: u64,
cap: usize,
) -> Result<BoundedMemoryEdges, MemoryError>
fn relations_bounded( &self, id: u64, cap: usize, ) -> Result<BoundedMemoryEdges, MemoryError>
cap outgoing edges of id, plus whether its total degree
exceeded the scan — the bounded twin of Self::relations (#1820). Read moreSource§fn incoming_relations_bounded(
&self,
id: u64,
cap: usize,
) -> Result<BoundedMemoryEdges, MemoryError>
fn incoming_relations_bounded( &self, id: u64, cap: usize, ) -> Result<BoundedMemoryEdges, MemoryError>
cap incoming edges of id, plus whether its total incoming
degree exceeded the scan — the mirror of Self::relations_bounded,
same O(cap) cost contract. Read moreSource§fn unrelate(&self, edge_id: u64) -> Result<bool, MemoryError>
fn unrelate(&self, edge_id: u64) -> Result<bool, MemoryError>
edge_id. Returns true when it existed —
idempotent: removing an absent edge is Ok(false), never an error. Read moreSource§fn count(&self) -> usize
fn count(&self) -> usize
Source§fn edge_count(&self) -> Option<usize>
fn edge_count(&self) -> Option<usize>
why() can walk somewhere and one where it degrades to plain
similarity search. Read moreSource§fn list(
&self,
cursor: Option<u64>,
limit: usize,
) -> Result<(Vec<RawListedFact>, Option<u64>), MemoryError>
fn list( &self, cursor: Option<u64>, limit: usize, ) -> Result<(Vec<RawListedFact>, Option<u64>), MemoryError>
limit entries strictly after cursor (None starts the walk),
plus the cursor for the next page (None ends it). Payloads come
back RAW — reserved keys and scaffolding markers included — because
the policy of what a caller may see (hub filtering, key stripping)
belongs to the service layer, in one place, for every backend. Read moreAuto Trait Implementations§
impl !Freeze for NativeStore
impl !RefUnwindSafe for NativeStore
impl !UnwindSafe for NativeStore
impl Send for NativeStore
impl Sync for NativeStore
impl Unpin for NativeStore
impl UnsafeUnpin for NativeStore
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> 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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);