kolo docsbeta

kolo-store

Persistent storage for Kolo logs and read-only replicas on one machine.

On this page

kolo-store keeps kolo-log logs on disk and brings them back after a restart, checking every signature, hash and Merkle root again. It keeps a log replica the way a Certificate Transparency monitor (RFC 9162, section 8.2) keeps a log, and deletes by destroying keys, the cryptographic erase of NIST SP 800-88 Rev. 1. It is the log's kololog.Storage: an open log keeps only its tree hashes and records in memory and reads entries from disk. One store holds many logs, one per log ID: your own and read-only replicas of other people's. It stores data on one machine and does not talk to the network.

Install

go get github.com/ciranda-dev/kolo-store

Pebble links the C zstd library when cgo is enabled. Build with CGO_ENABLED=0 for a pure Go binary.

Quick start

Create a log, close the store, open the directory again and read the entry back.

main.go
package main

import (
	"fmt"
	"log"
	"os"
	"path/filepath"

	koloid "github.com/ciranda-dev/kolo-id"
	kololog "github.com/ciranda-dev/kolo-log"
	kolostore "github.com/ciranda-dev/kolo-store"
)

func main() {
	dir, err := os.MkdirTemp("", "kolostore")
	check(err)
	defer os.RemoveAll(dir)
	path := filepath.Join(dir, "db")

	me, err := koloid.Generate()
	check(err)
	b, err := kolostore.OpenPebble(path)
	check(err)
	s := kolostore.New(b)
	l, err := s.Create(me, kololog.WithValueEncoding(kololog.UTF8))
	check(err)
	_, err = l.Append("hello")
	check(err)
	logID := l.ID()
	check(s.Close())

	// Open the directory again, as a restarted process would.
	b, err = kolostore.OpenPebble(path)
	check(err)
	s = kolostore.New(b)
	defer s.Close()
	l, err = s.Open(me, logID, kololog.WithValueEncoding(kololog.UTF8))
	check(err)
	var text string
	check(l.Read(0, &text))
	fmt.Println(l.Len(), text)
}

