package storage

import "github.com/google/trillian/skylog/storage"

Package storage contains Skylog storage API and helpers.

Index

Types

type Entry

type Entry struct {
	// Data holds the data that the log commits to.
	Data []byte
	// Extra holds data that is attached to the entry, but not committed to by
	// the log, i.e. not accounted for when calculating Merkle tree hashes.
	Extra []byte
	// Hash is the Merkle tree leaf hash of the log entry Data.
	Hash []byte
}

Entry represents a single log entry, which is also a Merkle tree leaf.

type Node

type Node struct {
	ID   compact.NodeID
	Hash []byte
}

Node represents a Merkle tree node.

type SequenceReader

type SequenceReader interface {
	// Read fetches the specified [begin, end) range of entries, and returns them
	// in order. May return a prefix of the requested range (potentially empty).
	Read(ctx context.Context, begin, end uint64) ([]Entry, error)
}

SequenceReader allows reading from a sequence storage.

type SequenceWriter

type SequenceWriter interface {
	// Write stores all the passed-in entries to the sequence starting at the
	// specified begin index.
	Write(ctx context.Context, begin uint64, entries []Entry) error
}

SequenceWriter allows writing to a sequence storage.

type TreeReader

type TreeReader interface {
	// Read fetches and returns the Merkle tree hashes of the specified nodes
	// from the storage. It is expected that the number of nodes is relatively
	// small, e.g. O(log N) for vertical proof-like reads. The returned slice
	// contains nil hashes for the nodes that are not found.
	Read(ctx context.Context, ids []compact.NodeID) ([][]byte, error)
}

TreeReader allows reading from a tree storage.

type TreeWriter

type TreeWriter interface {
	// Write stores all the passed in nodes of the Merkle tree. It must never be
	// called with the same node ID, but different hashes. This call may succeed
	// only partially and leave side effects, so the caller must ensure that they
	// can reliably reconstruct and retry the request even if they fail/restart.
	Write(ctx context.Context, nodes []Node) error
}

TreeWriter allows writing to a tree storage. The tree is append-only and immutable. This means that each node hash can be written only once, effectively when the corresponding subtree is fully populated to be a perfect binary tree, and its hash becomes final.

Source Files

api.go types.go

Directories

PathSynopsis
skylog/storage/gcp
skylog/storage/gcp/cloudspannerPackage cloudspanner provides implementation of the Skylog storage API in Cloud Spanner.
skylog/storage/gcp/gcppbPackage gcppb contains proto messages for GCP-based Skylog storage.
skylog/storage/gcp/pubsubPackage contains a binary that sends Merkle tree building jobs to a collection of workers through a GCP Pub/Sub topic.
Version
v1.3.7
Published
Jan 16, 2020
Platform
js/wasm
Imports
2 packages
Last checked
3 hours ago

Tools for package owners.