Skip to main content

Generation

Struct Generation 

Source
pub struct Generation<A, O> { /* private fields */ }
Expand description

Immutable complete filesystem state belonging to one workspace.

Implementations§

Source§

impl<A, O> Generation<A, O>

Source

pub const fn id(&self) -> GenerationId

Content-addressed generation identity.

Source

pub const fn workspace_id(&self) -> WorkspaceId

Owning workspace identity.

Source

pub fn workspace(&self) -> Workspace<A, O>

Returns the workspace capability that owns this immutable generation.

The returned handle is cheap and retains the same authenticated storage deployment. It is useful for composing generation-oriented algorithms without an adapter-owned workspace registry.

Source§

impl<A: AsyncAuthorityStore, O: AsyncObjectStore> Generation<A, O>

Source

pub async fn reader(&self) -> Result<PinnedReader<A, O>, WorkspaceError>

Opens one cheap immutable reader pinned to this exact generation.

The generation root is authenticated once while the reader is opened; descendant objects remain lazy and are fetched only by the operation that needs them. Clone the returned reader to overlap independent requests without reopening the generation.

§Errors

Rejects unavailable, foreign, or corrupt generation state and bounded backend failures.

Source

pub async fn diff_to( &self, to: &Generation<A, O>, maximum_changes: u32, ) -> Result<ChangeSet<A, O>, WorkspaceError>

Computes one semantic delta to a compatible generation in any workspace from the same filesystem deployment.

Source

pub async fn diff_to_bounded( &self, to: &Generation<A, O>, maximum_changes: u32, budget: WorkBudget, cancellation: &CancellationToken, ) -> Result<ChangeSet<A, O>, WorkspaceError>

Computes one semantic delta with explicit cumulative work and cancellation bounds.

Source

pub async fn materialize( &self, options: &MaterializeOptions, budget: WorkBudget, cancellation: &CancellationToken, ) -> Result<OperationReceipt<MaterializationReceipt>, WorkspaceError>

Materializes this immutable generation into an existing empty host directory using the SDK’s native capability-rooted adapter. Unix ctime and Linux birth time are host-generated view-local facts; their exact canonical values remain in this generation, not in the host inode.

Source

pub async fn materialize_path( &self, path: &str, options: &MaterializeOptions, budget: WorkBudget, cancellation: &CancellationToken, ) -> Result<OperationReceipt<MaterializationReceipt>, WorkspaceError>

Materializes one path from this generation below an existing empty host directory. The same relative path is reproduced below the destination, allowing callers to stage and atomically exchange it.

Source

pub async fn materialize_paths( &self, paths: &[String], options: &MaterializeOptions, budget: WorkBudget, cancellation: &CancellationToken, ) -> Result<OperationReceipt<MaterializationReceipt>, WorkspaceError>

Materializes multiple paths with one pinned checkout and shared file-identity table, preserving hard links across selected paths.

Source

pub async fn restore_host_path( &self, relative: &Path, replacement: HostPathReplacement, options: &MaterializeOptions, budget: WorkBudget, cancellation: &CancellationToken, ) -> Result<OperationReceipt<HostPathRestore>, WorkspaceError>

Restores one path from this immutable generation into a host tree.

Only the selected path is read and touched. Publication is same-volume and atomic for an ordinary host tree, or mount-visible for a live mount.

Source

pub async fn restore_host_paths( &self, paths: &[PathBuf], replacement: HostPathReplacement, options: &MaterializeOptions, cancellation: &CancellationToken, ) -> Result<Vec<HostPathRestore>, WorkspaceError>

Restores a bounded sequence of paths through one pinned checkout.

Source

pub async fn parents(&self) -> Result<Vec<GenerationId>, WorkspaceError>

Returns the exact immutable parent generation identities.

§Errors

Returns an authenticated storage or identity failure for malformed state.

Source

