Skip to content
GraphMutationEpoch

GraphMutationEpoch

Description

Structural-mutation counter. Bumped by node/edge insertions, deletions, and commits; traversal helpers snapshot it to detect concurrent mutation.

Parameters

Name Direction Description
g in Graph to query.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        size old_capacity = VecCapacity(&graph.slots);
        u64  old_epoch    = GraphMutationEpoch(&graph);
    
        bool grew = GraphReserve(&graph, 1024);
        bool result = grew;
        result      = result && (VecCapacity(&graph.slots) > old_capacity);
        result      = result && (GraphMutationEpoch(&graph) > old_epoch);
    
        GraphDeinit(&graph);
        (void)GraphCommitChanges(&graph);
    
        u64         old_epoch = GraphMutationEpoch(&graph);
        GraphNodeId reused    = GraphAddNodeR(&graph, 99);
    
        bool result = (GraphNodeIdIndex(reused) == GraphNodeIdIndex(b));
        result      = result && (GraphMutationEpoch(&graph) > old_epoch);
    
        GraphDeinit(&graph);
                      VecBegin(&graph.pending_edge_removals) == NULL && GraphCopyInit(&graph) == NULL &&
                      GraphCopyDeinit(&graph) == NULL && graph.pending_delete_count == 0 &&
                      GraphMutationEpoch(&graph) == 0 && GraphAllocator(&graph)->alignment == 1;
    
        GraphDeinit(&graph);
Last updated on