Skip to main content

Op

Enum Op 

Source
pub enum Op<'a> {
    Remember {
        now: u64,
        valid_from: u64,
        entity: Option<&'a str>,
        text: &'a str,
        tags: Vec<&'a str>,
        links: Vec<(&'a str, &'a str)>,
        vector: Vec<f32>,
        metadata: Vec<(&'a str, &'a str)>,
        revises: FactId,
        assigned: FactId,
    },
    Forget {
        now: u64,
        fact: FactId,
    },
    Link {
        now: u64,
        src: &'a str,
        rel: &'a str,
        dst: &'a str,
        provenance: FactId,
    },
    Maintain {
        now: u64,
    },
}
Expand description

One decoded engine operation (op table). Revise is Remember with revises set — the two share a payload, only the op byte differs.

Not Eq: the raw f32 vector rides along so replay can re-quantize it deterministically, and f32 is only PartialEq.

Variants§

§

Remember

Op 1/2: a new fact (op 2 additionally closes revises).

Fields

§now: u64

Host timestamp of the operation.

§valid_from: u64

Resolved validity start (the engine defaults it before journaling — replay never re-derives).

§entity: Option<&'a str>

Subject entity name, if any.

§text: &'a str

Fact text.

§tags: Vec<&'a str>

Tags, verbatim.

§links: Vec<(&'a str, &'a str)>

(rel, target_entity) link pairs.

§vector: Vec<f32>

The raw embedding as remembered (empty = none). Stored pre-quantization so replay re-quantizes with the same pure function and reproduces every slot byte for byte.

§metadata: Vec<(&'a str, &'a str)>

Metadata key→value pairs as remembered (empty = none). Replay re-canonicalizes them (sorts, dedups) the same way remember did, so the stored blob is reproduced byte for byte.

§revises: FactId

Predecessor being revised (crate::id::FactId::NONE for op 1).

§assigned: FactId

The fact id assigned at execution time — authoritative on replay.

§

Forget

Op 3: tombstone a fact.

Fields

§now: u64

Host timestamp of the operation.

§fact: FactId

The fact being forgotten.

Op 4: upsert a typed edge between two entities.

Fields

§now: u64

Host timestamp of the operation.

§src: &'a str

Source entity name.

§rel: &'a str

Relation term, verbatim.

§dst: &'a str

Destination entity name.

§provenance: FactId

Provenance fact, or crate::id::FactId::NONE.

§

Maintain

Op 5: marker that a maintenance pass ran at this point.

Fields

§now: u64

Host timestamp of the operation.

Implementations§

Source§

impl<'a> Op<'a>

Source

pub fn encode(&self, out: &mut Vec<u8>)

Encodes the operation as one framed journal entry appended to out (via encode_entry).

Source

pub fn decode(op: u8, payload: &'a [u8]) -> Result<Op<'a>, Error>

Decodes one operation from a scanned entry. The payload is untrusted (the checksum guards transport integrity, not origin): every read is bounds-checked, malformed input is Error::Corrupt, never a panic.

Trait Implementations§

Source§

impl<'a> Clone for Op<'a>

Source§

fn clone(&self) -> Op<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Op<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for Op<'a>

Source§

fn eq(&self, other: &Op<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for Op<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Op<'a>

§

impl<'a> RefUnwindSafe for Op<'a>

§

impl<'a> Send for Op<'a>

§

impl<'a> Sync for Op<'a>

§

impl<'a> Unpin for Op<'a>

§

impl<'a> UnsafeUnpin for Op<'a>

§

impl<'a> UnwindSafe for Op<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.