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

Method with_capacity

atomic-core/src/record/workflow/globalize/context.rs:129–142  ·  view source on GitHub ↗

Create a context with pre-allocated content buffer. # Arguments `txn` - Transaction for graph lookups `capacity` - Initial capacity for content buffer # Example ```rust,ignore let ctx = GlobalizeContext::with_capacity(&txn, 1024 * 1024); ```

(txn: &'txn T, capacity: usize)

Source from the content-addressed store, hash-verified

127 /// let ctx = GlobalizeContext::with_capacity(&txn, 1024 * 1024);
128 /// ```
129 pub fn with_capacity(txn: &'txn T, capacity: usize) -> Self {
130 Self {
131 txn,
132 content: Vec::with_capacity(capacity),
133 content_position: 0,
134 dependencies: HashSet::new(),
135 inode_cache: std::collections::HashMap::new(),
136 position_cache: std::collections::HashMap::new(),
137 content_vertices_cache: std::collections::HashMap::new(),
138 directory_anchors: std::collections::HashMap::new(),
139 vacated_bindings: std::collections::HashMap::new(),
140 projected_paths: std::collections::HashMap::new(),
141 }
142 }
143
144 /// Register a binding removed by the same atomic change. A new parent
145 /// directory at that path must receive a distinct graph identity.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected