Struct scabbard::service::Scabbard[][src]

pub struct Scabbard { /* fields omitted */ }

A service for running Sawtooth Sabre smart contracts with two-phase commit consensus.

Implementations

impl Scabbard[src]

pub fn new(
    service_id: String,
    circuit_id: &str,
    version: ScabbardVersion,
    peer_services: HashSet<String>,
    state_db_dir: &Path,
    state_db_size: usize,
    receipt_db_dir: &Path,
    receipt_db_size: usize,
    signature_verifier: Box<dyn SignatureVerifier>,
    admin_keys: Vec<String>,
    coordinator_timeout: Option<Duration>
) -> Result<Self, ScabbardError>
[src]

Generate a new Scabbard service.

pub fn get_state_at_address(
    &self,
    address: &str
) -> Result<Option<Vec<u8>>, ScabbardError>
[src]

Fetch the value at the given address in the scabbard service’s state. Returns None if the address is not set.

pub fn get_state_with_prefix(
    &self,
    prefix: Option<&str>
) -> Result<StateIter, ScabbardError>
[src]

Fetch a list of entries in the scabbard service’s state. If a prefix is provided, only return entries whose addresses are under the given address prefix. If no prefix is provided, return all state entries.

pub fn get_current_state_root(&self) -> Result<String, ScabbardError>[src]

Get the current state root hash of the scabbard service’s state.

pub fn add_batches(
    &self,
    batches: Vec<BatchPair>
) -> Result<Option<String>, ScabbardError>
[src]

pub fn get_batch_info(
    &self,
    ids: HashSet<String>,
    wait: Option<Duration>
) -> Result<BatchInfoIter, ScabbardError>
[src]

Get the BatchInfo for each specified batch.

Arguments

  • ids: List of batch IDs to get info on
  • wait: If Some, wait up to the given time for all requested batches to complete (statuses will be either Committed or Invalid); if the timeout expires, an Err result will be given by the returned iterator. If None, return the BatchInfos to complete.

pub fn get_events_since(
    &self,
    event_id: Option<String>
) -> Result<Events, ScabbardError>
[src]

pub fn add_state_subscriber(
    &self,
    subscriber: Box<dyn StateSubscriber>
) -> Result<(), ScabbardError>
[src]

Trait Implementations

impl Clone for Scabbard[src]

fn clone(&self) -> Scabbard[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Service for Scabbard[src]

fn service_id(&self) -> &str[src]

This service’s ID Read more

fn service_type(&self) -> &str[src]

This service’s type Read more

fn start(
    &mut self,
    service_registry: &dyn ServiceNetworkRegistry
) -> Result<(), ServiceStartError>
[src]

Starts the service Read more

fn stop(
    &mut self,
    service_registry: &dyn ServiceNetworkRegistry
) -> Result<(), ServiceStopError>
[src]

Stops Starts the service Read more

fn destroy(self: Box<Self>) -> Result<(), ServiceDestroyError>[src]

Clean-up any resources before the service is removed. Consumes the service (which, given the use of dyn traits, this must take a boxed Service instance). Read more

fn purge(&mut self) -> Result<(), InternalError>[src]

Purge any persistent state maintained by this service.

fn handle_message(
    &self,
    message_bytes: &[u8],
    _message_context: &ServiceMessageContext
) -> Result<(), ServiceError>
[src]

Handle any incoming message intended for this service instance. Read more

fn as_any(&self) -> &dyn Any[src]

Cast the service as &dyn Any. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Send + Sync + Clone

pub fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>

Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more

pub fn self_address_mut(&mut self) -> *mut ()

Returns the address of self. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<P, N> IntoBytes<P> for N where
    P: Message + FromNative<N>, 
[src]

impl<P, N> IntoBytes<P> for N where
    P: Message + FromNative<N>, 
[src]

impl<N, P> IntoNative<N> for P where
    N: FromProto<P>, 
[src]

impl<N, P> IntoNative<N> for P where
    N: FromProto<P>, 
[src]

impl<N, P> IntoProto<P> for N where
    P: FromNative<N>, 
[src]

impl<N, P> IntoProto<P> for N where
    P: FromNative<N>, 
[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone

pub fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>

Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more

pub fn self_address_mut(&mut self) -> *mut ()

Returns the address of self. Read more

impl<T> SafeBorrow<T> for T where
    T: ?Sized

pub fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V