Skip to main content

Workspace

Struct Workspace 

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

A named, versioned body of work content with its own histories and journal. The root engine is source zero; each mounted source carries its own engine and history (ADR-0009).

Implementations§

Source§

impl Workspace

Source

pub fn init(path: impl AsRef<Path>) -> Result<Self, Error>

Turn path into a workspace: control dir, journal, and engine store.

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, Error>

Open the workspace already present at path.

Source

pub fn actor(&self) -> &Actor

The actor this workspace handle acts as.

Source

pub fn attach(&mut self, folder: impl AsRef<Path>) -> Result<Source, Error>

Attach a local folder, importing its content into the root — source zero. One root import per workspace; mounted sources go through Workspace::attach_mount.

Source

pub fn attach_mount( &mut self, folder: impl AsRef<Path>, name: &str, ) -> Result<Source, Error>

Attach a local folder as a mounted source: its own engine, its own history, at root/<name> (ADR-0009).

Source

pub fn attach_remote(&mut self, url: &str, name: &str) -> Result<Source, Error>

Attach a bucket prefix as a mounted source (ADR-0012): the objects import into the mount, which carries its own engine and history; the listing’s fingerprint guards every later mirror home.

Source

pub fn log(&mut self, limit: usize) -> Result<Vec<SourceSnapshot>, Error>

The shared lines’ snapshots: the root’s, then each mount’s in name order, each newest first, limit applying per source.

Source

pub fn diff_latest(&mut self) -> Result<Diff, Error>

Diff each source’s latest snapshot against its first parent, root first then mounts in name order, every delta raised to the highest rung the ladder allows and mounted addresses scoped by mount.

Source

pub fn manifest(&mut self) -> Result<String, Error>

Render the read model an actor consumes first: identity, sources, discipline, live state, and the loop this workspace expects. Every face returns this text verbatim (ADR-0006: one render, three faces).

Source

pub fn status(&mut self) -> Result<String, Error>

The live-state read model: what the manifest’s state section says, standing alone. Every face returns this text verbatim (ADR-0006).

Source

pub fn diff_between(&mut self, before: &str, after: &str) -> Result<Diff, Error>

Diff two of the root line’s snapshots by id: before against after, each delta raised to the highest rung the ladder allows. Mounted lines’ snapshot pairs arrive with the session fan-out.

Source

pub fn journal(&mut self, limit: usize) -> Result<Vec<JournalEntry>, Error>

Read up to limit journal entries, newest first.

Source

pub fn open_session( &mut self, actor: &Actor, instruction: &Instruction, ) -> Result<Session, Error>

Open a session for actor: its own working copy holding the shared head, its own change. Isolation is not optional — every session starts isolated, and only landing serializes.

Source

pub fn sessions(&mut self) -> Result<Vec<Session>, Error>

Every session, newest first. Sessions are durable rows plus real directories: they survive process restarts, and nothing deletes them.

Source

pub fn session(&mut self, id: SessionId) -> Result<Session, Error>

The session named id.

Source

pub fn session_write( &mut self, id: SessionId, path: &str, content: &str, ) -> Result<String, Error>

Write content at path inside the session’s working copy — a mount-scoped path lands in that source’s working copy — and snapshot every source; the id of the written source’s tip snapshot.

Source

pub fn session_read( &mut self, id: SessionId, path: &str, start: usize, max_bytes: Option<usize>, ) -> Result<ReadResult, Error>

Read path inside the session’s working copy, windowed. A document a package projects reads as its projection; plain text reads as itself; anything else refuses — raw byte views arrive with a later slice.

Source

pub fn session_diff(&mut self, id: SessionId) -> Result<Diff, Error>

Each source’s session change against the shared-line snapshot it forked from, raised through the ladder like any diff, mounted addresses scoped by mount. An untouched source contributes nothing.

Source

pub fn request_land(&mut self, id: SessionId) -> Result<LandingRequest, Error>

Open the session’s landing request — the gate’s object, never a direct write (ADR-0007). Asking again returns the request already holding the gate.

Source

pub fn landing_requests(&mut self) -> Result<Vec<LandingRequest>, Error>

Every landing request, newest first.

Source

pub fn request(&mut self, id: RequestId) -> Result<LandingRequest, Error>

The landing request named id.

Source

pub fn approve( &mut self, id: RequestId, approver: &Actor, ) -> Result<GateOutcome, Error>

Record approver’s approval on the request; when the gate is satisfied the apply runs — lease, rebase, advance — landing the change or parking the request on a conflict.

Source

pub fn reject( &mut self, id: RequestId, actor: &Actor, reason: Option<&str>, ) -> Result<LandingRequest, Error>

Reject the request: the gate closes, the session stays open.

Source

pub fn land(&mut self, id: SessionId) -> Result<GateOutcome, Error>

Land the session’s change: sugar for request plus self-approval. Where policy forbids self-approval the request stays pending for other approvers.

Source

pub fn abandon(&mut self, id: SessionId) -> Result<Session, Error>

Close the session without landing; its work stays in history and its working copy stays on disk.

Source

pub fn watch( &mut self, debounce: Duration, on_event: impl FnMut(&WatchEvent), stop: &WatchStop, ) -> Result<(), Error>

Watch the workspace root: external edits become attributed snapshots through the same snapshot path every operation uses. Blocks until stop asks it to return; edits made while no watcher runs are caught up by the scan at start. Each snapshot — and the armed watcher itself — reaches the caller through on_event.

Source

pub fn undo(&mut self, id: RequestId) -> Result<Vec<Restore>, Error>

Step a landed request back off every line it landed (ADR-0011): reverse landing order, each line under its landing lease, idempotent per line. The request re-opens with its approvals dismissed — an undo is a new decision point — and the session re-opens with its change intact, immediately re-landable.

Source

pub fn pull(&mut self, source: Option<&str>) -> Result<PullOutcome, Error>

Fold bucket-side changes into a mounted remote source’s line as one attributed snapshot (ADR-0012, R2). A line that moved locally since its last sync refuses by name - land or sync it first; nothing is pulled over unlanded movement, and the pull’s own auto-snapshot means outstanding edits count as movement, never as loss.

Source

pub fn sync( &mut self, source: Option<&str>, force: bool, ) -> Result<SyncOutcome, Error>

Mirror a folder source’s shared line back to its origin (ADR-0010): guarded by the recorded fingerprint unless force. Git sources refuse by name - bookmark motion is their out-flow. The act is journaled either way.

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<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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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: Sized + 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: Sized + 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> 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, 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