pub struct KnitRepository { /* private fields */ }Expand description
A non-pack knit repository, accessed through a transport rooted at
.bzr/repository.
Implementations§
Source§impl KnitRepository
impl KnitRepository
Sourcepub fn open(transport: SharedTransport) -> Result<Self, RepositoryError>
pub fn open(transport: SharedTransport) -> Result<Self, RepositoryError>
Open the knit repository whose .bzr/repository directory is rooted
at transport.
Sourcepub fn create(
transport: SharedTransport,
format: &'static RepositoryFormat,
) -> Result<Self, RepositoryError>
pub fn create( transport: SharedTransport, format: &'static RepositoryFormat, ) -> Result<Self, RepositoryError>
Create an empty knit repository of format at transport and open
it. The stores create their files lazily on first write, so only the
format marker and knits/ directory are written here.
Sourcepub fn format(&self) -> &'static RepositoryFormat
pub fn format(&self) -> &'static RepositoryFormat
The format this repository was opened as.
Sourcepub fn all_revision_ids(&self) -> Result<Vec<Vec<u8>>, RepositoryError>
pub fn all_revision_ids(&self) -> Result<Vec<Vec<u8>>, RepositoryError>
All revision ids, sorted.
Sourcepub fn get_parent_map(
&self,
revision_ids: &[Vec<u8>],
) -> Result<HashMap<Vec<u8>, Vec<Vec<u8>>>, RepositoryError>
pub fn get_parent_map( &self, revision_ids: &[Vec<u8>], ) -> Result<HashMap<Vec<u8>, Vec<Vec<u8>>>, RepositoryError>
The stored parent ids of each of revision_ids (present ones only),
read from the revisions kndx index.
Sourcepub fn get_revision(
&self,
revision_id: &[u8],
) -> Result<Revision, RepositoryError>
pub fn get_revision( &self, revision_id: &[u8], ) -> Result<Revision, RepositoryError>
Read and parse a revision (XML, serializer v5).
Sourcepub fn get_inventory(
&self,
revision_id: &[u8],
) -> Result<MutableInventory, RepositoryError>
pub fn get_inventory( &self, revision_id: &[u8], ) -> Result<MutableInventory, RepositoryError>
Read the inventory for a revision as an in-memory
MutableInventory.
Sourcepub fn get_file_text(
&self,
file_id: &[u8],
revision: &[u8],
) -> Result<Vec<u8>, RepositoryError>
pub fn get_file_text( &self, file_id: &[u8], revision: &[u8], ) -> Result<Vec<u8>, RepositoryError>
Read the file text for (file_id, revision).
Sourcepub fn add_revision(
&mut self,
revision: &Revision,
parents: &[Vec<u8>],
) -> Result<(), RepositoryError>
pub fn add_revision( &mut self, revision: &Revision, parents: &[Vec<u8>], ) -> Result<(), RepositoryError>
Add a revision, serialised to XML (v5).
Sourcepub fn add_signature(
&mut self,
revision_id: &[u8],
signature: &[u8],
) -> Result<(), RepositoryError>
pub fn add_signature( &mut self, revision_id: &[u8], signature: &[u8], ) -> Result<(), RepositoryError>
Add a signature text for revision_id (the clearsigned testament) to
the signatures knit.
Sourcepub fn get_signature_text(
&self,
revision_id: &[u8],
) -> Result<Option<Vec<u8>>, RepositoryError>
pub fn get_signature_text( &self, revision_id: &[u8], ) -> Result<Option<Vec<u8>>, RepositoryError>
The signature text stored for revision_id, or None if unsigned.
Sourcepub fn add_inventory_from_entries(
&mut self,
revision_id: &[u8],
parents: &[Vec<u8>],
_root_id: &[u8],
entries: &[Entry],
) -> Result<Vec<u8>, RepositoryError>
pub fn add_inventory_from_entries( &mut self, revision_id: &[u8], parents: &[Vec<u8>], _root_id: &[u8], entries: &[Entry], ) -> Result<Vec<u8>, RepositoryError>
Build the inventory from entries, serialise it to XML, and add it.
Sourcepub fn add_inventory_by_delta(
&mut self,
basis_revision_id: &[u8],
delta: &InventoryDelta,
new_revision_id: &[u8],
parents: &[Vec<u8>],
) -> Result<Vec<u8>, RepositoryError>
pub fn add_inventory_by_delta( &mut self, basis_revision_id: &[u8], delta: &InventoryDelta, new_revision_id: &[u8], parents: &[Vec<u8>], ) -> Result<Vec<u8>, RepositoryError>
Build the inventory for new_revision_id by applying delta to the
basis inventory, then serialise and store it.
Trait Implementations§
Source§impl Repository for KnitRepository
impl Repository for KnitRepository
Source§fn format(&self) -> &'static RepositoryFormat
fn format(&self) -> &'static RepositoryFormat
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
source (e.g. another Pack2aRepository). Each backend
returns self; a downcast to a different concrete type fails and the
caller uses the generic path. Used by try_fetch_from
implementations, not by the generic fetcher.Source§fn all_revision_ids(&self) -> Result<Vec<Vec<u8>>, RepositoryError>
fn all_revision_ids(&self) -> Result<Vec<Vec<u8>>, RepositoryError>
Source§fn get_parent_map(
&self,
revision_ids: &[Vec<u8>],
) -> Result<HashMap<Vec<u8>, Vec<Vec<u8>>>, RepositoryError>
fn get_parent_map( &self, revision_ids: &[Vec<u8>], ) -> Result<HashMap<Vec<u8>, Vec<Vec<u8>>>, RepositoryError>
revision_ids, as a map. Revision ids
not present in the repository are omitted from the result. The parents
come straight from the revision store’s index (no body deserialisation),
which is the raw graph data callers build a revision graph from.Source§fn get_revision(&self, revision_id: &[u8]) -> Result<Revision, RepositoryError>
fn get_revision(&self, revision_id: &[u8]) -> Result<Revision, RepositoryError>
Source§fn get_inventory(
&self,
revision_id: &[u8],
) -> Result<Box<dyn Inventory>, RepositoryError>
fn get_inventory( &self, revision_id: &[u8], ) -> Result<Box<dyn Inventory>, RepositoryError>
Source§fn get_file_text(
&self,
file_id: &[u8],
revision: &[u8],
) -> Result<Vec<u8>, RepositoryError>
fn get_file_text( &self, file_id: &[u8], revision: &[u8], ) -> Result<Vec<u8>, RepositoryError>
Source§fn start_write_group(&mut self) -> Result<(), RepositoryError>
fn start_write_group(&mut self) -> Result<(), RepositoryError>
Repository::commit_write_group.Source§fn add_revision(
&mut self,
revision: &Revision,
parents: &[Vec<u8>],
) -> Result<(), RepositoryError>
fn add_revision( &mut self, revision: &Revision, parents: &[Vec<u8>], ) -> Result<(), RepositoryError>
Source§fn add_inventory_from_entries(
&mut self,
revision_id: &[u8],
parents: &[Vec<u8>],
root_id: &[u8],
entries: &[Entry],
) -> Result<Vec<u8>, RepositoryError>
fn add_inventory_from_entries( &mut self, revision_id: &[u8], parents: &[Vec<u8>], root_id: &[u8], entries: &[Entry], ) -> Result<Vec<u8>, RepositoryError>
entries and add it to the
open write group, returning the inventory sha1 to record on the
revision. Each format stores the inventory in its own representation
(a CHK inventory for 2a, serialised XML for knit-pack).Source§fn add_inventory_by_delta(
&mut self,
basis_revision_id: &[u8],
delta: &InventoryDelta,
new_revision_id: &[u8],
parents: &[Vec<u8>],
) -> Result<Vec<u8>, RepositoryError>
fn add_inventory_by_delta( &mut self, basis_revision_id: &[u8], delta: &InventoryDelta, new_revision_id: &[u8], parents: &[Vec<u8>], ) -> Result<Vec<u8>, RepositoryError>
new_revision_id by applying delta to the
already-committed basis_revision_id inventory, adding it to the open
write group and returning its sha1. Formats that can share storage
(2a’s CHK inventory) write only the changed pages; others fall back to
re-serialising the whole inventory.Source§fn add_text(
&mut self,
file_id: &[u8],
revision: &[u8],
parents: &[(Vec<u8>, Vec<u8>)],
bytes: &[u8],
) -> Result<(), RepositoryError>
fn add_text( &mut self, file_id: &[u8], revision: &[u8], parents: &[(Vec<u8>, Vec<u8>)], bytes: &[u8], ) -> Result<(), RepositoryError>
(file_id, revision)) to the open write
group.Source§fn add_signature_text(
&mut self,
revision_id: &[u8],
signature: &[u8],
) -> Result<(), RepositoryError>
fn add_signature_text( &mut self, revision_id: &[u8], signature: &[u8], ) -> Result<(), RepositoryError>
revision_id to the open write group.Source§fn get_signature_text(
&self,
revision_id: &[u8],
) -> Result<Option<Vec<u8>>, RepositoryError>
fn get_signature_text( &self, revision_id: &[u8], ) -> Result<Option<Vec<u8>>, RepositoryError>
revision_id, or None if unsigned.Source§fn commit_write_group(&mut self) -> Result<(), RepositoryError>
fn commit_write_group(&mut self) -> Result<(), RepositoryError>
Source§fn try_fetch_from(
&mut self,
_source: &dyn Repository,
_revision_ids: &[Vec<u8>],
) -> Result<bool, RepositoryError>
fn try_fetch_from( &mut self, _source: &dyn Repository, _revision_ids: &[Vec<u8>], ) -> Result<bool, RepositoryError>
revision_ids (topologically ordered, already filtered to
revisions absent here) from source into this repository using a
format-specific fast path, opening and committing the write group
itself. Read moreSource§fn has_revision(&self, revision_id: &[u8]) -> Result<bool, RepositoryError>
fn has_revision(&self, revision_id: &[u8]) -> Result<bool, RepositoryError>
revision_id is present in this repository. Defaults to a
single-key get_parent_map lookup;
backends may override with a cheaper index probe.Source§fn revision_tree(
&self,
revision_id: &[u8],
) -> Result<RevisionTree, RepositoryError>
fn revision_tree( &self, revision_id: &[u8], ) -> Result<RevisionTree, RepositoryError>
revision_id: its inventory paired
with the revision id. This is the basis a commit builds its
inventory delta against.Source§fn get_file_text_at_path(
&self,
path: &str,
revision: &[u8],
) -> Result<Vec<u8>, RepositoryError>
fn get_file_text_at_path( &self, path: &str, revision: &[u8], ) -> Result<Vec<u8>, RepositoryError>
path in revision,
resolving the path to a file id through that revision’s inventory.
Errors with RepositoryError::NoSuchRevision if path is not in the
tree (reusing the closest variant for “not found”).Source§fn pack(&mut self) -> Result<(), RepositoryError>
fn pack(&mut self) -> Result<(), RepositoryError>
Source§fn autopack(&mut self) -> Result<bool, RepositoryError>
fn autopack(&mut self) -> Result<bool, RepositoryError>
Source§fn check(&self) -> Result<CheckResult, RepositoryError>
fn check(&self) -> Result<CheckResult, RepositoryError>
CheckResult). Format-neutral: it cross-checks
the data every format exposes through this trait.Source§fn reconcile(&mut self) -> Result<ReconcileResult, RepositoryError>
fn reconcile(&mut self) -> Result<ReconcileResult, RepositoryError>
ReconcileResult). Read more