pub struct Entity {
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 canonicalize_system_collection_names(&mut self)
pub fn canonicalize_system_collection_names(&mut self)
Normalize persisted runtime-owned collection identities while retaining exact user collection names. This is idempotent and intentionally does not rewrite graph labels, which are data rather than collection keys.
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.
pub fn branch_version(&self) -> Option<&BranchVersion>
pub fn set_branch_origin(&mut self, epoch: u64)
pub fn clear_branch_version(&mut self)
pub fn branch_xmax(&self, epoch: u64) -> u64
Sourcepub fn set_branch_xmax(&mut self, epoch: u64, xid: u64)
pub fn set_branch_xmax(&mut self, epoch: u64, xid: u64)
The caller holds the publication fence and starts from the current stored entity, so another branch’s deletion cannot be lost on replace.
pub fn retain_branch_deletions(&mut self, keep: impl FnMut(u64) -> bool)
pub fn max_transaction_id(&self) -> u64
Sourcepub fn logical_id(&self) -> EntityId
pub fn logical_id(&self) -> EntityId
Stable user-visible identity. Legacy rows without an explicit logical id map to their physical entity id.
Sourcepub fn has_explicit_logical_id(&self) -> bool
pub fn has_explicit_logical_id(&self) -> bool
Returns true when the entity carries an explicit logical id on disk.
Sourcepub fn set_logical_id(&mut self, logical_id: EntityId)
pub fn set_logical_id(&mut self, logical_id: EntityId)
Set the stable user-visible identity for this physical version.
Sourcepub fn ensure_table_logical_id(&mut self)
pub fn ensure_table_logical_id(&mut self)
Ensure entities written by the current engine carry explicit
logical identity. Table rows + documents (Phase 1/2) and graph
nodes/edges (Phase 3) participate in the multi-model MVCC
versioning rollout and so need a stable logical id for
version-chain selection. Stamping the logical id is inert for
non-versioned collections: history only accrues through
install_versioned_table_row_update, which is gated on the
collection versioned flag, so a stamped-but-never-superseded
entity keeps logical_id == id and behaves exactly as before.
Vectors are intentionally excluded pending their read-path follow
up (no snapshot-honoring VECTOR SEARCH).
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 Forget for UnifiedEntity
impl Freeze for UnifiedEntitywhere
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const GraphNodeKind is !null: Freeze,
PhantomData<GraphNodeKind>: Freeze,
*const GraphEdgeKind is !null: Freeze,
PhantomData<GraphEdgeKind>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const TimeSeriesPointKind is !null: Freeze,
PhantomData<TimeSeriesPointKind>: Freeze,
PhantomData<Value>: Freeze,
PhantomData<(String, Value)>: Freeze,
*const ArcInner<Vec<String>> is !null: Freeze,
PhantomData<ArcInner<Vec<String>>>: Freeze,
PhantomData<f32>: Freeze,
PhantomData<u32>: Freeze,
PhantomData<(String, String)>: Freeze,
*const ArcInner<CronSchedule> is !null: Freeze,
PhantomData<ArcInner<CronSchedule>>: Freeze,
*const EntityAux is !null: Freeze,
PhantomData<EntityAux>: Freeze,
impl Move for UnifiedEntity
impl RefUnwindSafe for UnifiedEntity
impl Send for UnifiedEntity
impl Sync for UnifiedEntity
impl Unpin for UnifiedEntity
impl UnsafeUnpin for UnifiedEntitywhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const GraphNodeKind is !null: UnsafeUnpin,
PhantomData<GraphNodeKind>: UnsafeUnpin,
*const GraphEdgeKind is !null: UnsafeUnpin,
PhantomData<GraphEdgeKind>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const TimeSeriesPointKind is !null: UnsafeUnpin,
PhantomData<TimeSeriesPointKind>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
PhantomData<(String, Value)>: UnsafeUnpin,
*const ArcInner<Vec<String>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<String>>>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
*const ArcInner<CronSchedule> is !null: UnsafeUnpin,
PhantomData<ArcInner<CronSchedule>>: UnsafeUnpin,
*const EntityAux is !null: UnsafeUnpin,
PhantomData<EntityAux>: UnsafeUnpin,
impl UnwindSafe for UnifiedEntitywhere
Arc<str>: UnwindSafe,
BoxRaw<GraphNodeKind>: UnwindSafe,
BoxRaw<GraphEdgeKind>: UnwindSafe,
RawVecInner: UnwindSafe,
BoxRaw<TimeSeriesPointKind>: UnwindSafe,
Arc<CronSchedule>: UnwindSafe,
HashMap<String, Value>: UnwindSafe,
Arc<Vec<String>>: UnwindSafe,
HashMap<String, String>: UnwindSafe,
BoxRaw<EntityAux>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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