[][src]Trait libanu::pristine::MutTxnT

pub trait MutTxnT: TxnT {
    fn open_or_create_channel(
        &mut self,
        name: &str
    ) -> Result<ChannelRef<Self>, Error>;
fn fork(
        &mut self,
        channel: &ChannelRef<Self>,
        name: &str
    ) -> Result<ChannelRef<Self>, Error>;
fn rename_channel(
        &mut self,
        channel: &mut ChannelRef<Self>,
        name: &str
    ) -> Result<(), Error>;
fn drop_channel(&mut self, name: &str) -> Result<bool, Error>;
fn commit(self) -> Result<(), Error>;
fn open_or_create_remote(
        &mut self,
        name: &str
    ) -> Result<RemoteRef<Self>, Error>;
fn put_remote(
        &mut self,
        remote: &mut RemoteRef<Self>,
        k: u64,
        v: (Hash, Merkle)
    ) -> Result<bool, Error>;
fn del_remote(
        &mut self,
        remote: &mut RemoteRef<Self>,
        k: u64
    ) -> Result<bool, Error>;
fn drop_remote(&mut self, remote: RemoteRef<Self>) -> Result<bool, Error>;
fn drop_named_remote(&mut self, remote: &str) -> Result<bool, Error>; }

The trait of immutable transactions.

Required methods

fn open_or_create_channel(
    &mut self,
    name: &str
) -> Result<ChannelRef<Self>, Error>

Open a channel, creating it if it is missing. The return type is a Rc<RefCell<…>> in order to avoid:

  • opening the same channel twice. Since a channel contains pointers, that could potentially lead to double-borrow issues. We absolutely have to check that at runtime (hence the RefCell).
  • writing the channel to disk (if the backend is written on the disk) for every minor operation on the channel.

Additionally, the Rc is used to:

  • avoid having to commit channels explicitly (channels are committed automatically upon committing the transaction), and
  • to return a value that doesn't borrow the transaction, so that the channel can actually be used in a mutable transaction.

fn fork(
    &mut self,
    channel: &ChannelRef<Self>,
    name: &str
) -> Result<ChannelRef<Self>, Error>

fn rename_channel(
    &mut self,
    channel: &mut ChannelRef<Self>,
    name: &str
) -> Result<(), Error>

fn drop_channel(&mut self, name: &str) -> Result<bool, Error>

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

Commit this transaction.

fn open_or_create_remote(
    &mut self,
    name: &str
) -> Result<RemoteRef<Self>, Error>

fn put_remote(
    &mut self,
    remote: &mut RemoteRef<Self>,
    k: u64,
    v: (Hash, Merkle)
) -> Result<bool, Error>

fn del_remote(
    &mut self,
    remote: &mut RemoteRef<Self>,
    k: u64
) -> Result<bool, Error>

fn drop_remote(&mut self, remote: RemoteRef<Self>) -> Result<bool, Error>

fn drop_named_remote(&mut self, remote: &str) -> Result<bool, Error>

Loading content...

Implementors

impl MutTxnT for MutTxn<()>[src]

Loading content...