pub trait StepJournal:
Send
+ Sync
+ 'static {
// Required methods
fn load<'a>(
&'a self,
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<JournalEntry>, JournalError>> + Send + 'a>>;
fn save<'a>(
&'a self,
key: &'a str,
entry: &'a JournalEntry,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>;
fn clear<'a>(
&'a self,
key: &'a str,
revision: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>;
fn sweep(
&self,
completed_before_ms: i64,
unfinished_before_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + '_>>;
fn runs_of<'a>(
&'a self,
principal: &'a str,
tenant: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, JournalError>> + Send + 'a>>;
fn erase<'a>(
&'a self,
principal: &'a str,
tenant: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + 'a>>;
}tool-loop only.Expand description
Required Methods§
Sourcefn load<'a>(
&'a self,
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<JournalEntry>, JournalError>> + Send + 'a>>
fn load<'a>( &'a self, key: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<JournalEntry>, JournalError>> + Send + 'a>>
The entry stored under key, if there is one.
Sourcefn save<'a>(
&'a self,
key: &'a str,
entry: &'a JournalEntry,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>
fn save<'a>( &'a self, key: &'a str, entry: &'a JournalEntry, ) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>
Stores entry under key only if the revision stored is
entry.revision - 1 (none stored counts as 0), and returns
JournalError::Conflict otherwise.
Sourcefn clear<'a>(
&'a self,
key: &'a str,
revision: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>
fn clear<'a>( &'a self, key: &'a str, revision: u64, ) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'a>>
Deletes the entry under key only if its revision is revision:
JournalError::Conflict when another revision is stored, Ok when
none is. A stale run’s delete cannot remove a newer run’s entry.
Sourcefn sweep(
&self,
completed_before_ms: i64,
unfinished_before_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + '_>>
fn sweep( &self, completed_before_ms: i64, unfinished_before_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + '_>>
Deletes completed runs last written before completed_before_ms and
unfinished ones last written before unfinished_before_ms (Unix
milliseconds); returns how many went. A run still going when its entry
is swept is refused its next write (JournalError::Conflict: none
stored takes only revision 1), so the unfinished cutoff must be well
past the longest run and its approvals.
Sourcefn runs_of<'a>(
&'a self,
principal: &'a str,
tenant: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, JournalError>> + Send + 'a>>
fn runs_of<'a>( &'a self, principal: &'a str, tenant: Option<&'a str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, JournalError>> + Send + 'a>>
Every run of principal, in tenant when one is given, without its
content: for an access request, and to know what
erase would delete.
Sourcefn erase<'a>(
&'a self,
principal: &'a str,
tenant: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + 'a>>
fn erase<'a>( &'a self, principal: &'a str, tenant: Option<&'a str>, ) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + 'a>>
Deletes every run of principal, in tenant when one is given;
returns how many went. What a person’s erasure must call for the
journal: the task store’s and the audit log’s do not reach it. A
person named only inside a run’s content (a tool argument, a message)
is not found by this.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".