Struct GenericTxn

Source
pub struct GenericTxn<T, R> { /* private fields */ }
Expand description

Common type for both mutable transactions (MutTxn) and immutable transaction (Txn). All of Txn’s methods are also MutTxn’s methods.

Implementations§

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source

pub fn dump(&self)

Source§

impl<'env, R: Rng> GenericTxn<MutTxn<'env, ()>, R>

Branches and commits.

Source

pub fn open_branch<'name>(&mut self, name: &str) -> Result<Branch>

Open a branch by name, creating an empty branch with that name if the name doesn’t exist.

Source

pub fn commit_branch(&mut self, branch: Branch) -> Result<()>

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.

Source

pub fn rename_branch( &mut self, branch: &mut Branch, new_name: &str, ) -> Result<()>

Rename a branch. The branch still needs to be committed after this operation.

Source

pub fn commit(self) -> Result<()>

Commit a transaction. Be careful to commit all open branches before.

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source

pub fn has_branch(&self, name: &str) -> bool

Does this repository has a branch called name?

Source

pub fn get_branch<'name>(&self, name: &str) -> Option<Branch>

Get the branch with the given name, if it exists.

Source

pub fn get_nodes<'a>( &'a self, branch: &Branch, key: Key<PatchId>, edge: Option<&Edge>, ) -> Option<&'a Edge>

Return the first edge of this key if edge is None, and a pointer to the edge in the database if edge is Some.

Source

pub fn iter_nodes<'a>( &'a self, branch: &'a Branch, key: Option<(Key<PatchId>, Option<&Edge>)>, ) -> NodesIterator<'a, U>

An iterator over keys and edges, in branch branch, starting from key and edge specified by key. If key is None, the iterations start from the first key and first edge. If key is of the form Some(a, None), they start from the first edge of key a. If key is of the from Some(a, Some(b)), they start from the first key and edge that is at least (a, b).

Source

pub fn iter_parents<'a>( &'a self, branch: &'a Branch, key: Key<PatchId>, flag: EdgeFlags, ) -> ParentsIterator<'a, U>

Source

pub fn iter_branches<'a>( &'a self, key: Option<&SmallStr<'_>>, ) -> BranchIterator<'a, U>

An iterator over branches in the database, starting from the given branch name.

Source

pub fn iter_partials<'a>(&'a self, branch: &str) -> PartialsIterator<'a, U>

An iterator over branches in the database, starting from the given branch name.

Source

pub fn iter_patches<'a>( &'a self, branch: &'a Branch, key: Option<PatchId>, ) -> PatchesIterator<'a, U>

An iterator over patches in a branch, in the alphabetical order of their hash.

Source

pub fn rev_iter_applied<'a>( &'a self, branch: &'a Branch, key: Option<ApplyTimestamp>, ) -> RevAppliedIterator<'a, U>

An iterator over patches in a branch, in the reverse order in which they were applied.

Source

pub fn iter_applied<'a>( &'a self, branch: &'a Branch, key: Option<ApplyTimestamp>, ) -> AppliedIterator<'a, U>

An iterator over patches in a branch in the order in which they were applied.

Source

pub fn iter_tree<'a>( &'a self, key: Option<(&FileId<'_>, Option<Inode>)>, ) -> TreeIterator<'a, U>

An iterator over files and directories currently tracked by Pijul, starting from the given FileId. The Inodes returned by the iterator can be used to form new FileIds and traverse the tree from top to bottom.

The set of tracked files is changed by the following operations: outputting the repository, adding, deleting and moving files. It is not related to branches, but only to the files actually present on the file system.

Source

pub fn iter_revtree<'a>( &'a self, key: Option<(Inode, Option<&FileId<'_>>)>, ) -> RevtreeIterator<'a, U>

An iterator over files and directories, following directories in the opposite direction.

Source

pub fn iter_inodes<'a>( &'a self, key: Option<(Inode, Option<FileHeader>)>, ) -> InodesIterator<'a, U>

An iterator over the “inodes” database, which contains correspondences between files on the filesystem and the files in the graph.

Source

pub fn iter_external<'a>( &'a self, key: Option<(PatchId, Option<HashRef<'_>>)>, ) -> ExternalIterator<'a, U>

Iterator over the PatchId to Hash correspondence.

Source

pub fn iter_internal<'a>( &'a self, key: Option<(HashRef<'_>, Option<PatchId>)>, ) -> InternalIterator<'a, U>

Iterator over the Hash to PatchId correspondence.

Source

pub fn iter_revdep<'a>( &'a self, key: Option<(PatchId, Option<PatchId>)>, ) -> RevdepIterator<'a, U>

Iterator over reverse dependencies ((k, v) is in the reverse dependency table if v depends on k, and both are in at least one branch).

Source

pub fn iter_dep<'a>( &'a self, key: Option<(PatchId, Option<PatchId>)>, ) -> DepIterator<'a, U>

Iterator over dependencies.

Source

pub fn iter_contents<'a>( &'a self, key: Option<Key<PatchId>>, ) -> ContentsIterator<'a, U>

