pub trait State: Sync {
type Admission: Send + Sync;
// Required methods
fn verify(&self) -> Result<(), Problem>;
fn validate_destination(&self, path: &Path) -> Result<(), Problem>;
fn reserve(&self, path: &Path) -> Result<(), Problem>;
fn admit(&self, name: &str) -> Result<Self::Admission, Problem>;
fn ensure_new(
&self,
admission: &Self::Admission,
name: &str,
) -> Result<(), Problem>;
fn record_path(&self, admission: &Self::Admission) -> PathBuf;
fn begin(
&self,
admission: &Self::Admission,
task: &Task,
) -> Result<(), Problem>;
fn save(
&self,
admission: &Self::Admission,
task: &Task,
) -> Result<(), Problem>;
// Provided methods
fn next_generation(
&self,
_admission: &Self::Admission,
) -> Result<u64, Problem> { ... }
fn cleanup_retired(
&self,
_admission: &Self::Admission,
_task: &Task,
) -> Result<(), Problem> { ... }
fn record_effect(
&self,
admission: &Self::Admission,
task: &Task,
index: usize,
state: EffectState,
) -> Result<(), Problem> { ... }
fn effect(
&self,
_admission: &Self::Admission,
_task: &Task,
_index: usize,
_settled: bool,
) -> Result<(), Problem> { ... }
}Expand description
Task admission, publication and effect evidence used by lifecycle operations.
Required Associated Types§
Required Methods§
Sourcefn verify(&self) -> Result<(), Problem>
fn verify(&self) -> Result<(), Problem>
Revalidate the workspace binding before relying on its state.
Sourcefn validate_destination(&self, path: &Path) -> Result<(), Problem>
fn validate_destination(&self, path: &Path) -> Result<(), Problem>
Check that the proposed workspace path is available.
Sourcefn reserve(&self, path: &Path) -> Result<(), Problem>
fn reserve(&self, path: &Path) -> Result<(), Problem>
Reserve the proposed destination on the filesystem.
Sourcefn admit(&self, name: &str) -> Result<Self::Admission, Problem>
fn admit(&self, name: &str) -> Result<Self::Admission, Problem>
Acquire operation admission for the named task.
Sourcefn ensure_new(
&self,
admission: &Self::Admission,
name: &str,
) -> Result<(), Problem>
fn ensure_new( &self, admission: &Self::Admission, name: &str, ) -> Result<(), Problem>
Check under admission that the proposed task can be created.
Sourcefn record_path(&self, admission: &Self::Admission) -> PathBuf
fn record_path(&self, admission: &Self::Admission) -> PathBuf
Return the authoritative document path for the admitted task.
Provided Methods§
Sourcefn next_generation(&self, _admission: &Self::Admission) -> Result<u64, Problem>
fn next_generation(&self, _admission: &Self::Admission) -> Result<u64, Problem>
Allocate a fresh incarnation for this task name.
Sourcefn cleanup_retired(
&self,
_admission: &Self::Admission,
_task: &Task,
) -> Result<(), Problem>
fn cleanup_retired( &self, _admission: &Self::Admission, _task: &Task, ) -> Result<(), Problem>
Clean up retained state belonging to the retired incarnation.
Sourcefn record_effect(
&self,
admission: &Self::Admission,
task: &Task,
index: usize,
state: EffectState,
) -> Result<(), Problem>
fn record_effect( &self, admission: &Self::Admission, task: &Task, index: usize, state: EffectState, ) -> Result<(), Problem>
Named entry point; delegates to the legacy hook for existing adapters.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".