Skip to main content

Crate nibkeep_log

Crate nibkeep_log 

Source
Expand description

The log of a NibKeep space: signed changes linked by their hashes, with payloads sealed under keys of their own; the current state and the earlier states they build; and ordered lists.

The formats and rules are specified in docs/spec/log.md.

Re-exports§

pub use history::Accepted;
pub use history::History;
pub use history::MemoryHistory;
pub use history::Status;
pub use history::Summary;

Modules§

history
What a log’s history is kept in: the changes it accepted, with their payloads and keys as far as it has them, and what they say for good, such as which change holds each sealed statement and what was purged. The log works on these lookups alone, so that the same logic reads its history from memory and from the log file on disk (technical design: the state file).
list
Ordered lists: items belong to a list through memberships, ordered by position keys.

Structs§

AccountPage
One page of a replica’s account of what it holds in a space, signed by the replica and sealed with a space key.
BackupHead
The head of the account of a backup, which a replica that updated it issues: the backup’s disk, its mark, the space’s changes it holds, what checks found damaged, and the number of the update that the page tells of (technical design).
Change
The operations that one replica made at one time, signed by the replica. The payload that holds them is sealed with a key of the change’s own, and kept beside the change, whose header holds the hashes of both.
ChangeId
The ID of a change: the BLAKE3 hash of its encoding.
Destroyed
What purges destroyed: the record keys of secret statements, the keys of sealed blobs, and whether changes lost their keys and payloads; with what a replica that waits keeps of it, and what changes that restore brought back.
Draft
What a new change is to hold, besides who makes it and with which key.
Head
The head of an account: the disk, its device’s marks, the space’s changes it holds, and what the replica’s checks found damaged.
Log
A replica’s copy of a space’s log: the changes it has accepted, with their sealed payloads and wrapped keys as far as it has them, the changes waiting for their parents, the changes it rejected for good, the wrapped record keys of secret statements, the wrapped keys of blobs, and the state that the accepted changes build.
Parcel
A change with its sealed payload and wrapped key, as far as a replica has them: the three travel together, but may arrive apart, and the payload and key are deleted when the change is purged.
Payload
The content of a change, which the change’s header does not hold.
PurgedBy
Which purge keeps each purged item purged (Log::purged_by).
Purges
What a change purges: changes, whose keys and payloads every replica destroys; secret statements, whose record keys it destroys; and blobs, by the sealed hashes of the blobs whose keys it destroys.
Restated
What a purge states again of one earlier change: its operations and sealed statements but those purged, with their statement IDs. They count from the time of the change they came from, and show from the purge on.
Review
What an admin reviews of a change that was set aside, as Log::review gives it.
SealedPayload
A change’s payload, sealed with the change’s key: what Payload holds, encrypted. The change’s header holds its hash, so a sealed payload that does not belong to a change is known at once. It is stored and travels beside its change, so that purging can delete it while the change stays.
SpaceKeys
The keys of a space that a replica has, by their numbers: 0 for a space’s first key, and a random one for each key that a rotation brings, so that two rotations made at once differ; the numbers do not tell which key is newer. New changes use the newest key whose rotation counts, which the replica chooses; older changes keep the key they were made with.
WrappedBlobKey
The key of a blob, wrapped with a space key together with the blob’s content hash, so that the content hash stays as secret as the content. The key of a blob of a secret field is wrapped with a secrets key first, so that only a replica that holds both opens it.
WrappedChangeKey
A change’s key, wrapped with a key derived from the space key of the change’s epoch, and tied to the change’s ID. It is stored and travels beside its change, so that purging can delete it while the change stays.
WrappedKey
The record key of a secret statement, wrapped with the space’s secrets key.

Enums§

DeviceRole
What a device does with the files of its spaces, as its user marked it (technical design).
Kept
A part of what a purge destroyed, as it was, which a replica that waits keeps apart, to give back if a change restores it (technical design: copies that wait).
Kind
What a change is for, which its header says, so that every replica can tell from headers alone which changes may be purged.
LogError
Why a change could not be made or was rejected.
PageBody
What a page tells.
PageKind
Which page of an account a page is: the one with the disk, the marks and the heads, or one of the pages of the sealed blobs or of the plain copies, by the first byte of the sealed hashes’ digests or of the files’ IDs that it lists.
Received
What became of a received change.

Constants§

MAX_PAGE_LEN
How long a page may be, 4 MiB: a page of blobs of a space of ten million blobs takes about half of it, and longer pages are refused, so that no replica fills another’s disk with them.

Type Aliases§

Forged
A change whose signature is not valid, or, with why, that the history cannot read.
Restores
What a change restores, after purges destroyed it: the same three lists as Purges, of changes whose payloads and keys come back, secret statements whose record keys come back, and blobs whose keys come back, from replicas that kept them (technical design).
SpaceState
The state a log builds: its ordinary statements, kept in S, with the secret statements this replica has opened, which never reach the storage of the ordinary ones.