Command

Trait Command 

Source
pub trait Command {
    // Required methods
    fn priority(&self) -> Priority;
    fn id(&self) -> CmdId;
    fn parent(&self) -> Prior<Address>;
    fn policy(&self) -> Option<&[u8]>;
    fn bytes(&self) -> &[u8];

    // Provided methods
    fn max_cut(&self) -> Result<usize, Bug> { ... }
    fn address(&self) -> Result<Address, Bug> { ... }
}
Expand description

An action message interpreted by its associated policy to affect state.

A Command is opaque to the runtime engine. When the engine receives a message, it is validated and serialized by its policy. The policy returns a command implementation to update the stored graph. A policy will also emit effects once a command is verified, which are sent to the client.

Required Methods§

Source

fn priority(&self) -> Priority

Return this command’s Priority, determining how this event is ordered amongst others it does not have a causal relationship with.

Source

fn id(&self) -> CmdId

Uniquely identifies the serialized command.

Source

fn parent(&self) -> Prior<Address>

Return this command’s parents, or address(s) that immediately precede(s) this.

Source

fn policy(&self) -> Option<&[u8]>

Return this command’s associated policy.

Source

fn bytes(&self) -> &[u8]

Return this command’s serialized data.

Provided Methods§

Source

fn max_cut(&self) -> Result<usize, Bug>

Return this command’s max cut. Max cut is the maximum distance to the init command.

Source

fn address(&self) -> Result<Address, Bug>

Return this command’s address.

Implementations on Foreign Types§

Source§

impl<C: Command> Command for &C

Source§

fn priority(&self) -> Priority

Source§

fn id(&self) -> CmdId

Source§

fn parent(&self) -> Prior<Address>

Source§

fn policy(&self) -> Option<&[u8]>

Source§

fn bytes(&self) -> &[u8]

Source§

fn max_cut(&self) -> Result<usize, Bug>

Source§

fn address(&self) -> Result<Address, Bug>

Implementors§