pub struct Checkpointed {
pub inner: ErasedHandler,
pub workspace: Arc<dyn Workspace>,
pub root: PathBuf,
pub taking: Taking,
pub newest: Arc<Mutex<Option<Snapshot>>>,
pub first: Arc<Mutex<Option<Snapshot>>>,
pub before: Arc<Mutex<Option<Snapshot>>>,
}Expand description
A handler that takes a Snapshot just before and just after its
inner handler serves a call, and publishes what changed as
FilesChanged beside the call’s answer, unless the call published its
own: so a call of any tool that may write anything, such as shell,
reports what it changed.
What it reports is what changed while the call ran, by whatever wrote it: a process outside the call that wrote in that time, such as the user’s editor, is in it. A change made between two calls is in neither.
newest, shared between the calls one host checkpoints with the same
root, is the newest snapshot any of them took: each call hands it to snapshot as
earlier, so a scan hashes again only what changed and git’s private
index stays warm, but never takes it as its “before”. first, shared
the same way, keeps the first “before” taken, the files as they were
before the first of those calls, so the host can tell what all of them
changed or restore a file. before, this call’s own, keeps the
snapshot taken just before it ran, so the host can tell what it alone
changed later on or read a file as it found it. Snapshots run on a
thread of their own; one that fails is logged, and the call publishes
nothing. A call that streams its answer is served as it is, with
nothing published.
Fields§
§inner: ErasedHandlerThe handler that serves the call.
workspace: Arc<dyn Workspace>Where the files are.
root: PathBufThe directory whose files are compared.
taking: TakingHow each snapshot is taken.
newest: Arc<Mutex<Option<Snapshot>>>The newest snapshot taken by any call it shares this with: only
reused as earlier, never as a “before”.
first: Arc<Mutex<Option<Snapshot>>>The snapshot before the first call, once one was taken.
before: Arc<Mutex<Option<Snapshot>>>The snapshot taken just before this call ran, once taken.
Trait Implementations§
Source§impl Clone for Checkpointed
impl Clone for Checkpointed
Source§impl Debug for Checkpointed
impl Debug for Checkpointed
Source§impl Serve for Checkpointed
impl Serve for Checkpointed
Source§fn descriptor(&self) -> HandlerDescriptor
fn descriptor(&self) -> HandlerDescriptor
Source§fn key(&self) -> HandlerKey
fn key(&self) -> HandlerKey
Source§async fn serve(&self, kind: EffectKind, dispatch: Dispatch) -> Reply
async fn serve(&self, kind: EffectKind, dispatch: Dispatch) -> Reply
Source§fn footprint(&self, kind: &EffectKind) -> Option<Touches>
fn footprint(&self, kind: &EffectKind) -> Option<Touches>
kind may read and change, for a tool’s handler
(Tool::footprint); None when it
cannot say, such as for arguments that do not parse.Source§fn check(&self, kind: &EffectKind) -> Vec<UnsupportedOption>
fn check(&self, kind: &EffectKind) -> Vec<UnsupportedOption>
kind this handler would leave out when it serves
it, with nothing sent: for a model’s handler, what its wire or model
cannot honour (DynModel::check).
Empty when it leaves nothing out or cannot say, as by default.