pub async fn read( &self, path: &str, maximum_bytes: u64, ) -> Result<Bytes, WorkspaceError>

Reads at most maximum_bytes from one complete file in this exact immutable generation.

§Errors

Rejects invalid, absent, non-file, oversized, or unauthenticated state.

Source

pub async fn read_range( &self, path: &str, offset: u64, length: u64, ) -> Result<Bytes, WorkspaceError>

Reads one exact range from this immutable generation.

§Errors

Rejects invalid/absent/non-file paths, invalid ranges, and authenticated backend failures.

Source

pub async fn stat(&self, path: &str) -> Result<WorkspaceStat, WorkspaceError>

Returns complete metadata for one path in this immutable generation.

§Errors

Rejects invalid or absent paths and authenticated backend failures.

Source

pub async fn lookup_paths( &self, paths: &[NamespacePath], budget: WorkBudget, cancellation: &CancellationToken, ) -> FsResult<Vec<Option<FileRecord>>>

Resolves an ordered exact path batch while sharing authenticated directory and file-table frontiers. Absence is returned as None; links are not followed and file bodies are not read.

§Errors

Rejects an empty or excessive batch, foreign path encodings, cancellation, and authenticated backend failures.

Source

pub async fn list_directory( &self, path: &str, after: Option<&LogicalName>, maximum_entries: u32, ) -> Result<WorkspaceDirectoryPage, WorkspaceError>

Returns one authenticated bounded directory page from this generation.

§Errors

Rejects invalid/absent/non-directory paths, invalid cursors or bounds, and authenticated backend failures.

Source

pub async fn paths_for_file_id( &self, file_id: FileId, maximum_entries: u32, ) -> Result<Vec<String>, WorkspaceError>

Finds portable paths bound to one stable file identity in this generation.

The traversal is bounded by maximum_entries; results are sorted and include every matching hard link encountered before that bound.

Source

pub async fn paths_for_file_ids( &self, file_ids: impl IntoIterator<Item = FileId>, maximum_entries: u32, ) -> Result<BTreeMap<FileId, Vec<String>>, WorkspaceError>

Finds portable paths for multiple stable file identities in one namespace traversal.

The traversal is bounded by maximum_entries; each result is sorted and includes every matching hard link encountered before that bound. Identities without a matching binding are omitted.

Reads one opaque symbolic-link target from this generation.

§Errors

Rejects invalid/absent/non-symbolic-link paths and authenticated backend failures.

Source

pub async fn plan_extents( &self, path: &str, offset: u64, length: u64, maximum_spans: u32, ) -> Result<WorkspaceExtentPlan, WorkspaceError>

Plans sparse logical spans without reading content bodies.

§Errors

Rejects invalid/absent/non-file paths, invalid ranges or bounds, and authenticated backend failures.

Source

pub async fn pin( &self, identity: impl AsRef<str>, ) -> Result<GenerationPin<A, O>, WorkspaceError>

Retains this exact immutable generation under one opaque stable identity.

§Errors

Rejects invalid identities, foreign or corrupt generation state, and conflicting reuse of an existing pin identity.

Trait Implementations§

Source§

impl<A, O> Clone for Generation<A, O>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<A, O> !RefUnwindSafe for Generation<A, O>

§

impl<A, O> !UnwindSafe for Generation<A, O>

§

impl<A, O> Freeze for Generation<A, O>
where Workspace<A, O>: Freeze,

§

impl<A, O> Send for Generation<A, O>
where Workspace<A, O>: Send,

§

impl<A, O> Sync for Generation<A, O>
where Workspace<A, O>: Sync,

§

impl<A, O> Unpin for Generation<A, O>
where Workspace<A, O>: Unpin,

§

impl<A, O> UnsafeUnpin for Generation<A, O>
where Workspace<A, O>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StorageFuture for T
where T: Send,

Source§

impl<T> StorageProvider for T
where T: Send + Sync + ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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