[−][src]Struct sn_transfers::TransferReplica
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 Replica
[src]
pub fn from_history(
secret_key: SecretKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
events: Vec<ReplicaEvent>
) -> Result<Replica>
[src]
secret_key: SecretKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
events: Vec<ReplicaEvent>
) -> Result<Replica>
A new Replica instance from a history of events.
pub fn from_snapshot(
secret_key: SecretKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
other_groups: HashSet<PublicKeySet>,
wallets: HashMap<PublicKey, Wallet>,
pending_debits: HashMap<PublicKey, u64>
) -> Replica
[src]
secret_key: SecretKeyShare,
key_index: usize,
peer_replicas: PublicKeySet,
other_groups: HashSet<PublicKeySet>,
wallets: HashMap<PublicKey, Wallet>,
pending_debits: HashMap<PublicKey, u64>
) -> Replica
A new Replica instance from current state.
pub fn credits_since(
&self,
wallet_id: &PublicKey,
index: usize
) -> Option<Vec<Transfer>>
[src]
&self,
wallet_id: &PublicKey,
index: usize
) -> Option<Vec<Transfer>>
---------------------- Queries ----------------------------------
Query for new credits since specified index. NB: This is not guaranteed to give you all unknown to you, since there is no absolute order on the credits! Includes the credit at specified index (which may, or may not, be the same as the one that the Actor has at the same index).
pub fn debits_since(
&self,
wallet_id: &PublicKey,
index: usize
) -> Option<Vec<Transfer>>
[src]
&self,
wallet_id: &PublicKey,
index: usize
) -> Option<Vec<Transfer>>
Query for new debits transfers since specified index. Includes the debit at specified index.
pub fn balance(&self, wallet_id: &PublicKey) -> Option<Money>
[src]
pub fn replicas_pk_set(&self) -> Option<PublicKeySet>
[src]
Get the replica's PK set
pub fn genesis<F: FnOnce() -> Option<PublicKey>>(
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferPropagated>>
[src]
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferPropagated>>
---------------------- 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 add_known_group(
&self,
group: PublicKeySet
) -> Result<Option<KnownGroupAdded>>
[src]
&self,
group: PublicKeySet
) -> Result<Option<KnownGroupAdded>>
Adds a PK set for a a new group that we learn of.
pub fn test_validate_transfer(
&self,
signed_transfer: SignedTransfer
) -> Result<Option<TransferValidated>>
[src]
&self,
signed_transfer: SignedTransfer
) -> Result<Option<TransferValidated>>
For now, with test money there is no from wallet.., money is created from thin air.
pub fn validate(
&self,
signed_transfer: SignedTransfer
) -> Result<Option<TransferValidated>>
[src]
&self,
signed_transfer: SignedTransfer
) -> Result<Option<TransferValidated>>
Step 1. Main business logic validation of a debit.
pub fn register<F: FnOnce() -> bool>(
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferRegistered>>
[src]
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferRegistered>>
Step 2. Validation of agreement, and order at debit source.
pub fn receive_propagated<F: FnOnce() -> Option<PublicKey>>(
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferPropagated>>
[src]
&self,
debit_proof: &DebitAgreementProof,
f: F
) -> Result<Option<TransferPropagated>>
Step 3. Validation of DebitAgreementProof, 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<()>
[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..
Trait Implementations
impl Clone for Replica
[src]
impl Debug for Replica
[src]
impl Eq for Replica
[src]
impl PartialEq<Replica> for Replica
[src]
impl StructuralEq for Replica
[src]
impl StructuralPartialEq for Replica
[src]
Auto Trait Implementations
impl RefUnwindSafe for Replica
impl Send for Replica
impl Sync for Replica
impl Unpin for Replica
impl UnwindSafe for Replica
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,