Skip to main content

ContentAddressedMount

Struct ContentAddressedMount 

Source
pub struct ContentAddressedMount { /* private fields */ }
Expand description

In-mount overlay: a snapshot-time view of the parent state plus pending writes the agent has issued since.

Writes never modify the immutable state; they accumulate in [Pending] until ContentAddressedMount::capture folds them into a fresh state.

Implementations§

Source§

impl ContentAddressedMount

Source

pub fn new(repo: Repository, thread: impl Into<String>) -> Result<Self>

Open a writable mount of thread against repo.

Resolves the thread once, up front, so every subsequent lookup/read walks from a fixed snapshot. Writes accumulate in the pending tier until Self::capture folds them into a new state. To advance to a newer state, call Self::refresh.

Source

pub fn with_promotion_policy(self, policy: PromotionPolicy) -> Self

Override the promotion policy. Re-spawns (or terminates) the safety-sweep worker to honour the new sweep_interval. Mostly useful for tests that want a tight idle window or to disable idle-promotion entirely.

Source

pub fn refresh(&self) -> Result<()>

Re-resolve the thread and adopt the new state. Existing inodes are not invalidated — callers who want a clean slate should drop the mount and recreate.

Source

pub fn thread(&self) -> &str

The thread name this mount serves.

Source

pub fn current_change_id(&self) -> ChangeId

The change id this mount currently points at.

Source

pub fn lookup_path(&self, path: impl AsRef<Path>) -> Result<NodeId>

Resolve a mount-relative path to a NodeId. Used by tests that don’t go through lookup step-by-step.

Source

pub fn flush_node(&self, node: NodeId) -> Result<()>

Promote the hot buffer for node (if any) to a CAS blob and record it in the pending tree.

Mark path as deleted in the pending tier. Subsequent lookup/enumerate calls will skip the underlying captured entry, and capture() will fold the deletion into the new state’s tree (pruning empty parent dirs as needed).

Source

pub fn flush_all(&self) -> Result<()>

Flush all hot buffers to CAS. Useful at the start of capture or when tests want a deterministic warm state.

Source§

impl ContentAddressedMount

Source

pub fn capture(&self, intent: impl Into<Option<String>>) -> Result<ChangeId>

Drain the pending tier into a fresh heddle state and update the thread to point at it.

This is the mount-side analogue of heddle capture/heddle snapshot: rather than walking a worktree to discover changed files, it folds the in-memory pending map into a real Tree object, records a State, and advances the thread’s HEAD ref.

intent is propagated to state.intent. Attribution is pulled from the repository’s default attribution path (Repository::get_attribution) — this honours the HEDDLE_AGENT_* env, the repo config, and the user’s principal. Richer attribution paths (CLI overrides, AgentRegistry, session segments) live in crates/cli/src/cli/commands/snapshot.rs::build_attribution; when the CLI wires this up it should call Self::capture_with_attribution instead and pass the result of that helper.

Source

pub fn capture_with_attribution( &self, intent: impl Into<Option<String>>, attribution: Attribution, ) -> Result<ChangeId>

Same as Self::capture but with caller-supplied attribution. The CLI uses this so it can mirror build_attribution from snapshot.rs (CLI overrides, agent registry lookup, etc.).

Trait Implementations§

Source§

impl Drop for ContentAddressedMount

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl PlatformShell for ContentAddressedMount

Source§

fn lookup(&self, parent: NodeId, name: &OsStr) -> Result<Option<Entry>>

Look up name inside parent. Returns None for ENOENT.
Source§

fn read(&self, node: NodeId, offset: u64, buf: &mut [u8]) -> Result<usize>

Read up to buf.len() bytes from node, starting at offset. Returns the number of bytes actually written into buf.
Source§

fn write(&self, node: NodeId, offset: u64, data: &[u8]) -> Result<usize>

Write data to node at offset. Returns bytes written.
Source§

fn enumerate(&self, dir: NodeId) -> Result<Vec<Entry>>

List the children of dir.
Source§

fn attrs(&self, node: NodeId) -> Result<Attrs>

Stat node.
Source§

fn invalidate(&self, node: NodeId) -> Result<()>

Drop any cached identity for node. The platform layer calls this when the underlying state moves and previously-handed-out inode numbers may now point at the wrong content.
Source§

fn flush(&self, node: NodeId) -> Result<()>

Promote any hot-tier buffer for node into a CAS blob. The FUSE flush callback dispatches here (fires on close(2) and explicit fsync). Default: no-op for read-only mounts.
Source§

fn release(&self, node: NodeId) -> Result<()>

Final close of node. Adapters call this on FUSE release so a buffer that survived a missed flush still gets promoted before the inode handle is retired. Default: identical to flush.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more