Struct WorkspaceCommit
pub struct WorkspaceCommit {
pub kind: String,
pub version: u16,
pub workspace: String,
pub author: CommitAuthor,
pub at_ms: u64,
pub invocation: Option<Uuid>,
pub run: Option<CommitGroup>,
pub parts: Vec<CommitPart>,
}Expand description
One signed action across every unit it wrote.
Fields§
§kind: String[COMMIT_RECORD_KIND] — what this record is.
version: u16[COMMIT_VERSION] — how to read it.
workspace: StringThe workspace whose units the action wrote.
Who made it: the principal and the device that signed it.
at_ms: u64When the action was made, in milliseconds since the Unix epoch, as the author’s device read the clock.
invocation: Option<Uuid>The invocation the action ran under, when an admitted door ran it.
run: Option<CommitGroup>The run the action was invoked in, when it was invoked in one: an agent run, a task, a command line. Undo takes a run’s steps back as one.
parts: Vec<CommitPart>Every unit it wrote. A receiver applies all of them or none.
Implementations§
§impl WorkspaceCommit
impl WorkspaceCommit
pub fn new(
workspace: impl Into<String>,
author: CommitAuthor,
at_ms: u64,
invocation: Option<Uuid>,
run: Option<CommitGroup>,
parts: Vec<CommitPart>,
) -> WorkspaceCommit
pub fn new( workspace: impl Into<String>, author: CommitAuthor, at_ms: u64, invocation: Option<Uuid>, run: Option<CommitGroup>, parts: Vec<CommitPart>, ) -> WorkspaceCommit
A commit of parts, made by author at at_ms, for the action that
ran under invocation in run, in workspace.
pub fn of_mutation(
workspace: &str,
app: &str,
record: &str,
author: &CommitAuthor,
mutation: &DocumentMutation,
) -> Result<Option<WorkspaceCommit>, CommitError>
pub fn of_mutation( workspace: &str, app: &str, record: &str, author: &CommitAuthor, mutation: &DocumentMutation, ) -> Result<Option<WorkspaceCommit>, CommitError>
The commit for one action that published mutation as the unit of
app’s record: the hash of every change it carries, the time the
latest of them was made, and the invocation and run they agree on.
None for a mutation that carries no change (a snapshot, or an empty
set).
§Errors
[CommitError::Unnamed] for a change that names no action.
pub fn of_units(
workspace: &str,
author: &CommitAuthor,
units: &[UnitMutation<'_>],
) -> Result<Vec<Option<WorkspaceCommit>>, CommitError>
pub fn of_units( workspace: &str, author: &CommitAuthor, units: &[UnitMutation<'_>], ) -> Result<Vec<Option<WorkspaceCommit>>, CommitError>
The commit each unit of one publication pass travels under: one entry
per entry of units, in that order. None for a unit that carries no
change (a snapshot, or an empty set).
The units one action wrote share one commit, which names every one of them as a part, so a peer applies all of the action or none. Units belong to one action when every change of each ran under the same invocation; a unit whose changes ran under several invocations, or none, travels under a commit of its own.
author names who publishes. Its device may be left as zeros by a
caller that holds no signing key: the transport signs the frame and
stamps the device it signs with.
§Errors
[CommitError::Unnamed] for a change that names no action.
pub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
The commit’s canonical bytes: what a host stores, and what its id addresses.
pub fn decode(bytes: &[u8]) -> Result<WorkspaceCommit, CommitError>
pub fn decode(bytes: &[u8]) -> Result<WorkspaceCommit, CommitError>
The commit of bytes, checked: a known kind and version, at least one
part, no unit twice, and a change in every part.
§Errors
[CommitError] for bytes that are not such a commit.
pub fn id(&self) -> [u8; 32]
pub fn id(&self) -> [u8; 32]
The commit’s content address: two peers holding the same commit name it by the same bytes.
pub fn check(&self) -> Result<(), CommitError>
pub fn check(&self) -> Result<(), CommitError>
Whether every part is well formed.
§Errors
[CommitError::Kind], Version,
NoParts,
DuplicatePart or
EmptyPart.
pub fn part(&self, app: &str, record: &str) -> Option<&CommitPart>
pub fn part(&self, app: &str, record: &str) -> Option<&CommitPart>
The part of app’s record, when the action wrote it.
pub fn covers(&self, app: &str, record: &str) -> bool
pub fn covers(&self, app: &str, record: &str) -> bool
Whether the action wrote the unit of app’s record.
pub fn change(&self, hash: &[u8; 32]) -> Option<&CommitPart>
pub fn change(&self, hash: &[u8; 32]) -> Option<&CommitPart>
The change hash is, as this commit names it: the unit and the position
in it, when the action made that change.
pub fn frame(&self, inner: &[u8]) -> Result<Vec<u8>, CommitError>
pub fn frame(&self, inner: &[u8]) -> Result<Vec<u8>, CommitError>
Frame the document payload inner under this commit: what one unit’s
signed envelope carries, so the device signature covers the commit as
well as the change.
§Errors
[CommitError::TooLarge] for a commit over [MAX_COMMIT_BYTES].
pub fn of_envelope(
envelope: &SignedOp,
) -> Result<Option<WorkspaceCommit>, CommitError>
pub fn of_envelope( envelope: &SignedOp, ) -> Result<Option<WorkspaceCommit>, CommitError>
The commit the signed envelope whose payload is cleartext carries,
when it carries one, and the document frame inside it.
The commit travels inside the envelope’s signed payload, so the device signature over that payload is the commit’s signature. A commit naming another device than the envelope’s author is refused.
§Errors
[CommitError] for bytes that are not a framed payload, a commit that
does not check, or a commit authored by another device.
pub fn of_envelope_payload(
envelope: &SignedOp,
cleartext: &[u8],
) -> Result<Option<WorkspaceCommit>, CommitError>
pub fn of_envelope_payload( envelope: &SignedOp, cleartext: &[u8], ) -> Result<Option<WorkspaceCommit>, CommitError>
The commit carried inside cleartext, the payload envelope signs once
it is opened: a sealed route’s plaintext, or an unsealed envelope’s
payload. None when the payload carries none.
§Errors
[CommitError::ForeignDevice] when the commit names another device than
the envelope’s author, or the [CommitError] of a commit that does not
decode.
pub fn split(
cleartext: &[u8],
) -> Result<(&[u8], Option<WorkspaceCommit>), CommitError>
pub fn split( cleartext: &[u8], ) -> Result<(&[u8], Option<WorkspaceCommit>), CommitError>
Split one signed document payload into the commit it carries (if any) and the document frame inside it. Payloads without a commit are returned whole, so every earlier frame keeps its meaning.
§Errors
[CommitError] for a frame whose commit length runs past its bytes,
a commit over [MAX_COMMIT_BYTES], or a commit that does not check.
Trait Implementations§
§impl Clone for WorkspaceCommit
impl Clone for WorkspaceCommit
§fn clone(&self) -> WorkspaceCommit
fn clone(&self) -> WorkspaceCommit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for WorkspaceCommit
impl Debug for WorkspaceCommit
§impl<'de> Deserialize<'de> for WorkspaceCommit
impl<'de> Deserialize<'de> for WorkspaceCommit
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<WorkspaceCommit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<WorkspaceCommit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for WorkspaceCommit
impl PartialEq for WorkspaceCommit
§impl Serialize for WorkspaceCommit
impl Serialize for WorkspaceCommit
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for WorkspaceCommit
impl StructuralPartialEq for WorkspaceCommit
Auto Trait Implementations§
impl Freeze for WorkspaceCommit
impl RefUnwindSafe for WorkspaceCommit
impl Send for WorkspaceCommit
impl Sync for WorkspaceCommit
impl Unpin for WorkspaceCommit
impl UnsafeUnpin for WorkspaceCommit
impl UnwindSafe for WorkspaceCommit
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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