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

Method create_trunk

atomic-core/src/crdt/apply/traits.rs:379–389  ·  view source on GitHub ↗

Creates a new trunk (file). Allocates an inode and stores the trunk. # Arguments `id` - The trunk ID `path` - The file path `encoding` - Optional text encoding

(
        &mut self,
        id: TrunkId,
        path: &str,
        encoding: Option<Encoding>,
    )

Source from the content-addressed store, hash-verified

377 /// * `path` - The file path
378 /// * `encoding` - Optional text encoding
379 fn create_trunk(
380 &mut self,
381 id: TrunkId,
382 path: &str,
383 encoding: Option<Encoding>,
384 ) -> Result<Trunk, Self::Error> {
385 let inode = self.alloc_inode()?;
386 let trunk = Trunk::new(id, inode, path.to_string(), encoding);
387 self.put_trunk(&trunk)?;
388 Ok(trunk)
389 }
390
391 /// Marks a trunk as deleted.
392 ///

Callers 3

test_create_trunkFunction · 0.80
test_mark_trunk_deletedFunction · 0.80
test_mark_trunk_aliveFunction · 0.80

Implementers 1

traits.rsatomic-core/src/crdt/apply/traits.rs

Calls 2

alloc_inodeMethod · 0.45
put_trunkMethod · 0.45

Tested by 3

test_create_trunkFunction · 0.64
test_mark_trunk_deletedFunction · 0.64
test_mark_trunk_aliveFunction · 0.64