func check(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

It prints 1 hello. Store.Close also closes every open log of the store. In a real program, keep me with kolo-id Save and Load: only the identity that created a log can open it again.

API reference

The API reference is generated from the Go source and is in English.

Package kolostore · github.com/ciranda-dev/kolo-store · v0.1.0

Package kolostore persists kolo-log logs in an ordered key-value backend. Many logs share one store; each write is one atomic, durable batch.

This package is experimental and its API may change before v1.0.0.

Constants

const (
	// MinMemTableSize is the smallest [PebbleOptions.MemTableSize], 1 MiB.
	MinMemTableSize = 1 << 20
	// MaxMemTableSize is the largest [PebbleOptions.MemTableSize], 1 GiB.
	MaxMemTableSize = 1 << 30
)

Variables

var (
	// ErrNotFound is returned by [Backend.Get] for a key that is not stored.
	ErrNotFound = errors.New("kolostore: not found")
	// ErrClosed is returned after Close by a backend, a store or a log.
	ErrClosed = errors.New("kolostore: closed")
	// ErrTooLarge is returned for a write too large for one batch: a Pebble batch of 4 GiB - 1 bytes or more (2 GiB - 1 on 32-bit), or a [Store.Adopt] batch of 2 GiB or more (1 GiB).
	ErrTooLarge = errors.New("kolostore: batch too large")
)
var (
	// ErrReplica is returned by [Store.Open] for a stored read-only replica, which only [Store.OpenReplica] opens.
	ErrReplica = errors.New("kolostore: log is a read-only replica")
	// ErrNotReplica is returned by [Store.OpenReplica] for a stored log that is not a replica, such as one of your own.
	ErrNotReplica = errors.New("kolostore: log is not a replica")
	// ErrLogInUse is returned when a log is already open on the same backend in this process.
	ErrLogInUse = errors.New("kolostore: log already open")
)
var ErrCorrupt = errors.New("kolostore: corrupt data")

ErrCorrupt is returned when stored data is missing, extra, cannot be decoded or does not verify.

var ErrIncomplete = errors.New("kolostore: replica is not complete")

ErrIncomplete is returned by Store.Adopt for a replica that has no head yet or an unfinished catch-up.

var ErrInsecureDir = errors.New("kolostore: insecure directory")

ErrInsecureDir is returned by OpenPebble for a directory that group or others can access, that another user owns or that changed while opening.

var ErrInvalidOptions = errors.New("kolostore: invalid pebble options")

ErrInvalidOptions is returned by OpenPebbleWith for a PebbleOptions value out of bounds.

Types

type Backend

type Backend interface {
	// Get returns the value of key, or [ErrNotFound].
	Get(key []byte) ([]byte, error)
	// Put durably stores value under key.
	Put(key, value []byte) error
	// Delete durably removes key; deleting a missing key is not an error.
	Delete(key []byte) error
	// Scan calls fn for each key in [start, end) in order until fn returns false.
	// A nil end means no upper bound and limit <= 0 means no limit; fn must not call the backend.
	Scan(start, end []byte, reverse bool, limit int, fn func(key, value []byte) bool) error
	// NewBatch returns an empty batch of writes.
	NewBatch() Batch
	// Close releases the backend; later calls return [ErrClosed] and a second Close returns nil.
	Close() error
}

Backend is the ordered key-value storage that a Store runs on; returned slices are copies. Use a comparable type, such as a pointer, so that Stores on one backend share their open logs.

func NewMemory
func NewMemory() Backend

NewMemory returns an empty in-memory Backend, for tests and short-lived stores.

func OpenPebble
func OpenPebble(dir string) (Backend, error)

OpenPebble opens or creates a Pebble Backend in dir; another open of the same dir fails until Close. It creates dir with mode 0700 and returns ErrInsecureDir for a dir open to group or others, owned by another user or swapped while opening. Permissions and owner are not checked on Windows. The directory is checked only when it is opened; changing what dir points to afterwards needs write access to a parent directory, and the store does not defend against that.

func OpenPebbleWith
func OpenPebbleWith(dir string, o PebbleOptions) (Backend, error)

OpenPebbleWith is OpenPebble with tuning for large values; it returns ErrInvalidOptions before touching dir for a MemTableSize out of bounds. Every commit is still synced to disk, whatever the options.

type Batch

type Batch interface {
	// Put adds a write of value under key; the batch keeps its own copy, so the caller may clear value after Commit.
	Put(key, value []byte)
	// Delete adds a removal of key.
	Delete(key []byte)
	// DeleteRange adds a removal of every key in [start, end); an empty range does nothing.
	DeleteRange(start, end []byte)
	// Commit applies every write or none; a batch can be committed once.
	Commit() error
}

Batch collects writes that Batch.Commit applies atomically and durably.

type Log

type Log struct {
	// contains filtered or unexported fields
}

Log is an open log of a Store; it is safe for concurrent use and is the only way to write to the log. Every change is one atomic batch that kolo-log commits before it shows the change, so a failed write changes nothing.

func (Log) Append
func (l *Log) Append(v any) (uint64, error)

Append appends v and durably stores the entry, its key and the new head in one batch, then returns its index. If the write fails, the log is unchanged and returns the error.

func (Log) Close
func (l *Log) Close() error

Close releases the log so it can be opened again; a second Close returns nil.

func (Log) ConsistencyProof
func (l *Log) ConsistencyProof(oldSize, newSize uint64) (kololog.ConsistencyProof, error)

ConsistencyProof returns a proof that the tree of oldSize entries is a prefix of the tree of newSize entries.

func (Log) Delete
func (l *Log) Delete(indexes ...uint64) error

Delete replaces the entries at indexes with delete markers signed by the log key and removes their keys, in one synced batch. An index out of range deletes nothing and deleted entries are skipped; if the write fails, every entry stays as it was. A backup, snapshot, write-ahead log or freed block from before keeps a working key, and after a reopen an old entry value put back reads as live.

func (Log) Entry
func (l *Log) Entry(index uint64) (kololog.Entry, error)

Entry returns the stored form of the entry at index, its key included; clear Key when done with it.

func (Log) EntryInfo
func (l *Log) EntryInfo(index uint64) (kololog.EntryInfo, error)

EntryInfo returns whether the entry at index is deleted and whether its key is stored, without reading the backend.

func (Log) Get
func (l *Log) Get(index uint64) ([]byte, error)

Get returns the stored bytes of the entry at index.

func (Log) Head
func (l *Log) Head() (kololog.Head, error)

Head returns a signed head for the stored tree.

func (Log) Header
func (l *Log) Header() kololog.LogHeader

Header returns a copy of the signed log header; it also works after Close.

func (Log) ID
func (l *Log) ID() kololog.LogID

ID returns the log ID; it also works after Close.

func (Log) InclusionProof
func (l *Log) InclusionProof(index, size uint64) (kololog.InclusionProof, error)

InclusionProof returns a proof that the entry at index is in the tree of the first size entries.

func (Log) Key
func (l *Log) Key(index uint64) (kololog.EntryKey, error)

Key returns the key of the entry at index without reading its ciphertext; clear it when done.

func (Log) Len
func (l *Log) Len() uint64

Len returns the number of stored entries, deleted ones included; after Close it returns the last length.

func (Log) Read
func (l *Log) Read(index uint64, out any) error

Read decodes the entry at index into out.

func (Log) Record
func (l *Log) Record(index uint64) (kololog.Record, error)

Record returns the public record of the entry at index.

type PebbleOptions

type PebbleOptions struct {
	// MemTableSize is the size in bytes of Pebble's memtable, between [MinMemTableSize] and [MaxMemTableSize]; zero keeps Pebble's default of 4 MiB.
	// A larger memtable flushes less often, which speeds up writes of large values, and costs up to twice its size in memory.
	MemTableSize int64
	// NoCompression stores blocks uncompressed. Use it when the values are ciphertext, which does not compress.
	// A directory written with it opens with or without it.
	NoCompression bool
}

PebbleOptions tunes OpenPebbleWith; the zero value is what OpenPebble uses. Neither field changes durability: every commit is still synced.

type Replica

type Replica struct {
	// contains filtered or unexported fields
}

Replica is an open read-only replica of a Store; it is safe for concurrent use. Every change is one atomic batch that kolo-log commits before it shows the change, so a failed write changes nothing.

func (Replica) AddKey
func (r *Replica) AddKey(index uint64, key []byte) error

AddKey gives an entry that came without its key the key with kololog.Replica.AddKey and stores it in one write; the key it already has writes nothing.

func (Replica) AddKeys
func (r *Replica) AddKeys(start uint64, keys []kololog.EntryKey) error

AddKeys gives the entries from start on that came without their keys the keys with kololog.Replica.AddKeys and stores every key that passes in one batch; a failed write stores none.

func (Replica) ApplyDelete
func (r *Replica) ApplyDelete(markers ...[]byte) error

ApplyDelete applies delete markers with kololog.Replica.ApplyDelete, storing each in place of its entry's ciphertext and removing its key, all in one batch; one bad marker applies none. As with Log.Delete, old copies of the disk keep a working key.

func (Replica) Close
func (r *Replica) Close() error

Close releases the replica so it can be opened again; a second Close returns nil.

func (Replica) ConsistencyProof
func (r *Replica) ConsistencyProof(oldSize, newSize uint64) (kololog.ConsistencyProof, error)

ConsistencyProof returns a proof that the tree of oldSize entries is a prefix of the tree of newSize entries.

func (Replica) Entry
func (r *Replica) Entry(index uint64) (kololog.Entry, error)

Entry returns the stored form of the entry at index, its key included; clear Key when done with it.

func (Replica) EntryInfo
func (r *Replica) EntryInfo(index uint64) (kololog.EntryInfo, error)

EntryInfo returns whether the entry at index is deleted and whether its key is stored, without reading the backend.

func (Replica) Get
func (r *Replica) Get(index uint64) ([]byte, error)

Get returns the stored bytes of the entry at index.

func (Replica) Head
func (r *Replica) Head() (kololog.Head, error)

Head returns the last verified head, as received, or kololog.ErrNoHead.

func (Replica) Header
func (r *Replica) Header() kololog.LogHeader

Header returns a copy of the signed log header; it also works after Close.

func (Replica) ID
func (r *Replica) ID() kololog.LogID

ID returns the log ID; it also works after Close.

func (Replica) InclusionProof
func (r *Replica) InclusionProof(index, size uint64) (kololog.InclusionProof, error)

InclusionProof returns a proof that the entry at index is in the tree of the first size entries.

func (Replica) Key
func (r *Replica) Key(index uint64) (kololog.EntryKey, error)

Key returns the key of the entry at index without reading its ciphertext; clear it when done.

func (Replica) Len
func (r *Replica) Len() uint64

Len returns the number of stored entries, deleted ones included; after Close it returns the last length.

func (Replica) Read
func (r *Replica) Read(index uint64, out any) error

Read decodes the entry at index into out.

func (Replica) Record
func (r *Replica) Record(index uint64) (kololog.Record, error)

Record returns the public record of the entry at index.

func (Replica) Target
func (r *Replica) Target() (h kololog.Head, p kololog.ConsistencyProof, ok bool)

Target returns the head an unfinished catch-up is filling and the proof from Len to it, or ok false; see kololog.Replica.Target.

func (Replica) Update
func (r *Replica) Update(h kololog.Head, p kololog.ConsistencyProof, entries []kololog.Entry) error

Update grows the replica with kololog.Replica.Update, which stores the new entries and keys, the head and any unfinished target with its proof in one batch. The entries may be a chunk that stops short of h; OpenReplica replays a stored target. A refused update or a failed write changes nothing.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists many kolo-log logs in one Backend.

func New
func New(b Backend) *Store

New returns a Store on b; Store.Close closes b. With a nil b, also a nil pointer, every method returns an error and Close returns nil. Stores on one comparable backend value share their open logs; a non-comparable backend only guards its own Store.

func (Store) Adopt
func (s *Store) Adopt(id *koloid.Identity, rep *Replica, opts ...kololog.Option) (*Log, error)

Adopt brings the closed own log of id stored here up to rep, a replica of it with the same header in any store, and opens it with opts like Store.Open. rep needs a head, no pending catch-up (ErrIncomplete) and the keys of its live entries past the stored head, which must be a prefix of its head (kololog.ErrRollback). One batch adds those entries and rep's head and keeps every deletion of either side, so a crash leaves the old log or the new one; a batch of 2 GiB or more (1 GiB on 32-bit) returns ErrTooLarge. An error from the final open leaves the adopted log stored, and Store.Open opens it.

func (Store) Close
func (s *Store) Close() error

Close waits for running writes, closes every open Log and Replica of the store, then closes the backend. Every Close waits for the first one to finish and returns its error, also when the backend's Close panicked.

func (Store) Create
func (s *Store) Create(id *koloid.Identity, opts ...kololog.Option) (*Log, error)

Create makes a new log with kololog.New and durably stores its header and empty head in one batch.

func (Store) Delete
func (s *Store) Delete(logID kololog.LogID) error

Delete removes a closed log or replica, its header, head, entries and list key, in one atomic batch. Deleting a log that is not stored does nothing; a log open anywhere in this process returns ErrLogInUse. The stored header is not trusted, so Delete holds a reservation of the log ID: deleting a replica also returns ErrLogInUse while the owner's writable log with that ID is open in this process.

func (Store) List
func (s *Store) List() ([]kololog.LogID, error)

List returns the IDs of the stored logs and replicas in byte order; Store.Owner tells them apart.

func (Store) Open
func (s *Store) Open(id *koloid.Identity, logID kololog.LogID, opts ...kololog.Option) (*Log, error)

Open loads a log from the backend and restores it with kololog.Restore, which verifies every entry. Pass kololog.WithTrustedHead with the last head you published to reject an older snapshot (kololog.ErrRollback); the storage is trusted to be the node's own disk, so that head is the only defense against a rollback. Damaged data returns an error wrapping ErrCorrupt or a kololog error, and a stored replica returns ErrReplica.

func (Store) OpenReplica
func (s *Store) OpenReplica(pub ed25519.PublicKey, logID kololog.LogID, header []byte) (*Replica, error)

OpenReplica opens the stored read-only replica of the log logID owned by pub, or creates it from the signed header if the log is not stored. An opened replica is verified like Store.Open; a non-empty header must then equal the stored one. An own log returns ErrNotReplica.

func (Store) Owner
func (s *Store) Owner(logID kololog.LogID) (pub ed25519.PublicKey, replica bool, err error)

Owner returns the owner key named in a stored log's header and whether the log is a read-only replica, for example to reopen it after a restart. The key is checked only against the header's own signature; Open and OpenReplica verify everything against the key you pass them.

Good to know

kolo-store answers a missing entry with an error wrapping kololog.ErrOutOfRange next to ErrCorrupt, as kolo-log requires of a Storage. kolo-store writes every key of a kololog.Change (Change.Keys) in the batch of the change. Create and OpenReplica of a new replica return the backend's error when the read that checks the new log holds no entries fails, instead of going on as if it were empty. A read of an entry the log holds but the backend lost returns ErrCorrupt wrapping kololog.ErrStorageMismatch, never ErrOutOfRange.

After a restart, List returns the stored log and replica IDs, and Owner tells you, for each one, the owner key and whether it is a replica, so you know whether to call Open or OpenReplica. Open refuses a stored replica with ErrReplica, and OpenReplica refuses one of your own logs with ErrNotReplica.

A Log and a Replica are safe for concurrent use. A Log is the only way to write to a stored log. A Replica grows only through Update, and has no Append and no Delete by index. Open and OpenReplica read the stored entries and keys in one scan each, and kolo-log verifies each entry as it is read, keeping none of them. After that, every read fetches the entry from disk and checks it against its record again.

Log.Delete(indexes...) and Replica.ApplyDelete(markers...) delete or apply many entries at once in one batch, all or nothing; one bad marker applies none. Key and EntryInfo return an entry's key, and whether it is deleted or keyed, without reading its ciphertext.

A replica far behind can catch up in steps. Replica.Update accepts entries that stop short of the head and stores the unfinished target and its proof with each step, so each step is one bounded batch. OpenReplica checks a stored target again by replaying it through Update, so a restart in the middle of a catch-up resumes where it stopped, and Target returns the head being filled and its proof. AddKey stores a key that arrives after its entry, checked against the record's commitment, in one write. Replica.AddKeys(start, keys) gives many entries their keys at once, at most kololog.MaxAddKeys (32,768) per call, and stores every key that passes in one batch; the refused ones come back in a *kololog.BadKeyError, and a failed write stores none. Log.Entry and Replica.Entry return the stored form of an entry with its key, for a sync layer; clear Key when you are done with it.

Store.Adopt(id, rep, opts...) is for a device whose own log is behind the copy others hold: pull the missing entries with their keys into a replica, then adopt it, and the log appends at the replica's length. It brings the closed own log of id up to the replica rep of it, which may live in any store, in one batch, and opens the result like Open. The batch adds only the entries past the stored head, with their keys, and the replica's head, so a crash leaves the old log or the new one, never a mix. Deletions are kept from both sides: an entry the replica deleted is stored with its marker and its key removed, and an entry the store deleted stays deleted even when the replica still holds it, so a stored deletion is never undone. Before the batch, Adopt reads the stored keys, no ciphertext, and checks the marker of every entry only the store deleted. It does not repair the stored entries it keeps: other damage there fails the final open, as it fails Open. An error from the final open, such as kololog.ErrEncodingMismatch for a missing opts, leaves the adopted log stored, and Open opens it.

Adopt refuses:

  • a replica of another owner, or one whose header is not the stored one (kololog.ErrBadLogHeader);
  • a log ID the store does not hold (kololog.ErrMissingHeader), or a stored replica instead of an own log (ErrReplica);
  • a log that is open in this process (ErrLogInUse);
  • a replica with no head or an unfinished catch-up (ErrIncomplete);
  • a live entry past the stored head without its key (kololog.ErrKeyUnavailable);
  • a replica the stored log is not a prefix of, shorter or forked (kololog.ErrRollback);
  • a stored entry it keeps that has neither a key nor a valid delete marker (ErrCorrupt);
  • a batch of 2 GiB or more, 1 GiB on 32-bit (ErrTooLarge). Nothing is written.

The batch holds the entries it adds, and Pebble holds a second copy while it commits, so Adopt is the one call whose memory grows with the size of what it handles: adopting 256 MiB of entries took a peak heap of 560 MB, 2.1 times their size. It counts its batch as Pebble does, and its 2 GiB limit is half of Pebble's batch limit, so both copies fit in it.

Limits

  • Memory: an open log or replica keeps about 250 bytes per entry, however large the entries are, and a read, append or update holds only the entries it handles. Adopt is the exception: it holds the entries it adds about twice over, and refuses a batch of 2 GiB or more (1 GiB on 32-bit) with ErrTooLarge.
  • A Pebble batch of 4 GiB - 1 bytes or more (2 GiB - 1 on 32-bit) returns ErrTooLarge instead of panicking inside Pebble. Nothing is written.
  • A store holds one log per log ID, whatever its owner. Open or OpenReplica of an ID the store holds for another owner returns kololog.ErrBadLogHeader and changes nothing; a replica of another owner's log with the same ID needs another store.
  • OpenPebble creates the store directory with mode 0700 and returns ErrInsecureDir for one that group or others can access, that another user owns, or that is swapped while it opens.
  • OpenPebble makes every file Pebble creates in the directory mode 0600, and changes the files of an existing directory to 0600, because they hold the entry keys. OpenPebbleWith(dir, PebbleOptions{MemTableSize, NoCompression}) is OpenPebble for large values, such as 1 MiB chunks: MemTableSize (0 for Pebble's 4 MiB, or 1 MiB to 1 GiB, otherwise ErrInvalidOptions) makes Pebble flush and compact less often and costs up to twice that size in memory, and NoCompression skips compressing blocks, which is wasted work on ciphertext. Every commit stays synced. On one Mac, writing 1 GiB in 1 MiB values took 14.9 s with the defaults and 7.4 s with 256 MiB and no compression.
  • Open and OpenReplica take time and I/O linear in the size of the log: they read every stored entry once, so a large log opens slowly. About 250 bytes of memory per entry stay afterwards.
  • A log ID can be open only once per backend in a process; a second open returns ErrLogInUse. A second OpenPebble on the same directory fails, also through another path, so another process cannot write the same logs.
  • Store.Delete returns ErrLogInUse for a log open anywhere in the process. Deleting a replica also returns it while the owner's writable log with that ID is open in the same process.
  • A stored entry whose record or delete marker is over 1024 bytes, whose key is present but not 32 bytes, or that is deleted and still has a key, is refused with ErrCorrupt. A replica's stored catch-up target is bounded too: its head up to 1024 bytes, its proof up to 65 hashes.
  • Stored entry values are version 3, and each live entry's key is stored on its own next to them. Versions 1 and 2, which held the key inside the entry value, are refused.

Security

  • Each entry's key is stored in the clear next to its ciphertext, because the store trusts the node's own disk.
  • Open and OpenReplica verify everything again with kolo-log, against the key you pass them. Owner checks the stored owner key only against the header's own signature.
  • Pass kololog.WithTrustedHead with the last head you published, so an older stored snapshot returns kololog.ErrRollback. That is the anchor against a rollback of the disk.
  • The replica kind byte is not signed: a write to the disk that marks a grown replica as an own log lets Open accept it with the owner's identity.
  • OpenReplica never needs a private key, and a refused Update changes nothing in memory or on disk.

Known limits

  • Experimental. The API may change before v1.0.0.
  • Permissions and owner of the store directory are not checked on Windows.
  • The directory is checked only when it is opened. Changing what the path points to afterwards needs write access to a parent directory, and the store does not defend against that.
  • NewMemory keeps everything in memory, for tests and short-lived stores.
  • A custom Backend should be a comparable type, such as a pointer, so that stores on it share their open logs.

Errors

ErrorMessage
ErrClosedkolostore: closed
ErrCorruptkolostore: corrupt data
ErrIncompletekolostore: replica is not complete
ErrInsecureDirkolostore: insecure directory
ErrInvalidOptionskolostore: invalid pebble options
ErrLogInUsekolostore: log already open
ErrNotFoundkolostore: not found
ErrNotReplicakolostore: log is not a replica
ErrReplicakolostore: log is a read-only replica
ErrTooLargekolostore: batch too large

Test errors with errors.Is. Damaged stored data always wraps ErrCorrupt, at Open or at a later read: missing or extra keys, data that does not decode or does not match its signed header, heads, records and delete markers, or a live entry of your own log that lost its key. The error also wraps the kolo-log error that found it, so errors.Is finds both: kololog.ErrRestoreMismatch at Open, kololog.ErrStorageMismatch for a change on disk after Open or an entry the backend lost, or kololog.ErrInvalidHead from stored data. Other kolo-log errors pass through wrapped, without ErrCorrupt, such as kololog.ErrMissingHeader, kololog.ErrBadLogHeader, kololog.ErrRollback, kololog.ErrDiverged, kololog.ErrBadProof or kololog.ErrBadEntry. A failed write returns the backend's error. ErrIncomplete means Adopt got a replica with no head or an unfinished catch-up, and ErrTooLarge a write too large for one batch: an Adopt batch of 2 GiB or more, or a Pebble batch of 4 GiB - 1 bytes or more (1 GiB and 2 GiB - 1 on 32-bit).

References

  • RFC 9162, Certificate Transparency Version 2.0 (Experimental, December 2021).
    • Takes: section 8.2, the monitor that keeps every entry, which a stored replica follows.
    • Not implemented: timestamps in heads, so heads are ordered by size only.
  • NIST SP 800-88 Rev. 1 (December 2014), section 2.6, Cryptographic Erase.
    • Takes: deleting by destroying a key.
    • Not implemented: key wrapping by a master key; the key is stored in the clear next to the ciphertext, because the store trusts the node's own disk.
  • Reardon, Basin and Capkun, SoK: Secure Data Deletion, IEEE S&P 2013.
    • Takes: why a log-structured engine keeps old bytes until it compacts.
  • O'Neil et al., The Log-Structured Merge-Tree, Acta Informatica 1996.
    • Takes: the storage model of the embedded storage engine, where a delete writes a tombstone.