Add graph-storage crate (#4198)

* Add graph-storage crate

* Split graph-storage lib.rs into smaller modules

* Make graph_craft/core_types dependency optional

* Fix CRDT correctness issues flagged in graph-storage PR review

* Treat trailing empty export slots as value-equal in Network::value_equal

* Address graph-storage review: parameterize CrdtError, reject hot-log corruption, drop LamportClock Default

* Address graph-storage review: fix root-delta history walk, validate cross-network refs, make compute_deltas deterministic, harden Priority, index nodes by network

* Address graph-storage review: sort sources on deserialize, treat inputs_attributes length as structural, dedupe demo-artwork loader

* Add opt-in Delta rev validation, dedup resource sources on deserialize, fix doc grammar

* Persist scope injections through storage; harden gesture-end and embedded-source checks

* Review

* Review

* Review

* Use new types for NodeId and NetworkId

* Adress minor review comments

---------

Co-authored-by: Timon <me@timon.zip>
This commit is contained in:
Dennis Kobert
2026-06-13 18:47:04 +02:00
committed by GitHub
parent cde8dd78e6
commit b56af15e5e
20 changed files with 5261 additions and 0 deletions

View File

@@ -246,6 +246,16 @@ impl ResourceId {
pub fn new() -> Self {
Self(core_types::uuid::generate_uuid())
}
/// Derive a deterministic ID from a content hash (first 8 bytes, little-endian). Used when
/// bootstrapping resources from an existing document so re-conversion is stable and identical
/// content maps to one ID. New resources created live should use [`ResourceId::new`] instead.
pub fn from_hash(hash: &ResourceHash) -> Self {
let bytes: [u8; 32] = hash.into();
let mut truncated = [0u8; 8];
truncated.copy_from_slice(&bytes[..8]);
Self(u64::from_le_bytes(truncated))
}
}
impl From<u64> for ResourceId {