storage

package
v1.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package storage contains Skylog storage API and helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Directories

Path Synopsis
gcp
cloudspanner
Package cloudspanner provides implementation of the Skylog storage API in Cloud Spanner.
Package cloudspanner provides implementation of the Skylog storage API in Cloud Spanner.
gcppb
Package gcppb contains proto messages for GCP-based Skylog storage.
Package gcppb contains proto messages for GCP-based Skylog storage.
pubsub command
Package contains a binary that sends Merkle tree building jobs to a collection of workers through a GCP Pub/Sub topic.
Package contains a binary that sends Merkle tree building jobs to a collection of workers through a GCP Pub/Sub topic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL