Skip to main content

UnifiedEntity

Struct UnifiedEntity 

Source
pub struct UnifiedEntity {
    pub id: EntityId,
    pub kind: EntityKind,
    pub created_at: u64,
    pub updated_at: u64,
    pub data: EntityData,
    pub sequence_id: u64,
    pub field_bloom: u64,
    pub xmin: u64,
    pub xmax: u64,
    /* private fields */
}
Expand description

A unified entity that can represent any storage type

Fields§

§id: EntityId

Unique entity identifier

§kind: EntityKind

What kind of entity this is

§created_at: u64

Creation timestamp

§updated_at: u64

Last update timestamp

§data: EntityData

The actual data content

§sequence_id: u64

Sequence ID for ordering/versioning

§field_bloom: u64

Field-name bloom filter (u64, zero-allocation).

Each bit encodes one possible mid-character value: for field name n the bit position is n.as_bytes()[n.len()/2] & 63. OR of all user field names present in this entity. Cleared for schema-based bulk rows (all rows share the same schema so bloom is segment-level).

The compiled filter computes required_bloom from predicate field names at compile time. If entity.field_bloom & required_bloom != required_bloom, the entity cannot match and is skipped before any HashMap probe.

§xmin: u64

MVCC creation transaction ID (Phase 2.3 PG parity).

0 means “pre-MVCC” / auto-commit — visible to every snapshot. When a BEGIN-wrapped INSERT runs, it stamps xmin with the transaction’s snapshot id so other concurrent transactions only see the row after the writer commits (snapshot isolation semantics).

Visibility rule: xmin <= snapshot.xid && (xmax == 0 || xmax > snapshot.xid).

§xmax: u64

MVCC deletion transaction ID (Phase 2.3 PG parity).

0 means “live”. Set to the deleting transaction’s snapshot id on DELETE/UPDATE (row is kept until VACUUM reclaims it). Snapshots with xid < xmax still see the row; newer snapshots skip it.

Implementations§

Source§

impl UnifiedEntity

Source

pub fn embeddings(&self) -> &[EmbeddingSlot]

Access embeddings (returns empty slice if no aux data).

Source

pub fn cross_refs(&self) -> &[CrossRef]

Access cross-references (returns empty slice if no aux data).

Source

pub fn embeddings_mut(&mut self) -> &mut Vec<EmbeddingSlot>

Get mutable embeddings (allocates aux if needed).

Source

pub fn cross_refs_mut(&mut self) -> &mut Vec<CrossRef>

Get mutable cross-refs (allocates aux if needed).

Source

pub fn has_aux(&self) -> bool

Check if entity has any auxiliary data.

Source§

impl UnifiedEntity

Source

pub fn new(id: EntityId, kind: EntityKind, data: EntityData) -> Self

Create a new unified entity

Source

pub fn is_visible(&self, snapshot_xid: u64) -> bool

MVCC visibility check (Phase 2.3 PG parity).

Returns true when this tuple is visible under the provided snapshot xid. Pre-MVCC rows (xmin == 0, xmax == 0) are visible to every snapshot — preserves full compatibility with existing data inserted before the MVCC headers existed.

Snapshot isolation rule:

  • xmin == 0 || xmin <= snapshot_xid (creator committed before snapshot)
  • xmax == 0 || xmax > snapshot_xid (deleter committed after snapshot)
Source

pub fn set_xmin(&mut self, xid: u64)

Stamp xmin (creation transaction ID). Called by the runtime on INSERT inside an active transaction.

Source

pub fn set_xmax(&mut self, xid: u64)

Stamp xmax (deletion transaction ID). Called by the runtime on DELETE/UPDATE inside an active transaction — the tuple survives until VACUUM reclaims it.

Source

pub fn table_row( id: EntityId, table: impl Into<Arc<str>>, row_id: u64, columns: Vec<Value>, ) -> Self

Create a table row entity

Source

pub fn graph_node( id: EntityId, label: impl Into<String>, node_type: impl Into<String>, properties: HashMap<String, Value>, ) -> Self

Create a graph node entity

Source

pub fn graph_edge( id: EntityId, label: impl Into<String>, from: impl Into<String>, to: impl Into<String>, weight: f32, properties: HashMap<String, Value>, ) -> Self

Create a graph edge entity

Source

pub fn vector( id: EntityId, collection: impl Into<String>, vector: Vec<f32>, ) -> Self

Create a vector entity

Source

pub fn add_embedding(&mut self, slot: EmbeddingSlot)

Add an embedding to this entity

Source

pub fn add_cross_ref(&mut self, cross_ref: CrossRef)

Add a cross-reference

Source

pub fn get_embedding(&self, name: &str) -> Option<&EmbeddingSlot>

Get embedding by slot name

Source

pub fn is_stale(&self, max_age_secs: u64) -> bool

Check if entity is stale (not updated in given seconds)

Source§

impl UnifiedEntity

Source

pub fn from_properties( id: EntityId, label: impl Into<String>, node_type: impl Into<String>, properties: impl IntoIterator<Item = (impl Into<String>, Value)>, ) -> Self

Create a graph node entity from properties map

Source

pub fn into_row(self) -> Option<RowData>

Convert entity to row data if applicable

Source

pub fn into_node(self) -> Option<NodeData>

Convert entity to node data if applicable

Source

pub fn into_edge(self) -> Option<EdgeData>

Convert entity to edge data if applicable

Source

pub fn into_vector(self) -> Option<VectorData>

Convert entity to vector data if applicable

Trait Implementations§

Source§

impl Clone for UnifiedEntity

Source§

fn clone(&self) -> UnifiedEntity

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 Debug for UnifiedEntity

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more