Struct safe_network::transfers::WalletReplica [−][src]
pub struct WalletReplica { /* fields omitted */ }
Expand description
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
pub fn from_history(
id: OwnerType,
replica_id: PublicKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
events: Vec<ReplicaEvent>
) -> Result<Self, Error>
pub fn from_history(
id: OwnerType,
replica_id: PublicKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
events: Vec<ReplicaEvent>
) -> Result<Self, Error>
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
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
A new Replica instance from current state.
––––––––––– 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>
pub fn test_validate_transfer(
&self,
signed_debit: &SignedDebit,
signed_credit: &SignedCredit
) -> Result<Option<()>, Error>
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>
pub fn validate(
&self,
signed_debit: &SignedDebit,
signed_credit: &SignedCredit
) -> Result<Option<()>, Error>
Step 1. Main business logic validation of a debit.
pub fn register(
&self,
transfer_proof: &TransferAgreementProof
) -> Result<Option<TransferRegistered>, Error>
pub fn register(
&self,
transfer_proof: &TransferAgreementProof
) -> Result<Option<TransferRegistered>, Error>
Step 2. Validation of agreement, and order at debit source.
pub fn receive_propagated(
&self,
credit_proof: &CreditAgreementProof
) -> Result<Option<()>, Error>
pub fn receive_propagated(
&self,
credit_proof: &CreditAgreementProof
) -> Result<Option<()>, Error>
Step 3. Validation of TransferAgreementProof, and credit idempotency at credit destination. (Since this leads to a credit, there is no requirement on order.)
––––––––––– 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..
Test-helper API to simulate Client CREDIT Transfers.
pub fn propose_validation(
&self,
signed_transfer: &SignedTransferShare
) -> Result<Option<TransferValidationProposed>, Error>
pub fn propose_validation(
&self,
signed_transfer: &SignedTransferShare
) -> Result<Option<TransferValidationProposed>, Error>
Step 1. Main business logic validation of a debit.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for WalletReplica
impl Send for WalletReplica
impl Sync for WalletReplica
impl Unpin for WalletReplica
impl UnwindSafe for WalletReplica
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V