Struct libpijul_compat::GenericTxn
[−]
[src]
pub struct GenericTxn<T, R> { /* fields omitted */ }
Common type for both mutable transactions (MutTxn
) and immutable
transaction (Txn
). All of Txn
's methods are also MutTxn
's
methods.
Methods
impl<U: Transaction, R> GenericTxn<U, R>
[src]
impl<U: Transaction, R> GenericTxn<U, R>
[src]
fn has_branch(&self, name: &str) -> bool
[src]
Does this repository has a branch called name
?
fn get_branch<'name>(&self, name: &str) -> Option<Branch>
[src]
Get the branch with the given name, if it exists.
fn get_nodes<'a>(
&'a self,
branch: &Branch,
key: &Key<PatchId>,
edge: Option<&Edge>
) -> Option<&'a Edge>
[src]
&'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
.
fn iter_nodes<'a>(
&'a self,
branch: &'a Branch,
key: Option<(&Key<PatchId>, Option<&Edge>)>
) -> NodesIterator<'a, U>
[src]
&'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)
.
fn iter_branches<'a>(&'a self, key: Option<&SmallStr>) -> BranchIterator<'a, U>
[src]
An iterator over branches in the database, starting from the given branch name.
fn iter_patches<'a>(
&'a self,
branch: &'a Branch,
key: Option<&PatchId>
) -> PatchesIterator<'a, U>
[src]
&'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.
fn rev_iter_applied<'a>(
&'a self,
branch: &'a Branch,
key: Option<ApplyTimestamp>
) -> RevAppliedIterator<'a, U>
[src]
&'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.
fn iter_applied<'a>(
&'a self,
branch: &'a Branch,
key: Option<ApplyTimestamp>
) -> AppliedIterator<'a, U>
[src]
&'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.
fn iter_tree<'a>(
&'a self,
key: Option<(&FileId, Option<&Inode>)>
) -> TreeIterator<'a, U>
[src]
&'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 Inode
s returned
by the iterator can be used to form new FileId
s 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.
fn iter_revtree<'a>(
&'a self,
key: Option<(&Inode, Option<&FileId>)>
) -> RevtreeIterator<'a, U>
[src]
&'a self,
key: Option<(&Inode, Option<&FileId>)>
) -> RevtreeIterator<'a, U>
An iterator over files and directories, following directories in the opposite direction.
fn iter_inodes<'a>(
&'a self,
key: Option<(&Inode, Option<&FileHeader>)>
) -> InodesIterator<'a, U>
[src]
&'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.
fn iter_external<'a>(
&'a self,
key: Option<(&PatchId, Option<HashRef>)>
) -> ExternalIterator<'a, U>
[src]
&'a self,
key: Option<(&PatchId, Option<HashRef>)>
) -> ExternalIterator<'a, U>
Iterator over the PatchId
to Hash
correspondence.
fn iter_internal<'a>(
&'a self,
key: Option<(HashRef, Option<&PatchId>)>
) -> InternalIterator<'a, U>
[src]
&'a self,
key: Option<(HashRef, Option<&PatchId>)>
) -> InternalIterator<'a, U>
Iterator over the Hash
to PatchId
correspondence.
fn iter_revdep<'a>(
&'a self,
key: Option<(&PatchId, Option<&PatchId>)>
) -> RevdepIterator<'a, U>
[src]
&'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).
fn iter_contents<'a>(
&'a self,
key: Option<&Key<PatchId>>
) -> ContentsIterator<'a, U>
[src]
&'a self,
key: Option<&Key<PatchId>>
) -> ContentsIterator<'a, U>
An iterator over line contents (common to all branches).
fn iter_cemetery<'a>(
&'a self,
key: Key<PatchId>,
edge: Edge
) -> CemeteryIterator<'a, U>
[src]
&'a self,
key: Key<PatchId>,
edge: Edge
) -> CemeteryIterator<'a, U>
An iterator over edges in the cemetery.
fn get_tree<'a>(&'a self, key: &FileId) -> Option<&'a Inode>
[src]
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.
fn get_revtree<'a>(&'a self, key: &Inode) -> Option<FileId<'a>>
[src]
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).
fn get_inodes<'a>(&'a self, key: &Inode) -> Option<&'a FileHeader>
[src]
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).
fn get_revinodes<'a>(&'a self, key: &Key<PatchId>) -> Option<&'a Inode>
[src]
Get the Inode
corresponding to key
in branches (see the
documentation for get_inodes
).
fn get_contents<'a>(&'a self, key: &Key<PatchId>) -> Option<Value<'a, U>>
[src]
Get the contents of a line.
fn get_internal<'a>(&'a self, key: HashRef) -> Option<&'a PatchId>
[src]
Get the PatchId
(or internal patch identifier) of the
provided patch hash.
fn get_external<'a>(&'a self, key: &PatchId) -> Option<HashRef<'a>>
[src]
Get the HashRef
(external patch identifier) of the provided
internal patch identifier.
fn get_patch<'a>(
&'a self,
patch_set: &Db<UnsafePatchId, ApplyTimestamp>,
patchid: &PatchId
) -> Option<ApplyTimestamp>
[src]
&'a self,
patch_set: &Db<UnsafePatchId, 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.
fn get_revdep<'a>(
&'a self,
patch: &PatchId,
dep: Option<&PatchId>
) -> Option<&'a PatchId>
[src]
&'a self,
patch: &PatchId,
dep: Option<&PatchId>
) -> Option<&'a PatchId>
Get the smallest patch id that depends on patch
(and is at
least dep
in alphabetical order if dep
, is Some
).
fn debug<W>(&self, branch_name: &str, w: &mut W) where
W: Write,
[src]
W: Write,
Dump the graph of a branch into a writer, in dot format.
fn debug_folders<W>(&self, branch_name: &str, w: &mut W) where
W: Write,
[src]
W: Write,
Dump the graph of a branch into a writer, in dot format.
fn is_connected(
&self,
branch: &Branch,
a: Key<PatchId>,
b: Key<PatchId>
) -> bool
[src]
&self,
branch: &Branch,
a: Key<PatchId>,
b: Key<PatchId>
) -> bool
Is there an alive/pseudo edge from a
to b
.
fn test_edge(
&self,
branch: &Branch,
a: Key<PatchId>,
b: Key<PatchId>,
min: EdgeFlags,
max: EdgeFlags
) -> bool
[src]
&self,
branch: &Branch,
a: Key<PatchId>,
b: Key<PatchId>,
min: EdgeFlags,
max: EdgeFlags
) -> bool
Is there an alive/pseudo edge from a
to b
.
impl<A: Transaction, R> GenericTxn<A, R>
[src]
fn list_files(&self, inode: Inode) -> Result<Vec<PathBuf>>
[src]
Returns a vector containing all files in the repository.
fn list_files_under_inode(
&self,
inode: &Inode
) -> Vec<(SmallString, Option<Key<PatchId>>, Inode)>
[src]
&self,
inode: &Inode
) -> Vec<(SmallString, Option<Key<PatchId>>, Inode)>
Returns a list of files under the given inode.
fn list_files_under_node(
&self,
branch: &Branch,
key: &Key<PatchId>
) -> BTreeMap<Key<PatchId>, Vec<(FileMetadata, &str)>>
[src]
&self,
branch: &Branch,
key: &Key<PatchId>
) -> BTreeMap<Key<PatchId>, Vec<(FileMetadata, &str)>>
Returns a list of files under the given inode.
fn is_directory(&self, inode: &Inode) -> bool
[src]
fn find_inode(&self, path: &Path) -> Result<Inode>
[src]
Find the inode corresponding to that path, or return an error if there's no such inode.
fn file_names(
&self,
branch: &Branch,
key: &Key<PatchId>
) -> Vec<(Key<PatchId>, FileMetadata, &str)>
[src]
&self,
branch: &Branch,
key: &Key<PatchId>
) -> Vec<(Key<PatchId>, FileMetadata, &str)>
impl<U: Transaction, R> GenericTxn<U, R>
[src]
fn new_patch<I: Iterator<Item = Hash>>(
&self,
branch: &Branch,
authors: Vec<String>,
name: String,
description: Option<String>,
timestamp: DateTime<Utc>,
changes: Vec<Change>,
extra_dependencies: I
) -> Patch
[src]
&self,
branch: &Branch,
authors: Vec<String>,
name: String,
description: Option<String>,
timestamp: DateTime<Utc>,
changes: Vec<Change>,
extra_dependencies: I
) -> Patch
fn dependencies<'a, I: Iterator<Item = &'a Change>>(
&self,
branch: &Branch,
changes: I
) -> Vec<Hash>
[src]
&self,
branch: &Branch,
changes: I
) -> Vec<Hash>
impl<A: Transaction, R> GenericTxn<A, R>
[src]
fn external_key(&self, key: &Key<PatchId>) -> Option<Key<Option<Hash>>>
[src]
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.
fn external_hash(&self, key: &PatchId) -> HashRef
[src]
fn new_internal(&self, ext: HashRef) -> PatchId
[src]
Create a new internal patch id, register it in the "external" and "internal" bases, and write the result in its second argument ("result").
impl<A: Transaction, R> GenericTxn<A, R>
[src]
fn retrieve<'a>(&'a self, branch: &Branch, key0: &Key<PatchId>) -> Graph
[src]
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.
impl<'a, A: Transaction + 'a, R> GenericTxn<A, R>
[src]
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>
[src]
&'a self,
branch: &Branch,
buf: &mut B,
graph: &mut Graph,
forward: &mut Vec<(Key<PatchId>, Edge)>
) -> Result<bool>
impl<A: Transaction, R: Rng> GenericTxn<A, R>
[src]
fn diff<'a>(
&'a self,
branch: &'a Branch,
path: &Rc<PathBuf>,
line_num: &mut LineId,
actions: &mut Vec<Record>,
redundant: &mut Vec<(Key<PatchId>, Edge)>,
a: &mut Graph,
lines_b: &[&[u8]]
) -> Result<()>
[src]
&'a self,
branch: &'a Branch,
path: &Rc<PathBuf>,
line_num: &mut LineId,
actions: &mut Vec<Record>,
redundant: &mut Vec<(Key<PatchId>, Edge)>,
a: &mut Graph,
lines_b: &[&[u8]]
) -> Result<()>
impl<U: Transaction, R> GenericTxn<U, R>
[src]
fn find_alive_ancestors_with_edges(
&self,
find_alive: &mut FindAlive,
branch: &Branch,
alive: &mut Vec<Key<PatchId>>,
ancestors: &mut Vec<(Key<PatchId>, Edge)>
)
[src]
&self,
find_alive: &mut FindAlive,
branch: &Branch,
alive: &mut Vec<Key<PatchId>>,
ancestors: &mut Vec<(Key<PatchId>, Edge)>
)
Recursively find all ancestors by doing a DFS, and collect all edges until finding an alive ancestor.
fn find_alive_descendants_with_edges(
&self,
find_alive: &mut FindAlive,
branch: &Branch,
alive: &mut Vec<Key<PatchId>>,
descendants: &mut Vec<(Key<PatchId>, Edge)>
)
[src]
&self,
find_alive: &mut FindAlive,
branch: &Branch,
alive: &mut Vec<Key<PatchId>>,
descendants: &mut Vec<(Key<PatchId>, Edge)>
)
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.
fn find_alive_descendants(
&self,
branch: &Branch,
find_alive: &mut FindAlive,
alive: &mut HashSet<Key<PatchId>>,
file: &mut Option<Key<PatchId>>,
current: Key<PatchId>
)
[src]
&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
.
fn find_alive_ancestors(
&self,
branch: &Branch,
find_alive: &mut FindAlive,
alive: &mut HashSet<Key<PatchId>>,
file: &mut Option<Key<PatchId>>,
current: Key<PatchId>
)
[src]
&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
.
impl<U: Transaction, R> GenericTxn<U, R>
[src]
fn internal_hash(&self, e: &Option<Hash>, internal: PatchId) -> PatchId
[src]
Return the patch id corresponding to e
, or internal
if e==None
.
fn internal_key(
&self,
key: &Key<Option<Hash>>,
internal: PatchId
) -> Key<PatchId>
[src]
&self,
key: &Key<Option<Hash>>,
internal: PatchId
) -> Key<PatchId>
Fetch the internal key for this external key (or internal
if
key.patch
is None
).
fn internal_key_unwrap(&self, key: &Key<Option<Hash>>) -> Key<PatchId>
[src]
impl<T: Transaction, R> GenericTxn<T, R>
[src]
fn is_alive(&self, branch: &Branch, key: &Key<PatchId>) -> bool
[src]
Tells whether a key
is alive in branch
, i.e. is either the
root, or all its ingoing edges are alive.
fn is_alive_or_zombie(&self, branch: &Branch, key: &Key<PatchId>) -> bool
[src]
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.
fn has_edge(
&self,
branch: &Branch,
key: &Key<PatchId>,
min: EdgeFlags,
max: EdgeFlags
) -> bool
[src]
&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.
fn get_file<'a>(
&'a self,
branch: &Branch,
key: &Key<PatchId>
) -> Vec<Key<PatchId>>
[src]
&'a self,
branch: &Branch,
key: &Key<PatchId>
) -> Vec<Key<PatchId>>
Tells which paths (of folder nodes) a key is in.
fn get_file_names<'a>(
&'a self,
branch: &Branch,
key: Key<PatchId>
) -> Vec<(Key<PatchId>, Vec<&'a str>)>
[src]
&'a self,
branch: &Branch,
key: Key<PatchId>
) -> Vec<(Key<PatchId>, Vec<&'a str>)>