Trait libpijul::pristine::MutTxnT[][src]

pub trait MutTxnT: GraphMutTxnT + ChannelMutTxnT + DepsMutTxnT<DepsError = <Self as GraphTxnT>::GraphError> + TreeMutTxnT<TreeError = <Self as GraphTxnT>::GraphError> + TxnT {
    fn open_or_create_channel(
        &mut self,
        name: &str
    ) -> Result<ChannelRef<Self>, Self::GraphError>;
fn fork(
        &mut self,
        channel: &ChannelRef<Self>,
        name: &str
    ) -> Result<ChannelRef<Self>, ForkError<Self::GraphError>>;
fn rename_channel(
        &mut self,
        channel: &mut ChannelRef<Self>,
        name: &str
    ) -> Result<(), ForkError<Self::GraphError>>;
fn drop_channel(&mut self, name: &str) -> Result<bool, Self::GraphError>;
fn commit(self) -> Result<(), Self::GraphError>;
fn open_or_create_remote(
        &mut self,
        id: RemoteId,
        path: &str
    ) -> Result<RemoteRef<Self>, Self::GraphError>;
fn put_remote(
        &mut self,
        remote: &mut RemoteRef<Self>,
        k: u64,
        v: (Hash, Merkle)
    ) -> Result<bool, Self::GraphError>;
fn del_remote(
        &mut self,
        remote: &mut RemoteRef<Self>,
        k: u64
    ) -> Result<bool, Self::GraphError>;
fn drop_remote(
        &mut self,
        remote: RemoteRef<Self>
    ) -> Result<bool, Self::GraphError>;
fn drop_named_remote(
        &mut self,
        id: RemoteId
    ) -> Result<bool, Self::GraphError>;
fn set_current_channel(&mut self, cur: &str) -> Result<(), Self::GraphError>; }
Expand description

The trait of immutable transactions.

Required methods

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.

Commit this transaction.

Implementors