An iterator over line contents (common to all branches).

Source

pub fn iter_cemetery<'a>( &'a self, key: Key<PatchId>, edge: Edge, ) -> CemeteryIterator<'a, U>

An iterator over edges in the cemetery.

Source

pub fn iter_touched<'a>(&'a self, key: Key<PatchId>) -> TouchedIterator<'a, U>

An iterator over patches that touch a certain file.

Source

pub fn get_touched<'a>(&'a self, key: Key<PatchId>, patch: PatchId) -> bool

Tell whether a patch touches a file

Source

pub fn get_tree<'a>(&'a self, key: &FileId<'_>) -> Option<Inode>

Get the Inode of a give FileId. A FileId is itself composed of an inode and a name, hence this can be used to traverse the tree of tracked files from top to bottom.

Source

pub fn get_revtree<'a>(&'a self, key: Inode) -> Option<FileId<'a>>

Get the parent FileId of a given Inode. A FileId is itself composed of an Inode and a name, so this can be used to traverse the tree of tracked files from bottom to top (starting from a leaf).

Source

pub fn get_inodes<'a>(&'a self, key: Inode) -> Option<FileHeader>

Get the key in branches for the given Inode, as well as meta-information on the file (permissions, and whether it has been moved or deleted compared to the branch).

This table is updated every time the repository is output, and when files are moved or deleted. It is meant to be synchronised with the current branch (if any).

Source

pub fn get_revinodes(&self, key: Key<PatchId>) -> Option<Inode>

Get the Inode corresponding to key in branches (see the documentation for get_inodes).

Source

pub fn get_contents<'a>(&'a self, key: Key<PatchId>) -> Option<Value<'a, U>>

Get the contents of a line.

Source

pub fn get_internal(&self, key: HashRef<'_>) -> Option<PatchId>

Get the PatchId (or internal patch identifier) of the provided patch hash.

Source

pub fn get_external<'a>(&'a self, key: PatchId) -> Option<HashRef<'a>>

Get the HashRef (external patch identifier) of the provided internal patch identifier.

Source

pub fn get_patch( &self, patch_set: &Db<PatchId, ApplyTimestamp>, patchid: PatchId, ) -> Option<ApplyTimestamp>

Get the patch number in the branch. Patch numbers are guaranteed to always increase when a new patch is applied, but are not necessarily consecutive.

Source

pub fn get_revdep( &self, patch: PatchId, dep: Option<PatchId>, ) -> Option<PatchId>

Get the smallest patch id that depends on patch (and is at least dep in alphabetical order if dep, is Some).

Source

pub fn get_dep(&self, patch: PatchId, dep: Option<PatchId>) -> Option<PatchId>

Get the smallest patch id that patch depends on (and is at least dep in alphabetical order if dep, is Some).

Source

pub fn debug<W>(&self, branch_name: &str, w: &mut W, exclude_parents: bool)
where W: Write,

Dump the graph of a branch into a writer, in dot format.

Source

pub fn debug_folders<W>(&self, branch_name: &str, w: &mut W)
where W: Write,

Dump the graph of a branch into a writer, in dot format.

Source

pub fn is_connected( &self, branch: &Branch, a: Key<PatchId>, b: Key<PatchId>, ) -> bool

