pub struct MemoryWriter { /* private fields */ }Expand description
Writes memory data and provisions the memory database/tables/graph on demand.
Implementations§
Source§impl MemoryWriter
impl MemoryWriter
Sourcepub fn new(
catalog: Arc<dyn Catalog>,
format: Arc<dyn SegmentFormat>,
embed: Arc<dyn EmbeddingBackend>,
) -> Self
pub fn new( catalog: Arc<dyn Catalog>, format: Arc<dyn SegmentFormat>, embed: Arc<dyn EmbeddingBackend>, ) -> Self
Build a writer over the catalog + format engine. Backend-agnostic — works
over the Postgres catalog (server) or the embedded SQLite catalog
(kyma local); no direct DB pool is required.
pub fn database(&self) -> &str
Sourcepub async fn ensure_provisioned(&self) -> Result<()>
pub async fn ensure_provisioned(&self) -> Result<()>
Ensure the memory database, both tables, and the memory graph
registration exist. Fast-paths when the node table is already present,
but first backfills any bi-temporal columns a pre-existing store is
missing (non-destructive: historical extents null-fill on read).
Sourcepub async fn save(&self, m: &CreateMemory) -> Result<Uuid>
pub async fn save(&self, m: &CreateMemory) -> Result<Uuid>
Embed + persist a new memory node plus a REFERENCES edge per reference.
Returns the new memory uuid.
Sourcepub async fn save_as(&self, id: Uuid, m: &CreateMemory) -> Result<()>
pub async fn save_as(&self, id: Uuid, m: &CreateMemory) -> Result<()>
Upsert a new version of an existing memory id (same id → latest-wins),
re-embedding the redacted content. Used by topic-key upsert so a repeated
save updates in place instead of creating a duplicate.
Sourcepub async fn link(
&self,
src_node_id: &str,
dst_node_id: &str,
rel_type: &str,
realm: &str,
target_namespace: Option<&str>,
) -> Result<()>
pub async fn link( &self, src_node_id: &str, dst_node_id: &str, rel_type: &str, realm: &str, target_namespace: Option<&str>, ) -> Result<()>
Append a single edge linking a memory node to another (possibly cross-graph) entity.
Sourcepub async fn append_node_rows(&self, node_rows: Vec<Value>) -> Result<()>
pub async fn append_node_rows(&self, node_rows: Vec<Value>) -> Result<()>
Append pre-built node rows (used by read-then-append mutations).
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryWriter
impl !UnwindSafe for MemoryWriter
impl Freeze for MemoryWriter
impl Send for MemoryWriter
impl Sync for MemoryWriter
impl Unpin for MemoryWriter
impl UnsafeUnpin for MemoryWriter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more