pub struct LockfileGraph {
pub version: u32,
pub root_id: NodeId,
pub nodes: Vec<InputNode>,
pub canonical_hash: CanonicalGraphHash,
}Expand description
The lockfile graph proper.
Fields§
§version: u32Always 7 today (cppnix flake-lock major). Bumping requires
migration logic in from_flake_lock.
root_id: NodeIdAlways 0 by construction (root interned first).
nodes: Vec<InputNode>Dense node table; nodes[id as usize] is the node with that id.
canonical_hash: CanonicalGraphHashBLAKE3 of the rkyv archive bytes of this graph. Populated by
LockfileGraph::archive_and_hash; zeroed on the freshly built
graph (you can’t BLAKE3 yourself before you exist).
Implementations§
Source§impl LockfileGraph
impl LockfileGraph
Sourcepub fn from_flake_lock(lock: &FlakeLock) -> Result<Self, LockfileGraphError>
pub fn from_flake_lock(lock: &FlakeLock) -> Result<Self, LockfileGraphError>
Build a follows-resolved typed graph from an upstream
FlakeLock (the JSON-parser-output type that already lives in
sui-compat). All follows chains are chased here so the
resulting graph’s edges are pure (name, NodeId) pairs — no
runtime resolution.
§Determinism
Node ids are assigned by deterministic BFS from root: root = 0,
then root’s inputs in sorted attr name order, then their
inputs, breadth-first. This gives a canonical id assignment
independent of upstream BTreeMap iteration order
(which is already sorted, but we don’t want to depend on that).
§Errors
LockfileGraphError::UnsupportedVersioniflock.version != 7LockfileGraphError::UnresolvableFollowsif a follows path walks off the graph (corrupt upstream).
Sourcepub fn archive_and_hash(self) -> Result<(Self, Vec<u8>), LockfileGraphError>
pub fn archive_and_hash(self) -> Result<(Self, Vec<u8>), LockfileGraphError>
Serialize via rkyv and stamp canonical_hash with the BLAKE3 of
the resulting bytes. Returns the archive bytes ready for
sui_graph_store::GraphStore::put.
The two-pass shape (build → hash → re-archive with the hash stamped in) is unavoidable: the hash is part of the archive, so it can’t be computed before the archive exists. We pay a second archive pass once per graph; the warm path mmaps the result.
§Errors
LockfileGraphError::Archive if rkyv refuses the graph shape
(should be impossible by construction — every field is Archive).
Trait Implementations§
Source§impl Archive for LockfileGraph
impl Archive for LockfileGraph
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§type Archived = ArchivedLockfileGraph
type Archived = ArchivedLockfileGraph
Source§type Resolver = LockfileGraphResolver
type Resolver = LockfileGraphResolver
Source§impl Clone for LockfileGraph
impl Clone for LockfileGraph
Source§fn clone(&self) -> LockfileGraph
fn clone(&self) -> LockfileGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LockfileGraph
impl Debug for LockfileGraph
Source§impl<'de> Deserialize<'de> for LockfileGraph
impl<'de> Deserialize<'de> for LockfileGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<__D: Fallible + ?Sized> Deserialize<LockfileGraph, __D> for Archived<LockfileGraph>where
u32: Archive,
<u32 as Archive>::Archived: Deserialize<u32, __D>,
NodeId: Archive,
<NodeId as Archive>::Archived: Deserialize<NodeId, __D>,
Vec<InputNode>: Archive,
<Vec<InputNode> as Archive>::Archived: Deserialize<Vec<InputNode>, __D>,
CanonicalGraphHash: Archive,
<CanonicalGraphHash as Archive>::Archived: Deserialize<CanonicalGraphHash, __D>,
impl<__D: Fallible + ?Sized> Deserialize<LockfileGraph, __D> for Archived<LockfileGraph>where
u32: Archive,
<u32 as Archive>::Archived: Deserialize<u32, __D>,
NodeId: Archive,
<NodeId as Archive>::Archived: Deserialize<NodeId, __D>,
Vec<InputNode>: Archive,
<Vec<InputNode> as Archive>::Archived: Deserialize<Vec<InputNode>, __D>,
CanonicalGraphHash: Archive,
<CanonicalGraphHash as Archive>::Archived: Deserialize<CanonicalGraphHash, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<LockfileGraph, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<LockfileGraph, <__D as Fallible>::Error>
impl Eq for LockfileGraph
Source§impl PartialEq for LockfileGraph
impl PartialEq for LockfileGraph
Source§fn eq(&self, other: &LockfileGraph) -> bool
fn eq(&self, other: &LockfileGraph) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for LockfileGraph
impl Serialize for LockfileGraph
impl StructuralPartialEq for LockfileGraph
Source§impl TataraDomain for LockfileGraph
impl TataraDomain for LockfileGraph
Source§fn compile_from_args(args: &[Sexp]) -> Result<Self>
fn compile_from_args(args: &[Sexp]) -> Result<Self>
Auto Trait Implementations§
impl Freeze for LockfileGraph
impl RefUnwindSafe for LockfileGraph
impl Send for LockfileGraph
impl Sync for LockfileGraph
impl Unpin for LockfileGraph
impl UnsafeUnpin for LockfileGraph
impl UnwindSafe for LockfileGraph
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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,
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<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.