pub struct FactRecord {
pub id: FactId,
pub entity: EntityId,
pub flags: u16,
pub kind: u16,
pub text: BlobId,
pub vector: u32,
pub revises: FactId,
pub recorded_at: u64,
pub valid_from: u64,
pub valid_to: u64,
}Expand description
The unit of memory: one fact (48-byte slot, Uniform arena).
| off | size | field |
|---|---|---|
| 0 | 4 | id (key) |
| 4 | 4 | entity |
| 8 | 2 | flags |
| 10 | 2 | kind (reserved, 0 in v1) |
| 12 | 4 | text |
| 16 | 4 | vector |
| 20 | 4 | revises |
| 24 | 8 | recorded_at |
| 32 | 8 | valid_from |
| 40 | 8 | valid_to |
Fields§
§id: FactIdFact id — the key.
entity: EntityIdSubject entity, or EntityId::NONE.
flags: u16Bit set from fact_flags.
kind: u16Reserved in v1; must be 0 (fact typing is a tag convention).
text: BlobIdFact text (UTF-8) in the blob heap.
vector: u32Slot index in the vector arena, or NONE_U32; meaningful only
with fact_flags::HAS_VECTOR.
revises: FactIdPredecessor in the revision chain, or FactId::NONE. May name a
burned id — a predecessor that was forgotten and physically
purged by maintain; resolving it then yields None, the same
answer a tombstoned record gives.
recorded_at: u64Knowledge axis: when the memory learned this. Immutable.
valid_from: u64Truth axis: start of the validity interval.
valid_to: u64Truth axis: end of the validity interval; VALID_TO_OPEN = open.
Implementations§
Source§impl FactRecord
impl FactRecord
Sourcepub fn is_tombstone(&self) -> bool
pub fn is_tombstone(&self) -> bool
true when the tombstone flag is set.
Sourcepub fn has_vector(&self) -> bool
pub fn has_vector(&self) -> bool
true when a vector slot is attached.
Sourcepub fn is_live_at(&self, t: u64) -> bool
pub fn is_live_at(&self, t: u64) -> bool
The as_of(t) liveness rule: not a tombstone, already
recorded at t, and t inside [valid_from, valid_to).
Trait Implementations§
Source§impl Clone for FactRecord
impl Clone for FactRecord
Source§fn clone(&self) -> FactRecord
fn clone(&self) -> FactRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FactRecord
Source§impl Debug for FactRecord
impl Debug for FactRecord
impl Eq for FactRecord
Source§impl PartialEq for FactRecord
impl PartialEq for FactRecord
Source§impl Slot for FactRecord
impl Slot for FactRecord
Source§const KEY_LEN: usize = 4
const KEY_LEN: usize = 4
SIZE.Source§fn write(&self, out: &mut [u8])
fn write(&self, out: &mut [u8])
out (out.len() == SIZE), filling every
byte.Source§fn read(bytes: &[u8]) -> FactRecord
fn read(bytes: &[u8]) -> FactRecord
bytes (bytes.len() == SIZE).