Struct sn_transfers::WalletReplica[][src]

pub struct WalletReplica { /* fields omitted */ }

The Replica is the part of an AT2 system that forms validating groups, and signs individual transfers between wallets. Replicas validate requests to debit an wallet, and apply operations that has a valid “debit agreement proof” from the group, i.e. signatures from a quorum of its peers. Replicas don’t initiate transfers or drive the algo - only Actors do.

Implementations

impl WalletReplica[src]

pub fn from_history(
    id: OwnerType,
    replica_id: PublicKeyShare,
    key_index: usize,
    peer_replicas: PublicKeySet,
    events: Vec<ReplicaEvent>
) -> Result<Self, Error>
[src]

A new Replica instance from a history of events.

pub fn from_snapshot(
    id: OwnerType,
    replica_id: PublicKeyShare,
    key_index: usize,
    peer_replicas: PublicKeySet,
    wallet: Wallet,
    pending_proposals: HashMap<u64, HashMap<usize, TransferValidationProposed>>,
    pending_debit: Option<u64>
) -> Self
[src]

A new Replica instance from current state.

pub fn balance(&self) -> Token[src]

pub fn wallet(&self) -> Option<WalletSnapshot>[src]

pub fn genesis<F: FnOnce() -> Result<PublicKey, Error>>(
    &self,
    credit_proof: &CreditAgreementProof,
    past_key: F
) -> Result<Option<()>, Error>
[src]


––––––––––– Cmds ———————————––

This is the one and only infusion of money to the system. Ever. It is carried out by the first node in the network.

pub fn test_validate_transfer(
    &self,
    signed_debit: &SignedDebit,
    signed_credit: &SignedCredit
) -> Result<Option<()>, Error>
[src]

For now, with test token there is no from wallet.., token is created from thin air.

pub fn validate(
    &self,
    signed_debit: &SignedDebit,
    signed_credit: &SignedCredit
) -> Result<Option<()>, Error>
[src]

Step 1. Main business logic validation of a debit.

pub fn register<F: FnOnce() -> Result<PublicKey, Error>>(
    &self,
    transfer_proof: &TransferAgreementProof,
    past_key: F
) -> Result<Option<TransferRegistered>, Error>
[src]

Step 2. Validation of agreement, and order at debit source.

pub fn receive_propagated<F: FnOnce() -> Result<PublicKey, Error>>(
    &self,
    credit_proof: &CreditAgreementProof,
    past_key: F
) -> Result<Option<()>, Error>
[src]

Step 3. Validation of TransferAgreementProof, and credit idempotency at credit destination. (Since this leads to a credit, there is no requirement on order.)

pub fn apply(&mut self, event: ReplicaEvent) -> Result<(), Error>[src]


––––––––––– Mutation ———————————

Mutation of state. There is no validation of an event, it (the cmd) is assumed to have been properly validated before the fact is established (event raised), and thus anything that breaks here, is a bug in the validation..

impl WalletReplica[src]

pub fn propose_validation(
    &self,
    signed_transfer: &SignedTransferShare
) -> Result<Option<TransferValidationProposed>, Error>
[src]

Step 1. Main business logic validation of a debit.

Trait Implementations

impl Clone for WalletReplica[src]

impl Debug for WalletReplica[src]

impl Eq for WalletReplica[src]

impl PartialEq<WalletReplica> for WalletReplica[src]

impl StructuralEq for WalletReplica[src]

impl StructuralPartialEq for WalletReplica[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.

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.

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