Type Definition libpijul::MutTxn
[−]
[src]
type MutTxn<'env, R> = GenericTxn<MutTxn<'env, ()>, R>;
A mutable transaction on a repository.
Methods
impl<'env, R: Rng> MutTxn<'env, R>[src]
Branches and commits.
fn open_branch<'name>(&mut self, name: &str) -> Result<Branch>[src]
Open a branch by name, creating an empty branch with that name if the name doesn't exist.
fn commit_branch(&mut self, branch: Branch) -> Result<()>[src]
Commit a branch. This is a extremely important thing to do on branches, and it is not done automatically when committing transactions.
I repeat: not calling this method before committing a transaction might cause database corruption.
fn rename_branch(&mut self, branch: &mut Branch, new_name: &str) -> Result<()>[src]
Rename a branch. The branch still needs to be committed after this operation.
fn commit(self) -> Result<()>[src]
Commit a transaction. Be careful to commit all open branches before.
impl<'env, R: Rng> MutTxn<'env, R>[src]
Low-level operations on mutable transactions.
fn drop_branch(&mut self, branch: &str) -> Result<bool>[src]
Delete a branch, destroying its associated graph and patch set.
fn put_nodes(
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
edge: &Edge
) -> Result<bool>[src]
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
edge: &Edge
) -> Result<bool>
Add a binding to the graph of a branch. All edges must be inserted twice, once in each direction, and this method only inserts one direction.
fn del_nodes(
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
edge: Option<&Edge>
) -> Result<bool>[src]
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
edge: Option<&Edge>
) -> Result<bool>
Delete a binding from a graph. If edge is None, delete the
smallest binding with key at least key.
fn put_tree(&mut self, key: &FileId, edge: &Inode) -> Result<bool>[src]
Add a file or directory into the tree database, with parent
key.parent_inode, name key.basename and inode Inode
(usually randomly generated, as Inodes have no relation
with patches or branches).
All bindings inserted here must have the reverse inserted into
the revtree database. If (key, edge) is inserted here, then
(edge, key) must be inserted into revtree.
fn del_tree(&mut self, key: &FileId, edge: Option<&Inode>) -> Result<bool>[src]
Delete a file or directory from the tree database. Similarly
to the comments in the documentation of the put_tree method,
the reverse binding must be delete from the revtree database.
fn put_revtree(&mut self, key: &Inode, value: &FileId) -> Result<bool>[src]
Add a file into the revtree database (see the documentation of
the put_tree method).
fn del_revtree(&mut self, key: &Inode, value: Option<&FileId>) -> Result<bool>[src]
Delete a file from the revtree database (see the documentation
of the put_tree method).
fn del_inodes(
&mut self,
key: &Inode,
value: Option<&FileHeader>
) -> Result<bool>[src]
&mut self,
key: &Inode,
value: Option<&FileHeader>
) -> Result<bool>
Delete a binding from the inodes database, i.e. the
correspondence between branch graphs and the file tree.
All bindings in inodes must have their reverse in revinodes
(without the FileMetadata). del_revinodes must be called
immediately before or immediately after calling this method.
fn replace_inodes(&mut self, key: &Inode, value: &FileHeader) -> Result<bool>[src]
Replace a binding in the inodes database, or insert a new
one if key doesn't exist yet in that database.
All bindings in inodes must have their reverse inserted in
revinodes (without the FileMetadata).
fn replace_revinodes(
&mut self,
key: &Key<PatchId>,
value: &Inode
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
value: &Inode
) -> Result<bool>
Replace a binding in the revinodes database, or insert a new
one if key doesnt exist yet in that database.
All bindings in revinodes must have their reverse inserted
inodes (with an extra FileMetadata).
fn del_revinodes(
&mut self,
key: &Key<PatchId>,
value: Option<&Inode>
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
value: Option<&Inode>
) -> Result<bool>
Delete a binding from the revinodes database, i.e. the
correspondence between the file tree and branch graphs.
All bindings in revinodes must have their reverse in inodes
(with an extra FileMetadata). del_inodes must be called
immediately before or immediately after calling this method.
fn put_contents(
&mut self,
key: &Key<PatchId>,
value: UnsafeValue
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
value: UnsafeValue
) -> Result<bool>
Add the contents of a line. Note that this table is common to all branches.
fn del_contents(
&mut self,
key: &Key<PatchId>,
value: Option<UnsafeValue>
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
value: Option<UnsafeValue>
) -> Result<bool>
Remove the contents of a line.
fn put_internal(&mut self, key: HashRef, value: &PatchId) -> Result<bool>[src]
Register the internal identifier of a patch. The
put_external method must be called immediately after, or
immediately before this method.
fn del_internal(&mut self, key: HashRef) -> Result<bool>[src]
Unregister the internal identifier of a patch. Remember to also unregister its external id.
fn put_external(&mut self, key: &PatchId, value: HashRef) -> Result<bool>[src]
Register the extern identifier of a patch. The put_internal
method must be called immediately after, or immediately before
this method.
fn del_external(&mut self, key: &PatchId) -> Result<bool>[src]
Unregister the extern identifier of a patch. Remember to also unregister its internal id.
fn put_patches(
&mut self,
branch: &mut Db<UnsafePatchId, ApplyTimestamp>,
value: &PatchId,
time: ApplyTimestamp
) -> Result<bool>[src]
&mut self,
branch: &mut Db<UnsafePatchId, ApplyTimestamp>,
value: &PatchId,
time: ApplyTimestamp
) -> Result<bool>
Add a patch id to a branch. This doesn't apply the patch, it
only registers it as applied. The put_revpatches method must be
called on the same branch immediately before, or immediately
after.
fn del_patches(
&mut self,
branch: &mut Db<UnsafePatchId, ApplyTimestamp>,
value: &PatchId
) -> Result<bool>[src]
&mut self,
branch: &mut Db<UnsafePatchId, ApplyTimestamp>,
value: &PatchId
) -> Result<bool>
Delete a patch id from a branch. This doesn't unrecord the
patch, it only removes it from the patch set. The
del_revpatches method must be called on the same branch
immediately before, or immediately after.
fn put_revpatches(
&mut self,
branch: &mut Db<ApplyTimestamp, UnsafePatchId>,
time: ApplyTimestamp,
value: &PatchId
) -> Result<bool>[src]
&mut self,
branch: &mut Db<ApplyTimestamp, UnsafePatchId>,
time: ApplyTimestamp,
value: &PatchId
) -> Result<bool>
Add a patch id to a branch. This doesn't apply the patch, it
only registers it as applied. The put_patches method must be
called on the same branch immediately before, or immediately
after.
fn del_revpatches(
&mut self,
revbranch: &mut Db<ApplyTimestamp, UnsafePatchId>,
timestamp: ApplyTimestamp,
value: &PatchId
) -> Result<bool>[src]
&mut self,
revbranch: &mut Db<ApplyTimestamp, UnsafePatchId>,
timestamp: ApplyTimestamp,
value: &PatchId
) -> Result<bool>
Delete a patch id from a branch. This doesn't unrecord the
patch, it only removes it from the patch set. The
del_patches method must be called on the same branch
immediately before, or immediately after.
fn put_revdep(&mut self, patch: &PatchId, revdep: &PatchId) -> Result<bool>[src]
Register a reverse dependency. All dependencies of all patches
applied on at least one branch must be registered in this
database, i.e. if a depends on b, then (b, a) must be
inserted here.
fn del_revdep(
&mut self,
patch: &PatchId,
revdep: Option<&PatchId>
) -> Result<bool>[src]
&mut self,
patch: &PatchId,
revdep: Option<&PatchId>
) -> Result<bool>
Remove a reverse dependency. Only call this method when the
patch with identifier patch is not applied to any branch.
fn put_cementery(
&mut self,
key: &Key<PatchId>,
edge: &Edge,
patch: &PatchId
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
edge: &Edge,
patch: &PatchId
) -> Result<bool>
Add an edge to the cementery.
fn del_cementery(
&mut self,
key: &Key<PatchId>,
edge: &Edge,
patch: &PatchId
) -> Result<bool>[src]
&mut self,
key: &Key<PatchId>,
edge: &Edge,
patch: &PatchId
) -> Result<bool>
Delete an edge from the cementery.
fn alloc_value(&mut self, slice: &[u8]) -> Result<UnsafeValue>[src]
Allocate a string (to be inserted in the contents database).
impl<'env, R: Rng> MutTxn<'env, R>[src]
fn create_new_inode(&self) -> Inode[src]
Create an inode that doesn't exist in the repository, but doesn't put it into the repository.
fn add_inode(
&mut self,
inode: Option<&Inode>,
path: &Path,
is_dir: bool
) -> Result<()>[src]
&mut self,
inode: Option<&Inode>,
path: &Path,
is_dir: bool
) -> Result<()>
fn move_file(&mut self, path: &Path, path_: &Path, is_dir: bool) -> Result<()>[src]
fn rec_delete(&mut self, key: &Inode) -> Result<()>[src]
fn remove_file(&mut self, path: &Path) -> Result<()>[src]
Removes a file from the repository.
impl<'env, A: Rng> MutTxn<'env, A>[src]
fn remove_redundant_edges(
&mut self,
branch: &mut Branch,
forward: &Vec<(Key<PatchId>, Edge)>
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
forward: &Vec<(Key<PatchId>, Edge)>
) -> Result<()>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn record(
&mut self,
branch_name: &str,
working_copy: &Path,
prefix: Option<&Path>
) -> Result<(Vec<Record>, Vec<InodeUpdate>)>[src]
&mut self,
branch_name: &str,
working_copy: &Path,
prefix: Option<&Path>
) -> Result<(Vec<Record>, Vec<InodeUpdate>)>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn reconnect_parents_children(
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
parents: &[Key<PatchId>],
children: &[Edge]
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
parents: &[Key<PatchId>],
children: &[Edge]
) -> Result<()>
Add pseudo edges from all keys of parents to all dest of
the edges in children, with the same edge flags as in
children, plus PSEUDO_EDGE.
fn apply_patches<F>(
&mut self,
branch_name: &str,
r: &Path,
remote_patches: &Vec<(Hash, Patch)>,
f: F
) -> Result<()> where
F: FnMut(usize, &Hash), [src]
&mut self,
branch_name: &str,
r: &Path,
remote_patches: &Vec<(Hash, Patch)>,
f: F
) -> Result<()> where
F: FnMut(usize, &Hash),
Assumes all patches have been downloaded. The third argument
remote_patches needs to contain at least all the patches we want
to apply, and the fourth one local_patches at least all the patches the other
party doesn't have.
fn apply_patches_rec(
&mut self,
branch: &mut Branch,
patches: &[(Hash, Patch)],
patch_hash: &Hash,
patch: &Patch,
new_patches_count: &mut usize
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
patches: &[(Hash, Patch)],
patch_hash: &Hash,
patch: &Patch,
new_patches_count: &mut usize
) -> Result<()>
Lower-level applier. This function only applies patches as
found in patches_dir, following dependencies recursively. It
outputs neither the repository nor the "changes file" of the
branch, necessary to exchange patches locally or over HTTP.
fn apply_local_patch(
&mut self,
branch_name: &str,
working_copy: &Path,
hash: &Hash,
patch: &Patch,
inode_updates: &[InodeUpdate],
is_pending: bool
) -> Result<PatchId>[src]
&mut self,
branch_name: &str,
working_copy: &Path,
hash: &Hash,
patch: &Patch,
inode_updates: &[InodeUpdate],
is_pending: bool
) -> Result<PatchId>
Apply a patch from a local record: register it, give it a hash, and then apply.
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn follow_path(&self, path: &[&str]) -> Result<Option<Inode>>[src]
Returns the path's inode
fn collect_children(
&mut self,
branch: &Branch,
path: &Path,
key: &Key<PatchId>,
inode: &Inode,
files: &mut HashMap<PathBuf, Vec<(Inode, FileMetadata, Key<PatchId>, Option<Inode>)>>
) -> Result<()>[src]
&mut self,
branch: &Branch,
path: &Path,
key: &Key<PatchId>,
inode: &Inode,
files: &mut HashMap<PathBuf, Vec<(Inode, FileMetadata, Key<PatchId>, Option<Inode>)>>
) -> Result<()>
Collect all the children of key key into files.
fn list_conflict_files(
&mut self,
branch_name: &str,
working_copy: &Path
) -> Result<Vec<PathBuf>>[src]
&mut self,
branch_name: &str,
working_copy: &Path
) -> Result<Vec<PathBuf>>
Collect names of files with conflicts
As conflicts have an internal representation, it can be determined exactly which files contain conflicts.
fn output_repository(
&mut self,
branch_name: &str,
working_copy: &Path,
pending: &Patch,
local_pending: &[InodeUpdate]
) -> Result<()>[src]
&mut self,
branch_name: &str,
working_copy: &Path,
pending: &Patch,
local_pending: &[InodeUpdate]
) -> Result<()>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn unrecord_nodes(
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
up_context: &[Key<Option<Hash>>],
down_context: &[Key<Option<Hash>>],
line_num: LineId,
flag: EdgeFlags,
nodes: &[Vec<u8>],
w: &mut Workspace,
unused_in_other_branch: bool
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
up_context: &[Key<Option<Hash>>],
down_context: &[Key<Option<Hash>>],
line_num: LineId,
flag: EdgeFlags,
nodes: &[Vec<u8>],
w: &mut Workspace,
unused_in_other_branch: bool
) -> Result<()>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn unrecord_edges(
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
op: EdgeOp,
edges: &[NewEdge],
w: &mut Workspace,
unused_in_other_branches: bool
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
op: EdgeOp,
edges: &[NewEdge],
w: &mut Workspace,
unused_in_other_branches: bool
) -> Result<()>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn collect_up_context_repair(
&self,
branch: &Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
)[src]
&self,
branch: &Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
)
fn collect_down_context_repair(
&self,
branch: &Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
)[src]
&self,
branch: &Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
)
fn remove_up_context_repair(
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
) -> Result<()>
fn remove_down_context_repair(
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
key: &Key<PatchId>,
patch_id: &PatchId,
edges: &mut HashMap<Key<PatchId>, Edge>
) -> Result<()>
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn unrecord(
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
patch: &Patch
) -> Result<bool>[src]
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
patch: &Patch
) -> Result<bool>
fn unapply(
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
patch: &Patch,
unused_in_other_branch: bool
) -> Result<()>[src]
&mut self,
branch: &mut Branch,
patch_id: &PatchId,
patch: &Patch,
unused_in_other_branch: bool
) -> Result<()>
Unrecord the patch, returning true if and only if another branch still uses this patch.
impl<'env, T: Rng> MutTxn<'env, T>[src]
fn output_changes_file<P: AsRef<Path>>(
&mut self,
branch: &Branch,
path: P
) -> Result<()>[src]
&mut self,
branch: &Branch,
path: P
) -> Result<()>
fn branch_patches(&mut self, branch: &Branch) -> HashSet<(Hash, ApplyTimestamp)>[src]
fn fork(&mut self, branch: &Branch, new_name: &str) -> Result<Branch>[src]
fn add_file<P: AsRef<Path>>(&mut self, path: P, is_dir: bool) -> Result<()>[src]
fn file_nodes_fold<A, F: FnMut(A, &Key<PatchId>) -> A>(
&self,
branch: &Branch,
init: A,
f: F
) -> Result<A>[src]
&self,
branch: &Branch,
init: A,
f: F
) -> Result<A>