Is there an alive/pseudo edge from a to b.

Source

pub fn test_edge( &self, branch: &Branch, a: Key<PatchId>, b: Key<PatchId>, min: EdgeFlags, max: EdgeFlags, ) -> bool

Is there an alive/pseudo edge from a to b.

Source§

impl<'env, R: Rng> GenericTxn<MutTxn<'env, ()>, R>

Low-level operations on mutable transactions.

Source

pub fn drop_branch(&mut self, branch: &str) -> Result<bool>

Delete a branch, destroying its associated graph and patch set.

Source

pub fn put_nodes( &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.

Source

pub fn put_nodes_with_rev( &mut self, branch: &mut Branch, key: Key<PatchId>, edge: Edge, ) -> Result<bool>

Same as put_nodes, but also adds the reverse edge.

Source

pub fn del_nodes( &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.

Source

pub fn del_nodes_with_rev( &mut self, branch: &mut Branch, key: Key<PatchId>, edge: Edge, ) -> Result<bool>

Same as del_nodes, but also deletes the reverse edge.

Source

pub fn put_tree(&mut self, key: &FileId<'_>, edge: Inode) -> Result<bool>

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.

Source

pub fn del_tree( &mut self, key: &FileId<'_>, edge: Option<Inode>, ) -> Result<bool>

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.

Source

pub fn put_revtree(&mut self, key: Inode, value: &FileId<'_>) -> Result<bool>

Add a file into the revtree database (see the documentation of the put_tree method).

Source

pub fn del_revtree( &mut self, key: Inode, value: Option<&FileId<'_>>, ) -> Result<bool>

Delete a file from the revtree database (see the documentation of the put_tree method).

Source

pub fn del_inodes( &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.

Source

pub fn replace_inodes(&mut self, key: Inode, value: FileHeader) -> Result<bool>

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).

Source

pub fn replace_revinodes( &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).

Source

pub fn del_revinodes( &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.

Source

pub fn put_contents( &mut self, key: Key<PatchId>, value: UnsafeValue, ) -> Result<bool>

Add the contents of a line. Note that this table is common to all branches.

Source

pub fn del_contents( &mut self, key: Key<PatchId>, value: Option<UnsafeValue>, ) -> Result<bool>

Remove the contents of a line.

Source

pub fn put_internal(&mut self, key: HashRef<'_>, value: PatchId) -> Result<bool>

Register the internal identifier of a patch. The put_external method must be called immediately after, or immediately before this method.

Source

pub fn del_internal(&mut self, key: HashRef<'_>) -> Result<bool>

Unregister the internal identifier of a patch. Remember to also unregister its external id.

Source

pub fn put_external(&mut self, key: PatchId, value: HashRef<'_>) -> Result<bool>

Register the extern identifier of a patch. The put_internal method must be called immediately after, or immediately before this method.

Source

pub fn del_external(&mut self, key: PatchId) -> Result<bool>

Unregister the extern identifier of a patch. Remember to also unregister its internal id.

Source

pub fn put_patches( &mut self, branch: &mut Db<PatchId, 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.

Source

pub fn del_patches( &mut self, branch: &mut Db<PatchId, 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.

Source

pub fn put_revpatches( &mut self, branch: &mut Db<ApplyTimestamp, PatchId>, 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.

Source

pub fn del_revpatches( &mut self, revbranch: &mut Db<ApplyTimestamp, PatchId>, 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.

Source

pub fn put_revdep(&mut self, patch: PatchId, revdep: PatchId) -> Result<bool>

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.

Source

pub fn put_dep(&mut self, patch: PatchId, dep: PatchId) -> Result<bool>

Register a 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.

Source

pub fn del_revdep( &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.

Source

pub fn del_dep(&mut self, patch: PatchId, dep: Option<PatchId>) -> Result<bool>

Remove a dependency. Only call this method when the patch with identifier patch is not applied to any branch.

Source

pub fn put_cemetery( &mut self, key: Key<PatchId>, edge: &Edge, patch: PatchId, ) -> Result<bool>

Add an edge to the cemetery.

Source

pub fn del_cemetery( &mut self, key: Key<PatchId>, edge: &Edge, patch: PatchId, ) -> Result<bool>

Delete an edge from the cemetery.

Source

pub fn put_touched_file( &mut self, file: Key<PatchId>, patch: PatchId, ) -> Result<bool>

Add the relation “patch patch touches file file”.

Source

pub fn del_touched_file( &mut self, file: Key<PatchId>, patch: PatchId, ) -> Result<bool>

Delete all mentions of patch in the table of touched files.

Source

pub fn put_partials(&mut self, name: &str, path: Key<PatchId>) -> Result<bool>

Add a partial path to a branch.

Source

pub fn del_partials(&mut self, name: &str) -> Result<bool>

Remove a partial path from a branch.

Source

pub fn alloc_value(&mut self, slice: &[u8]) -> Result<UnsafeValue>

Allocate a string (to be inserted in the contents database).

Source§

impl<'env, R: Rng> GenericTxn<MutTxn<'env, ()>, R>

Source

pub fn mark_inode_moved(&mut self, inode: Inode)

Source

pub fn create_new_inode(&self) -> Inode

Create an inode that doesn’t exist in the repository, but doesn’t put it into the repository.

Source

pub fn add_inode( &mut self, inode: Option<Inode>, path: &Path, is_dir: bool, ) -> Result<()>

Source

pub fn inode_is_ancestor_of(&self, a: Inode, b: Inode) -> bool

Source

pub fn move_file( &mut self, path: &Path, path_: &Path, is_dir: bool, ) -> Result<()>

Source

pub fn rec_delete(&mut self, key: Inode) -> Result<bool>

Source

pub fn remove_file(&mut self, path: &Path) -> Result<()>

Removes a file from the repository.

Source§

impl<A: Transaction, R> GenericTxn<A, R>

Source

pub fn list_files(&self, inode: Inode) -> Result<Vec<PathBuf>>

Returns a vector containing all files in the repository.

Source

pub fn list_files_under_inode( &self, inode: Inode, ) -> Vec<(SmallString, Option<Key<PatchId>>, Inode)>

Returns a list of files under the given inode.

Source

pub fn list_files_under_node( &self, branch: &Branch, key: Key<PatchId>, ) -> BTreeMap<Key<PatchId>, Vec<(FileMetadata, &str)>>

Returns a list of files under the given inode.

Source

pub fn is_directory(&self, inode: &Inode) -> bool

Source

pub fn find_inode(&self, path: &Path) -> Result<Inode>

Find the inode corresponding to that path, or return an error if there’s no such inode.

Source

pub fn file_names( &self, branch: &Branch, key: Key<PatchId>, ) -> Vec<(Key<PatchId>, FileMetadata, &str)>

Source

pub fn prefix_keys( &self, branch: &Branch, path: &str, ) -> Result<Vec<Key<PatchId>>>

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source

pub fn new_patch<I: Iterator<Item = Hash>>( &self, branch: &Branch, authors: Vec<String>, name: String, description: Option<String>, timestamp: DateTime<Utc>, changes: Vec<Change<ChangeContext<Hash>>>, extra_dependencies: I, flag: PatchFlags, ) -> Patch

Source

pub fn dependencies<'a, I: Iterator<Item = &'a Change<ChangeContext<Hash>>>>( &self, branch: &Branch, changes: I, ) -> HashSet<Hash>

Source

pub fn minimize_deps(&self, deps: &HashSet<Hash>) -> HashSet<Hash>

Source§

impl<A: Transaction, R> GenericTxn<A, R>

Source

pub fn external_key(&self, key: &Key<PatchId>) -> Option<Key<Option<Hash>>>

Gets the external key corresponding to the given key, returning an owned vector. If the key is just a patch internal hash, it returns the corresponding external hash.

Source

pub fn external_hash(&self, key: PatchId) -> HashRef<'_>

Source

pub fn new_internal(&self, ext: HashRef<'_>) -> PatchId

Create a new internal patch id, register it in the “external” and “internal” bases, and write the result in its second argument (“result”).

Source§

impl<A: Transaction, R> GenericTxn<A, R>

Source

pub fn retrieve<'a>(&'a self, branch: &Branch, key0: Key<PatchId>) -> Graph

This function constructs a graph by reading the branch from the input key. It guarantees that all nodes but the first one (index 0) have a common descendant, which is index 0.

Source§

impl<'a, A: Transaction + 'a, R> GenericTxn<A, R>

Source

pub fn output_file<B: LineBuffer<'a, A>>( &'a self, branch: &Branch, buf: &mut B, graph: &mut Graph, forward: &mut Vec<(Key<PatchId>, Edge)>, ) -> Result<bool>

Source§

impl<'env, R: Rng> GenericTxn<MutTxn<'env, ()>, R>

Source

pub fn remove_redundant_edges( &mut self, branch: &mut Branch, forward: &[(Key<PatchId>, Edge)], ) -> Result<()>

Source§

impl<A: Transaction, R: Rng> GenericTxn<A, R>

Source

pub fn diff<'a>( &'a self, inode: Key<Option<Hash>>, branch: &'a Branch, file: Rc<PathBuf>, line_num: &mut LineId, actions: &mut Vec<Record<Rc<RefCell<ChangeContext<PatchId>>>>>, redundant: &mut Vec<(Key<PatchId>, Edge)>, a: &mut Graph, lines_b: &[&[u8]], ) -> Result<()>

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn record( &mut self, state: &mut RecordState, branch: &Branch, working_copy: &Path, prefix: Option<&Path>, ) -> Result<()>

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn apply( &mut self, branch: &mut Branch, patch: &Patch, patch_id: PatchId, timestamp: ApplyTimestamp, ) -> Result<()>

Applies a patch to a repository. “new_patches” are patches that just this repository has, and the remote repository doesn’t have.

Source

pub fn reconnect_parents_children( &mut self, branch: &mut Branch, patch_id: PatchId, to: Key<PatchId>, parents: &mut HashSet<Key<PatchId>>, children: &mut HashSet<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.

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source

pub fn find_alive_ancestors( &self, find_alive: &mut FindAlive, branch: &Branch, alive: &mut Vec<Key<PatchId>>, file_ancestor: &mut Option<Key<PatchId>>, files: &mut Vec<(Key<PatchId>, Edge)>, ) -> bool

Recursively find all ancestors by doing a DFS, and collect all edges until finding an alive ancestor.

Returns whether or not at least one traversed vertex was dead (or otherwise said, returns false if and only if there all vertices in find_alive are alive).

Source

pub fn find_alive_descendants( &self, find_alive: &mut FindAlive, branch: &Branch, alive: &mut Vec<Key<PatchId>>, ) -> bool

Recursively find all descendants by doing a DFS on deleted edges (including folder edges), and collect all edges until finding an alive or zombie descendant.

Returns whether or not at least one traversed vertex was dead (or otherwise said, returns false if and only if there all vertices in find_alive are alive).

Source

pub fn find_alive_nonfolder_descendants( &self, branch: &Branch, find_alive: &mut FindAlive, alive: &mut HashSet<Key<PatchId>>, file: &mut Option<Key<PatchId>>, current: Key<PatchId>, )

Find the alive descendants of current. cache is here to avoid cycles, and alive is an accumulator of the result. Since this search stops at files, if the file containing these lines is ever hit, it will be put in file.

Source

pub fn find_alive_nonfolder_ancestors( &self, branch: &Branch, find_alive: &mut FindAlive, alive: &mut HashSet<Key<PatchId>>, file: &mut Option<Key<PatchId>>, current: Key<PatchId>, )

Find the alive ancestors of current. cache is here to avoid cycles, and alive is an accumulator of the result. Since this search stops at files, if the file containing these lines is ever hit, it will be put in file.

Source§

impl<U: Transaction, R> GenericTxn<U, R>

Source

pub fn internal_hash(&self, e: &Option<Hash>, internal: PatchId) -> PatchId

Return the patch id corresponding to e, or internal if e==None.

Source

pub fn internal_key( &self, key: &Key<Option<Hash>>, internal: PatchId, ) -> Key<PatchId>

Fetch the internal key for this external key (or internal if key.patch is None).

Source

pub fn internal_key_unwrap(&self, key: &Key<Option<Hash>>) -> Key<PatchId>

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn apply_patches<F, P: ToPrefixes>( &mut self, branch: &mut Branch, r: &Path, remote_patches: &[(Hash, Patch)], partial_paths: P, 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 repository doesn’t have.

Source

pub fn apply_patches_rec( &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.

Source

pub fn apply_local_patch( &mut self, branch: &mut Branch, working_copy: &Path, hash: &Hash, patch: &Patch, inode_updates: &HashSet<InodeUpdate>, is_pending: bool, ) -> Result<PatchId>

Apply a patch from a local record: register it, give it a hash, and then apply.

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn list_conflict_files( &mut self, branch_name: &str, prefixes: &[&str], ) -> Result<Vec<PathBuf>>

Collect names of files with conflicts

As conflicts have an internal representation, it can be determined exactly which files contain conflicts.

Source

pub fn output_repository( &mut self, branch: &mut Branch, working_copy: &Path, prefixes: &Prefixes, pending: &Patch, local_pending: &HashSet<InodeUpdate>, ) -> Result<()>

Source

pub fn output_repository_no_pending( &mut self, branch: &mut Branch, working_copy: &Path, prefixes: &Prefixes, ) -> Result<()>

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn remove_up_context_repair( &mut self, branch: &mut Branch, key: Key<PatchId>, patch_id: PatchId, edges: &mut HashMap<Key<PatchId>, Edge>, ) -> Result<()>

Source

pub fn remove_down_context_repair( &mut self, branch: &mut Branch, key: Key<PatchId>, patch_id: PatchId, edges: &mut HashMap<Key<PatchId>, Edge>, ) -> Result<()>

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn unrecord( &mut self, branch: &mut Branch, patch_id: PatchId, patch: &Patch, ) -> Result<bool>

Source

pub fn unapply( &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.

Source§

impl<'env, T: Rng> GenericTxn<MutTxn<'env, ()>, T>

Source

pub fn output_changes_file<P: AsRef<Path>>( &mut self, branch: &Branch, path: P, ) -> Result<()>

Source

pub fn branch_patches( &mut self, branch: &Branch, ) -> HashSet<(Hash, ApplyTimestamp)>

Source

pub fn fork(&mut self, branch: &Branch, new_name: &str) -> Result<Branch>

Source

pub fn add_file<P: AsRef<Path>>(&mut self, path: P, is_dir: bool) -> Result<()>

Source

pub fn file_nodes_fold<A, F: FnMut(A, Key<PatchId>) -> A>( &self, branch: &Branch, init: A, f: F, ) -> Result<A>

Source§

impl<T: Transaction, R> GenericTxn<T, R>

Source

pub fn is_alive(&self, branch: &Branch, key: Key<PatchId>) -> bool

Tells whether a key is alive in branch, i.e. is either the root, or all its ingoing edges are alive.

Source

pub fn is_alive_or_zombie(&self, branch: &Branch, key: Key<PatchId>) -> bool

Tells whether a key is alive or zombie in branch, i.e. is either the root, or has at least one of its incoming alive edge is alive.

Source

pub fn has_edge( &self, branch: &Branch, key: Key<PatchId>, min: EdgeFlags, max: EdgeFlags, ) -> bool

Test whether key has a neighbor with flag flag0. If include_pseudo, this includes pseudo-neighbors.

Source

pub fn get_file<'a>( &'a self, branch: &Branch, key: Key<PatchId>, ) -> Vec<Key<PatchId>>

Tells which paths (of folder nodes) a key is in.

Source

pub fn get_file_names<'a>( &'a self, branch: &Branch, key: Key<PatchId>, ) -> Vec<(Key<PatchId>, Vec<&'a str>)>

Auto Trait Implementations§

§

impl<T, R> Freeze for GenericTxn<T, R>
where T: Freeze, R: Freeze,

§

impl<T, R> RefUnwindSafe for GenericTxn<T, R>

§

impl<T, R> !Send for GenericTxn<T, R>

§

impl<T, R> !Sync for GenericTxn<T, R>

§

impl<T, R> Unpin for GenericTxn<T, R>
where T: Unpin, R: Unpin,

§

impl<T, R> UnwindSafe for GenericTxn<T, R>
where T: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.