Expand description
This crate contains the core API to access Pijul repositories.
The key object is a Repository
, on which Txn
(immutable
transactions) and MutTxn
(mutable transactions) can be started,
to perform a variety of operations.
Another important object is a Patch
, which encodes two different pieces of information:
-
Information about deleted and inserted lines between two versions of a file.
-
Information about file moves, additions and deletions.
The standard layout of a repository is defined in module
fs_representation
, and mainly consists of a directory called
.pijul
at the root of the repository, containing:
-
a directory called
pristine
, containing a Sanakirja database storing most of the repository information. -
a directory called
patches
, actually containing the patches, where each patch is a gzipped compression of the bincode encoding of thepatch::Patch
type.
At the moment, users of this library, such as the Pijul
command-line tool, may use other files in the .pijul
directory,
such as user preferences, or information about remote branches and
repositories.
Re-exports§
pub use patch::Patch;
pub use patch::PatchHeader;
Modules§
- apply
- fs_
representation - Layout of a repository (files in
.pijul
) on the disk. This module exports both high-level functions that require no knowledge of the repository, and lower-level constants documented on pijul.org/documentation/repository, used for instance for downloading files from remote repositories. - graph
- The data structure of the in-memory version of Pijul’s main datastructure, used to edit and organise it (for instance before a record or before outputting a file).
- patch
- Definition of patches, and a number of methods.
Structs§
- Branch
- The representation of a branch. The “application number” of a patch on a branch is the state of the application counter at the time the patch has been applied to that branch.
- Edge
- The target half of an edge in the repository graph.
- Edge
Flags - Possible flags of edges.
- Error
- The Error type.
- FileId
- File
Metadata - File metadata, essentially flags to indicate permissions and nature of a file tracked by Pijul.
- Generic
Txn - Common type for both mutable transactions (
MutTxn
) and immutable transaction (Txn
). All ofTxn
’s methods are alsoMutTxn
’s methods. - Inode
- A unique identifier for files or directories in the actual file system, to map “files from the graph” to real files.
- Key
- A node in the repository graph, made of a patch internal identifier, and a line identifier in that patch.
- LineId
- An index for file chunks within a patch.
- Owned
File Id - PatchId
- An internal patch identifier, less random than external patch identifiers, but more stable in time, and much smaller.
- Prefixes
- Record
State - Repository
- A repository. All operations on repositories must be done via transactions.
- Small
Str - A borrowed version of
SmallStr
. - Small
String - A string of length at most 255, with a more compact on-disk encoding.
Enums§
- Error
Kind - The kind of an error.
- File
Status - Hash
- The external hash of patches.
- HashRef
- A borrowed version of
Hash
. - Inode
Update - An account of the files that have been added, moved or deleted, as returned by record, and used by apply (when applying a patch created locally) to update the trees and inodes databases.
- Value
- Iterator over parts of a value. On values of size at most 4096 bytes, the iterator will run exactly once. On larger values, it returns all parts of the value, in order.
Constants§
- DEFAULT_
BRANCH - The default name of a branch, for users who start working before choosing branch names (or like the default name, “master”).
- ROOT_
INODE - The
Inode
representing the root of the repository (on the actual file system). - ROOT_
KEY - The node at the root of the repository graph.
Traits§
- Result
Ext - Additional methods for
Result
, for easy interaction with this crate. - ToPrefixes
- Transaction
- Trait for operations common to mutable and immutable transactions.
Functions§
- apply_
resize - Apply a number of patches, guessing the new repository size. If this fails, the repository size is guaranteed to have been increased by at least some pages, and it is safe to call this function again.
- apply_
resize_ no_ output - Apply a number of patches, guessing the new repository size. If this fails, the repository size is guaranteed to have been increased by at least some pages, and it is safe to call this function again.
- apply_
resize_ patches - A version of
apply_resize
with the patches list already loaded. - apply_
resize_ patches_ no_ output - unrecord_
no_ resize - Open the repository, and unrecord the patch, without increasing
the size. If this fails, the repository file is guaranteed to have
been increased by
increase
bytes.
Type Aliases§
- Apply
Timestamp - The type of patch application numbers.
- MutTxn
- A mutable transaction on a repository.
- Result
- Convenient wrapper around
std::Result
. - Txn
- An immutable transaction on a repository.