package irmin-pack
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=cd788a8d3f4a3dd18dc160a153d4aec91eaf6b0fb41ad41464d26c79c304a98e
sha512=4f97862678d35e0b4aa814a1df51d6f8c59bcf5b611c73f0a475f9b5386ca42a4a18e65ce80fc425ddad93fcdacfcb563c52f6423777610a0bc567902f4db088
doc/irmin-pack.unix/Irmin_pack_unix/Pack_key/index.html
Module Irmin_pack_unix.Pack_key
Source
The type of keys referencing values stored in the irmin-pack
backend.
type 'hash state = private
| Direct of {
hash : 'hash;
offset : Optint.Int63.t;
length : int;
}
(*A "direct" pointer to a value stored at
offset
in the pack-file (with hashhash
and lengthlength
). Such keys can be dereferenced from the store with a single IO read, without needing to consult the index.They are built in-memory (e.g. after adding a fresh value to the pack file), but have no corresponding encoding format, as the pack format keeps length information with the values themselves.
When decoding a inode, which references its children as single offsets, we fetch the length information of the child at the same time as fetching its hash (which we must do anyway in order to do an integrity check), creating keys of this form.
*)| Indexed of 'hash
(*A pointer to an object in the pack file that is indexed. Reading the object necessitates consulting the index, after which the key can be promoted to
Direct
.Such keys result from decoding pointers to other store objects (nodes or commits) from commits or from the branch store.
*)
Undereferencable keys
A key k
is "undereferencable" with respect to some store handle t
if find t k <> Some _
. Such keys should not arise during regular operation of a single Irmin repository, but are still technically constructible in the following ways:
- storage corruption. When decoding a key from disk, we may not immediately check that it is dereferenceable for performance reasons. In this case, any corruption to the key (or the referenced section of the store) will be discovered on attempted
find
(ormem
).
- passing keys between store handles. Read-only handles on a pack store must explicitly reload to observe recent writes to the store. This means that any keys built by a read-write instance and passed to a read-only instance will be undereferencable until that reader has reloaded.
- passing keys between repositories. Keys created for one Irmin repository may not be dereferenced with respect to another by design.