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: EntityIdUnique entity identifier
kind: EntityKindWhat kind of entity this is
created_at: u64Creation timestamp
updated_at: u64Last update timestamp
data: EntityDataThe actual data content
sequence_id: u64Sequence ID for ordering/versioning
field_bloom: u64Field-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: u64MVCC 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: u64MVCC 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
impl UnifiedEntity
Sourcepub fn embeddings(&self) -> &[EmbeddingSlot]
pub fn embeddings(&self) -> &[EmbeddingSlot]
Access embeddings (returns empty slice if no aux data).
Sourcepub fn cross_refs(&self) -> &[CrossRef]
pub fn cross_refs(&self) -> &[CrossRef]
Access cross-references (returns empty slice if no aux data).
Sourcepub fn embeddings_mut(&mut self) -> &mut Vec<EmbeddingSlot>
pub fn embeddings_mut(&mut self) -> &mut Vec<EmbeddingSlot>
Get mutable embeddings (allocates aux if needed).
Sourcepub fn cross_refs_mut(&mut self) -> &mut Vec<CrossRef>
pub fn cross_refs_mut(&mut self) -> &mut Vec<CrossRef>
Get mutable cross-refs (allocates aux if needed).
Source§impl UnifiedEntity
impl UnifiedEntity
Sourcepub fn new(id: EntityId, kind: EntityKind, data: EntityData) -> UnifiedEntity
pub fn new(id: EntityId, kind: EntityKind, data: EntityData) -> UnifiedEntity
Create a new unified entity
Sourcepub fn is_visible(&self, snapshot_xid: u64) -> bool
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)
Sourcepub fn set_xmin(&mut self, xid: u64)
pub fn set_xmin(&mut self, xid: u64)
Stamp xmin (creation transaction ID). Called by the runtime on
INSERT inside an active transaction.
Sourcepub fn set_xmax(&mut self, xid: u64)
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.
Sourcepub fn table_row(
id: EntityId,
table: impl Into<Arc<str>>,
row_id: u64,
columns: Vec<Value>,
) -> UnifiedEntity
pub fn table_row( id: EntityId, table: impl Into<Arc<str>>, row_id: u64, columns: Vec<Value>, ) -> UnifiedEntity
Create a table row entity
Sourcepub fn graph_node(
id: EntityId,
label: impl Into<String>,
node_type: impl Into<String>,
properties: HashMap<String, Value>,
) -> UnifiedEntity
pub fn graph_node( id: EntityId, label: impl Into<String>, node_type: impl Into<String>, properties: HashMap<String, Value>, ) -> UnifiedEntity
Create a graph node entity
Sourcepub fn graph_edge(
id: EntityId,
label: impl Into<String>,
from: impl Into<String>,
to: impl Into<String>,
weight: f32,
properties: HashMap<String, Value>,
) -> UnifiedEntity
pub fn graph_edge( id: EntityId, label: impl Into<String>, from: impl Into<String>, to: impl Into<String>, weight: f32, properties: HashMap<String, Value>, ) -> UnifiedEntity
Create a graph edge entity
Sourcepub fn vector(
id: EntityId,
collection: impl Into<String>,
vector: Vec<f32>,
) -> UnifiedEntity
pub fn vector( id: EntityId, collection: impl Into<String>, vector: Vec<f32>, ) -> UnifiedEntity
Create a vector entity
Sourcepub fn add_embedding(&mut self, slot: EmbeddingSlot)
pub fn add_embedding(&mut self, slot: EmbeddingSlot)
Add an embedding to this entity
Sourcepub fn add_cross_ref(&mut self, cross_ref: CrossRef)
pub fn add_cross_ref(&mut self, cross_ref: CrossRef)
Add a cross-reference
Sourcepub fn get_embedding(&self, name: &str) -> Option<&EmbeddingSlot>
pub fn get_embedding(&self, name: &str) -> Option<&EmbeddingSlot>
Get embedding by slot name
Source§impl UnifiedEntity
impl UnifiedEntity
Sourcepub fn from_properties(
id: EntityId,
label: impl Into<String>,
node_type: impl Into<String>,
properties: impl IntoIterator<Item = (impl Into<String>, Value)>,
) -> UnifiedEntity
pub fn from_properties( id: EntityId, label: impl Into<String>, node_type: impl Into<String>, properties: impl IntoIterator<Item = (impl Into<String>, Value)>, ) -> UnifiedEntity
Create a graph node entity from properties map
Sourcepub fn into_vector(self) -> Option<VectorData>
pub fn into_vector(self) -> Option<VectorData>
Convert entity to vector data if applicable
Trait Implementations§
Source§impl Clone for UnifiedEntity
impl Clone for UnifiedEntity
Source§fn clone(&self) -> UnifiedEntity
fn clone(&self) -> UnifiedEntity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UnifiedEntity
impl RefUnwindSafe for UnifiedEntity
impl Send for UnifiedEntity
impl Sync for UnifiedEntity
impl Unpin for UnifiedEntity
impl UnsafeUnpin for UnifiedEntity
impl UnwindSafe for UnifiedEntity
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request