pub struct RecordId { /* private fields */ }Expand description
A RecordId is a (table, id) pair that uniquely identifies a record
across SochDB’s multi-model storage.
It replaces the previous string-based node_id / from_id / to_id pattern
used in the graph overlay, providing:
- Type-safe table scoping
- Compact binary keys for storage
- Sort-ordered prefix scans per table
Implementations§
Source§impl RecordId
impl RecordId
Sourcepub fn new(table: impl Into<String>, id: u64) -> Self
pub fn new(table: impl Into<String>, id: u64) -> Self
Create a RecordId with an integer identifier.
Sourcepub fn from_string(table: impl Into<String>, id: impl Into<String>) -> Self
pub fn from_string(table: impl Into<String>, id: impl Into<String>) -> Self
Create a RecordId with a string identifier.
Sourcepub fn with_id(table: impl Into<String>, id: IdValue) -> Self
pub fn with_id(table: impl Into<String>, id: IdValue) -> Self
Create a RecordId from an IdValue.
Sourcepub fn to_key(&self) -> Vec<u8> ⓘ
pub fn to_key(&self) -> Vec<u8> ⓘ
Encode to a binary storage key.
Format: [table_id: u32 BE][tag: u8][id_bytes]
The table_id is a FNV-1a hash, ensuring records of the same table cluster together in lexicographic key order.
Sourcepub fn from_key(key: &[u8]) -> Option<Self>
pub fn from_key(key: &[u8]) -> Option<Self>
Decode from a binary storage key.
Note: The table name is NOT recoverable from the key alone (only the hash is stored).
Use from_key_with_table if you know the table name, or from_key for a lossy decode.
Sourcepub fn from_key_with_table(key: &[u8], table: &str) -> Option<Self>
pub fn from_key_with_table(key: &[u8], table: &str) -> Option<Self>
Decode from a binary key when the table name is known.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RecordId
impl<'de> Deserialize<'de> for RecordId
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for RecordId
Source§impl Ord for RecordId
impl Ord for RecordId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RecordId
impl PartialOrd for RecordId
impl StructuralPartialEq for RecordId
Auto Trait Implementations§
impl Freeze for RecordId
impl RefUnwindSafe for RecordId
impl Send for RecordId
impl Sync for RecordId
impl Unpin for RecordId
impl UnsafeUnpin for RecordId
impl UnwindSafe for RecordId
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.