[][src]Trait grin_wallet_libwallet::WalletOutputBatch

pub trait WalletOutputBatch<K> where
    K: Keychain, 
{ fn keychain(&mut self) -> &mut K;
fn save(&mut self, out: OutputData) -> Result<(), Error>;
fn get(
        &self,
        id: &Identifier,
        mmr_index: &Option<u64>
    ) -> Result<OutputData, Error>;
fn iter(&self) -> Box<dyn Iterator<Item = OutputData>>;
fn delete(
        &mut self,
        id: &Identifier,
        mmr_index: &Option<u64>
    ) -> Result<(), Error>;
fn save_child_index(
        &mut self,
        parent_key_id: &Identifier,
        child_n: u32
    ) -> Result<(), Error>;
fn save_last_confirmed_height(
        &mut self,
        parent_key_id: &Identifier,
        height: u64
    ) -> Result<(), Error>;
fn next_tx_log_id(
        &mut self,
        parent_key_id: &Identifier
    ) -> Result<u32, Error>;
fn tx_log_iter(&self) -> Box<dyn Iterator<Item = TxLogEntry>>;
fn save_tx_log_entry(
        &mut self,
        t: TxLogEntry,
        parent_id: &Identifier
    ) -> Result<(), Error>;
fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error>;
fn acct_path_iter(&self) -> Box<dyn Iterator<Item = AcctPathMapping>>;
fn lock_output(&mut self, out: &mut OutputData) -> Result<(), Error>;
fn save_private_context(
        &mut self,
        slate_id: &[u8],
        participant_id: usize,
        ctx: &Context
    ) -> Result<(), Error>;
fn delete_private_context(
        &mut self,
        slate_id: &[u8],
        participant_id: usize
    ) -> Result<(), Error>;
fn commit(&self) -> Result<(), Error>; }

Batch trait to update the output data backend atomically. Trying to use a batch after commit MAY result in a panic. Due to this being a trait, the commit method can't take ownership. TODO: Should these be split into separate batch objects, for outputs, tx_log entries and meta/details?

Required methods

fn keychain(&mut self) -> &mut K

Return the keychain being used

fn save(&mut self, out: OutputData) -> Result<(), Error>

Add or update data about an output to the backend

fn get(
    &self,
    id: &Identifier,
    mmr_index: &Option<u64>
) -> Result<OutputData, Error>

Gets output data by id

fn iter(&self) -> Box<dyn Iterator<Item = OutputData>>

Iterate over all output data stored by the backend

fn delete(
    &mut self,
    id: &Identifier,
    mmr_index: &Option<u64>
) -> Result<(), Error>

Delete data about an output from the backend

fn save_child_index(
    &mut self,
    parent_key_id: &Identifier,
    child_n: u32
) -> Result<(), Error>

Save last stored child index of a given parent

fn save_last_confirmed_height(
    &mut self,
    parent_key_id: &Identifier,
    height: u64
) -> Result<(), Error>

Save last confirmed height of outputs for a given parent

fn next_tx_log_id(&mut self, parent_key_id: &Identifier) -> Result<u32, Error>

get next tx log entry for the parent

fn tx_log_iter(&self) -> Box<dyn Iterator<Item = TxLogEntry>>

Iterate over tx log data stored by the backend

fn save_tx_log_entry(
    &mut self,
    t: TxLogEntry,
    parent_id: &Identifier
) -> Result<(), Error>

save a tx log entry

fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error>

save an account label -> path mapping

fn acct_path_iter(&self) -> Box<dyn Iterator<Item = AcctPathMapping>>

Iterate over account names stored in backend

fn lock_output(&mut self, out: &mut OutputData) -> Result<(), Error>

Save an output as locked in the backend

fn save_private_context(
    &mut self,
    slate_id: &[u8],
    participant_id: usize,
    ctx: &Context
) -> Result<(), Error>

Saves the private context associated with a slate id

fn delete_private_context(
    &mut self,
    slate_id: &[u8],
    participant_id: usize
) -> Result<(), Error>

Delete the private context associated with the slate id

fn commit(&self) -> Result<(), Error>

Write the wallet data to backend file

Loading content...

Implementors

Loading content...