MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_new_vertex

Function write_new_vertex

atomic-core/src/apply/insertion.rs:88–110  ·  view source on GitHub ↗

Apply a Insertion atom to the graph. Creates a new span and connects it to the graph via context edges. This is how new content is inserted into files. # Arguments `txn` - Write transaction for graph modifications `workspace` - Workspace for tracking state and conflicts `change_id` - Internal ID of the change being applied `insertion` - The Insertion specification `change` - The full change for

(
    txn: &mut CachedWriteGraphTxn<'_, '_>,
    workspace: &mut Workspace,
    change_id: NodeId,
    insertion: &Insertion<Option<Hash>>,
    change: &Change,
    detect_conflicts: bool,
)

Source from the content-addressed store, hash-verified

86/// - `BlockNotFound`: Context position not found
87/// - `Internal`: Database error
88pub fn write_new_vertex(
89 txn: &mut CachedWriteGraphTxn<'_, '_>,
90 workspace: &mut Workspace,
91 change_id: NodeId,
92 insertion: &Insertion<Option<Hash>>,
93 change: &Change,
94 detect_conflicts: bool,
95) -> Result<(), LocalApplyError> {
96 if !change.causal_frontier().is_empty() {
97 return Err(LocalApplyError::CausalFrontierInvalid {
98 reason: "frontier-bearing insertion requires a verified closure".to_string(),
99 });
100 }
101 write_new_vertex_with_frontier(
102 txn,
103 workspace,
104 change_id,
105 insertion,
106 change,
107 &VerifiedCausalFrontier::empty(),
108 detect_conflicts,
109 )
110}
111
112/// Write a new vertex using repository-verified causal knowledge.
113pub fn write_new_vertex_with_frontier(

Callers

nothing calls this directly

Calls 3

causal_frontierMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected