storage

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

README

Storage layer

The interface, various concrete implementations, and any associated components live here. Currently, there is only one storage implementation:

  • MySQL/MariaDB, which lives in mysql/.

The design is such that both LogStorage and MapStorage models reuse a shared TreeStorage model which can store arbitrary nodes in a tree.

Anyone poking around in here should be aware that there are some subtle wrinkles introduced by the fact that Log trees grow upwards (i.e. the Log considers nodes at level 0 to be the leaves), and in contrast the Map considers the leaves to be at level 255 (and the root at 0), this is based on the HStar2 algorithm.

TreeStorage

Nodes

Nodes within the tree are each given a unique NodeID (see storage/types.go), this ID can be thought of as the binary path (0 for left, 1 for right) from the root of the tree down to the node in question (or, equivalently, as the binary representation of the node's horizonal index into the tree layer at the depth of the node.)

TODO(al): pictures!

Subtrees

The TreeStorage model does not, in fact, store all the internal nodes of the tree; it divides the tree into subtrees of depth 8 and stores the data for each subtree as a single unit. Within these subtrees, only the (subtree-relative) "leaf" nodes are actually written to disk, the internal structure of the subtrees is re-calculated when the subtree is read from disk.

Doing this compaction saves a considerable amout of on-disk space, and at least for the MySQL storage implementation, results in a ~20% speed increase.

History

Updates to the tree storage are performed in a batched fashion (i.e. some unit of update which provides a self-consistent view of the tree - e.g.:

  • n append leaf operations along with internal node updates for the LogStorage, and tagged with their sequence number.
  • n set value operations along with internal node updates for the MapStorage.

These batched updates are termed treeRevisions, and nodes updated within each revision are tagged with a monotonically incrementing sequence number.

In this fashion, the storage model records all historical revisions of the tree.

To perform lookups at a particular treeRevision, the TreeStorage simply requests nodes from disk which are associated with the given NodeID and whose treeRevsions are <= the desired revision.

Currently there's no mechanism to safely garbage collect obsolete nodes so storage grows without bound. This will be addressed at some point in the future.

Updates to the tree

The current treeRevision is defined to be the one referenced by the latest Signed [Map|Log] Head (if there is no SignedHead, then the current treeRevision is -1.)

Updates to the tree are performed in the future (i.e. at currentTreeRevision + 1), and, to allow for reasonable performance, are not required to be atomic (i.e. a tree update may partially fail), however for this to work, higher layers using the storage layer must guarantee that failed tree updates are later re-tried with either precisely the same set of node chages, or a superset there-of, in order to ensure integrity of the tree.

We intend to enforce this contract within the treeStorage layer at some point in the future.

LogStorage

TODO(al): flesh this out

LogStorage builds upon TreeStorage and additionally provides a means of storing log leaves, and SignedTreeHeads, and an API for sequencing new leaves into the tree.

MapStorage

TODO(al): flesh this out

MapStorage builds upon TreeStorage and additionally provides a means of storing map values, and SignedMapHeads.

Documentation

Overview

Package storage provides general interfaces to Trillian storage layers.

Package storage is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrMapNeedsInit = errors.New("uninitialized map")

ErrMapNeedsInit is an error returned from SnapshotForTree / BeginForTree when used on a uninitialized map storage - i.e. a new, empty map in which the Revision 0 SMH hasn't yet been created.

Functions

func CreateTree added in v1.0.4

func CreateTree(ctx context.Context, admin AdminStorage, tree *trillian.Tree) (*trillian.Tree, error)

CreateTree creates a tree in storage. It's a convenience wrapper around RunInAdminTX and AdminWriter's CreateTree. See RunInAdminTX if you need to perform more than one action per transaction.

func GetTree added in v1.0.4

func GetTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)

GetTree reads a tree from storage using a snapshot transaction. It's a convenience wrapper around RunInAdminSnapshot and AdminReader's GetTree. See RunInAdminSnapshot if you need to perform more than one action per transaction.

func HardDeleteTree added in v1.0.4

func HardDeleteTree(ctx context.Context, admin AdminStorage, treeID int64) error

HardDeleteTree hard-deletes a tree from storage. It's a convenience wrapper around RunInAdminTX and AdminWriter's HardDeleteTree. See RunInAdminTX if you need to perform more than one action per transaction.

func ListTrees added in v1.0.4

func ListTrees(ctx context.Context, admin AdminStorage, includeDeleted bool) ([]*trillian.Tree, error)

ListTrees reads trees from storage using a snapshot transaction. It's a convenience wrapper around RunInAdminSnapshot and AdminReader's ListTrees. See RunInAdminSnapshot if you need to perform more than one action per transaction.

func NewTreeID

func NewTreeID() (int64, error)

NewTreeID generates a random, positive, non-zero tree ID.

func RunInAdminSnapshot added in v1.0.4

func RunInAdminSnapshot(ctx context.Context, admin AdminStorage, fn func(tx ReadOnlyAdminTX) error) error

RunInAdminSnapshot runs fn against a ReadOnlyAdminTX and commits if no error is returned.

func RunInAdminTX added in v1.0.4

func RunInAdminTX(ctx context.Context, admin AdminStorage, fn func(tx AdminTX) error) error

RunInAdminTX runs fn against an AdminTX and commits if no error is returned.

func SoftDeleteTree added in v1.0.4

func SoftDeleteTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)

SoftDeleteTree soft-deletes a tree in storage. It's a convenience wrapper around RunInAdminTX and AdminWriter's SoftDeleteTree. See RunInAdminTX if you need to perform more than one action per transaction.

func UndeleteTree added in v1.0.4

func UndeleteTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)

UndeleteTree undeletes a tree in storage. It's a convenience wrapper around RunInAdminTX and AdminWriter's UndeleteTree. See RunInAdminTX if you need to perform more than one action per transaction.

func UpdateTree added in v1.0.4

func UpdateTree(ctx context.Context, admin AdminStorage, treeID int64, fn func(*trillian.Tree)) (*trillian.Tree, error)

UpdateTree updates a tree in storage. It's a convenience wrapper around RunInAdminTX and AdminWriter's UpdateTree. See RunInAdminTX if you need to perform more than one action per transaction.

func ValidateTreeForCreation

func ValidateTreeForCreation(ctx context.Context, tree *trillian.Tree) error

ValidateTreeForCreation returns nil if tree is valid for insertion, error otherwise. See the documentation on trillian.Tree for reference on which values are valid.

func ValidateTreeForUpdate

func ValidateTreeForUpdate(ctx context.Context, storedTree, newTree *trillian.Tree) error

ValidateTreeForUpdate returns nil if newTree is valid for update, error otherwise. The newTree is compared to the storedTree to determine if readonly fields have been changed. It's assumed that storage-generated fields, such as update_time, have not yet changed when this method is called. See the documentation on trillian.Tree for reference on which fields may be changed and what is considered valid for each of them.

Types

type AdminReader

type AdminReader interface {
	// GetTree returns the tree corresponding to treeID or an error.
	GetTree(ctx context.Context, treeID int64) (*trillian.Tree, error)

	// ListTreeIDs returns the IDs of all trees in storage.
	// Note that there's no authorization restriction on the IDs returned,
	// so it should be used with caution in production code.
	ListTreeIDs(ctx context.Context, includeDeleted bool) ([]int64, error)

	// ListTrees returns all trees in storage.
	// Note that there's no authorization restriction on the trees returned,
	// so it should be used with caution in production code.
	ListTrees(ctx context.Context, includeDeleted bool) ([]*trillian.Tree, error)
}

AdminReader provides a read-only interface for tree data.

type AdminStorage

type AdminStorage interface {
	// Snapshot starts a read-only transaction.
	// A transaction must be explicitly committed before the data read by it
	// is considered consistent.
	Snapshot(ctx context.Context) (ReadOnlyAdminTX, error)

	// Begin starts a read/write transaction.
	// A transaction must be explicitly committed before the data read by it
	// is considered consistent.
	Begin(ctx context.Context) (AdminTX, error)

	// CheckDatabaseAccessible checks whether we are able to connect to / open the
	// underlying storage.
	CheckDatabaseAccessible(ctx context.Context) error
}

AdminStorage represents the persistent storage of tree data.

type AdminTX

type AdminTX interface {
	ReadOnlyAdminTX
	AdminWriter
}

AdminTX is a transaction capable of read and write operations in the AdminStorage.

type AdminWriter

type AdminWriter interface {
	// CreateTree inserts the specified tree in storage, returning a tree
	// with all storage-generated fields set.
	// Note that treeID and timestamps will be automatically generated by
	// the storage layer, thus may be ignored by the implementation.
	// Remaining fields must be set to valid values.
	// Returns an error if the tree is invalid or creation fails.
	CreateTree(ctx context.Context, tree *trillian.Tree) (*trillian.Tree, error)

	// UpdateTree updates the specified tree in storage, returning a tree
	// with all storage-generated fields set.
	// updateFunc is called to perform the desired tree modifications. Refer
	// to trillian.Tree for details on which fields are mutable and what is
	// considered valid.
	// Returns an error if the tree is invalid or the update cannot be
	// performed.
	UpdateTree(ctx context.Context, treeID int64, updateFunc func(*trillian.Tree)) (*trillian.Tree, error)

	// SoftDeleteTree soft deletes the specified tree.
	// The tree must exist and not be already soft deleted, otherwise an error is returned.
	// Soft deletion may be undone via UndeleteTree.
	SoftDeleteTree(ctx context.Context, treeID int64) (*trillian.Tree, error)

	// HardDeleteTree hard deletes (i.e. completely removes from storage) the specified tree and all
	// records related to it.
	// The tree must exist and currently be soft deleted, as per SoftDeletedTree, otherwise an error
	// is returned.
	// Hard deleted trees cannot be recovered.
	HardDeleteTree(ctx context.Context, treeID int64) error

	// UndeleteTree undeletes a soft-deleted tree.
	// The tree must exist and currently be soft deleted, as per SoftDeletedTree, otherwise an error
	// is returned.
	UndeleteTree(ctx context.Context, treeID int64) (*trillian.Tree, error)
}

AdminWriter provides a write-only interface for tree data.

type CountByLogID

type CountByLogID map[int64]int64

CountByLogID is a map of total number of items keyed by log ID.

type DatabaseChecker

type DatabaseChecker interface {
	// CheckDatabaseAccessible returns nil if the database is accessible, error otherwise.
	CheckDatabaseAccessible(context.Context) error
}

DatabaseChecker performs connectivity checks on the database.

type Error

type Error struct {
	ErrType int
	Detail  string
	Cause   error
}

Error is a typed error that the storage layer can return to give callers information about the error to decide how to handle it.

func (Error) Error

func (s Error) Error() string

Error formats the internal details of an Error including the original cause.

type Getter

type Getter interface {
	// Get retrieves the values associates with the keyHashes, if any, at the
	// specified revision.
	// Setting revision to -1 will fetch the latest revision.
	// The returned array of MapLeaves will only contain entries for which values
	// exist.  i.e. requesting a set of unknown keys would result in a
	// zero-length array being returned.
	Get(ctx context.Context, revision int64, keyHashes [][]byte) ([]trillian.MapLeaf, error)
}

Getter allows access to the values stored in the map.

type LeafDequeuer

type LeafDequeuer interface {
	// DequeueLeaves will return between [0, limit] leaves from the queue.
	// Leaves which have been dequeued within a Rolled-back Tx will become available for dequeing again.
	// Leaves queued more recently than the cutoff time will not be returned. This allows for
	// guard intervals to be configured.
	DequeueLeaves(ctx context.Context, limit int, cutoffTime time.Time) ([]*trillian.LogLeaf, error)
	UpdateSequencedLeaves(ctx context.Context, leaves []*trillian.LogLeaf) error
}

LeafDequeuer provides an interface for reading previously queued leaves for integration into the tree.

type LeafQueuer

type LeafQueuer interface {
	// QueueLeaves enqueues leaves for later integration into the tree.
	// If error is nil, the returned slice of leaves will be the same size as the
	// input, and each entry will hold:
	//  - the existing leaf entry if a duplicate has been submitted
	//  - nil otherwise.
	// Duplicates are only reported if the underlying tree does not permit duplicates, and are
	// considered duplicate if their leaf.LeafIdentityHash matches.
	QueueLeaves(ctx context.Context, leaves []*trillian.LogLeaf, queueTimestamp time.Time) ([]*trillian.LogLeaf, error)
}

LeafQueuer provides a write-only interface for the queueing (but not necessarily integration) of leaves.

type LeafReader

type LeafReader interface {
	// GetSequencedLeafCount returns the total number of leaves that have been integrated into the
	// tree via sequencing.
	GetSequencedLeafCount(ctx context.Context) (int64, error)
	// GetLeavesByIndex returns leaf metadata and data for a set of specified sequenced leaf indexes.
	GetLeavesByIndex(ctx context.Context, leaves []int64) ([]*trillian.LogLeaf, error)
	// GetLeavesByHash looks up sequenced leaf metadata and data by their Merkle leaf hash. If the
	// tree permits duplicate leaves callers must be prepared to handle multiple results with the
	// same hash but different sequence numbers. If orderBySequence is true then the returned data
	// will be in ascending sequence number order.
	GetLeavesByHash(ctx context.Context, leafHashes [][]byte, orderBySequence bool) ([]*trillian.LogLeaf, error)
}

LeafReader provides a read only interface to stored tree leaves

type LogMetadata

type LogMetadata interface {
	// GetActiveLogs returns a list of the IDs of all the logs that are configured in storage
	GetActiveLogIDs(ctx context.Context) ([]int64, error)

	// GetUnsequencedCounts returns a map of the number of unsequenced entries
	// by log ID.
	//
	// This call is likely to be VERY expensive and take a long time to complete.
	// Consider carefully whether you really need to call it!
	GetUnsequencedCounts(ctx context.Context) (CountByLogID, error)
}

LogMetadata provides access to information about the logs in storage

type LogRootReader

type LogRootReader interface {
	// LatestSignedLogRoot returns the most recent SignedLogRoot, if any.
	LatestSignedLogRoot(ctx context.Context) (trillian.SignedLogRoot, error)
}

LogRootReader provides an interface for reading SignedLogRoots.

type LogRootWriter

type LogRootWriter interface {
	// StoreSignedLogRoot stores a freshly created SignedLogRoot.
	StoreSignedLogRoot(ctx context.Context, root trillian.SignedLogRoot) error
}

LogRootWriter provides an interface for storing new SignedLogRoots.

type LogStorage

type LogStorage interface {
	ReadOnlyLogStorage

	// BeginForTree starts a transaction for the specified treeID.
	// Either Commit or Rollback must be called when the caller is finished with
	// the returned object, and values read through it should only be propagated
	// if Commit returns without error.
	BeginForTree(ctx context.Context, treeID int64) (LogTreeTX, error)
}

LogStorage should be implemented by concrete storage mechanisms which want to support Logs.

type LogTreeTX

LogTreeTX is the transactional interface for reading/updating a Log. It extends the basic TreeTX interface with Log specific methods. After a call to Commit or Rollback implementations must be in a clean state and have released any resources owned by the LogTX. A LogTreeTX can only modify the tree specified in its creation.

type MapRootReader

type MapRootReader interface {
	// GetSignedMapRoot returns the SignedMapRoot associated with the
	// specified revision.
	GetSignedMapRoot(ctx context.Context, revision int64) (trillian.SignedMapRoot, error)
	// LatestSignedMapRoot returns the most recently created SignedMapRoot.
	LatestSignedMapRoot(ctx context.Context) (trillian.SignedMapRoot, error)
}

MapRootReader provides access to the map roots.

type MapRootWriter

type MapRootWriter interface {
	// StoreSignedMapRoot stores root.
	StoreSignedMapRoot(ctx context.Context, root trillian.SignedMapRoot) error
}

MapRootWriter allows the storage of new SignedMapRoots

type MapStorage

type MapStorage interface {
	ReadOnlyMapStorage
	// BeginForTree starts a new Map transaction.
	// Either Commit or Rollback must be called when the caller is finished with
	// the returned object, and values read through it should only be propagated
	// if Commit returns without error.
	BeginForTree(ctx context.Context, treeID int64) (MapTreeTX, error)
}

MapStorage should be implemented by concrete storage mechanisms which want to support Maps

type MapTreeTX

type MapTreeTX interface {
	TreeTX
	MapRootReader
	MapRootWriter
	Getter
	Setter
}

MapTreeTX is the transactional interface for reading/modifying a Map. It extends the basic TreeTX interface with Map specific methods. After a call to Commit or Rollback implementations must be in a clean state and have released any resources owned by the MapTX. A MapTreeTX can only read from the tree specified in its creation.

type MockAdminStorage

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

MockAdminStorage is a mock of AdminStorage interface

func NewMockAdminStorage

func NewMockAdminStorage(ctrl *gomock.Controller) *MockAdminStorage

NewMockAdminStorage creates a new mock instance

func (*MockAdminStorage) Begin

func (m *MockAdminStorage) Begin(arg0 context.Context) (AdminTX, error)

Begin mocks base method

func (*MockAdminStorage) CheckDatabaseAccessible

func (m *MockAdminStorage) CheckDatabaseAccessible(arg0 context.Context) error

CheckDatabaseAccessible mocks base method

func (*MockAdminStorage) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAdminStorage) Snapshot

func (m *MockAdminStorage) Snapshot(arg0 context.Context) (ReadOnlyAdminTX, error)

Snapshot mocks base method

type MockAdminStorageMockRecorder

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

MockAdminStorageMockRecorder is the mock recorder for MockAdminStorage

func (*MockAdminStorageMockRecorder) Begin

func (mr *MockAdminStorageMockRecorder) Begin(arg0 interface{}) *gomock.Call

Begin indicates an expected call of Begin

func (*MockAdminStorageMockRecorder) CheckDatabaseAccessible

func (mr *MockAdminStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call

CheckDatabaseAccessible indicates an expected call of CheckDatabaseAccessible

func (*MockAdminStorageMockRecorder) Snapshot

func (mr *MockAdminStorageMockRecorder) Snapshot(arg0 interface{}) *gomock.Call

Snapshot indicates an expected call of Snapshot

type MockAdminTX

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

MockAdminTX is a mock of AdminTX interface

func NewMockAdminTX

func NewMockAdminTX(ctrl *gomock.Controller) *MockAdminTX

NewMockAdminTX creates a new mock instance

func (*MockAdminTX) Close

func (m *MockAdminTX) Close() error

Close mocks base method

func (*MockAdminTX) Commit

func (m *MockAdminTX) Commit() error

Commit mocks base method

func (*MockAdminTX) CreateTree

func (m *MockAdminTX) CreateTree(arg0 context.Context, arg1 *trillian.Tree) (*trillian.Tree, error)

CreateTree mocks base method

func (*MockAdminTX) EXPECT

func (m *MockAdminTX) EXPECT() *MockAdminTXMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAdminTX) GetTree

func (m *MockAdminTX) GetTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)

GetTree mocks base method

func (*MockAdminTX) HardDeleteTree

func (m *MockAdminTX) HardDeleteTree(arg0 context.Context, arg1 int64) error

HardDeleteTree mocks base method

func (*MockAdminTX) IsClosed

func (m *MockAdminTX) IsClosed() bool

IsClosed mocks base method

func (*MockAdminTX) ListTreeIDs

func (m *MockAdminTX) ListTreeIDs(arg0 context.Context, arg1 bool) ([]int64, error)

ListTreeIDs mocks base method

func (*MockAdminTX) ListTrees

func (m *MockAdminTX) ListTrees(arg0 context.Context, arg1 bool) ([]*trillian.Tree, error)

ListTrees mocks base method

func (*MockAdminTX) Rollback

func (m *MockAdminTX) Rollback() error

Rollback mocks base method

func (*MockAdminTX) SoftDeleteTree

func (m *MockAdminTX) SoftDeleteTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)

SoftDeleteTree mocks base method

func (*MockAdminTX) UndeleteTree

func (m *MockAdminTX) UndeleteTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)

UndeleteTree mocks base method

func (*MockAdminTX) UpdateTree

func (m *MockAdminTX) UpdateTree(arg0 context.Context, arg1 int64, arg2 func(*trillian.Tree)) (*trillian.Tree, error)

UpdateTree mocks base method

type MockAdminTXMockRecorder

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

MockAdminTXMockRecorder is the mock recorder for MockAdminTX

func (*MockAdminTXMockRecorder) Close

func (mr *MockAdminTXMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockAdminTXMockRecorder) Commit

func (mr *MockAdminTXMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit

func (*MockAdminTXMockRecorder) CreateTree

func (mr *MockAdminTXMockRecorder) CreateTree(arg0, arg1 interface{}) *gomock.Call

CreateTree indicates an expected call of CreateTree

func (*MockAdminTXMockRecorder) GetTree

func (mr *MockAdminTXMockRecorder) GetTree(arg0, arg1 interface{}) *gomock.Call

GetTree indicates an expected call of GetTree

func (*MockAdminTXMockRecorder) HardDeleteTree

func (mr *MockAdminTXMockRecorder) HardDeleteTree(arg0, arg1 interface{}) *gomock.Call

HardDeleteTree indicates an expected call of HardDeleteTree

func (*MockAdminTXMockRecorder) IsClosed

func (mr *MockAdminTXMockRecorder) IsClosed() *gomock.Call

IsClosed indicates an expected call of IsClosed

func (*MockAdminTXMockRecorder) ListTreeIDs

func (mr *MockAdminTXMockRecorder) ListTreeIDs(arg0, arg1 interface{}) *gomock.Call

ListTreeIDs indicates an expected call of ListTreeIDs

func (*MockAdminTXMockRecorder) ListTrees

func (mr *MockAdminTXMockRecorder) ListTrees(arg0, arg1 interface{}) *gomock.Call

ListTrees indicates an expected call of ListTrees

func (*MockAdminTXMockRecorder) Rollback

func (mr *MockAdminTXMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback

func (*MockAdminTXMockRecorder) SoftDeleteTree

func (mr *MockAdminTXMockRecorder) SoftDeleteTree(arg0, arg1 interface{}) *gomock.Call

SoftDeleteTree indicates an expected call of SoftDeleteTree

func (*MockAdminTXMockRecorder) UndeleteTree

func (mr *MockAdminTXMockRecorder) UndeleteTree(arg0, arg1 interface{}) *gomock.Call

UndeleteTree indicates an expected call of UndeleteTree

func (*MockAdminTXMockRecorder) UpdateTree

func (mr *MockAdminTXMockRecorder) UpdateTree(arg0, arg1, arg2 interface{}) *gomock.Call

UpdateTree indicates an expected call of UpdateTree

type MockLogStorage

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

MockLogStorage is a mock of LogStorage interface

func NewMockLogStorage

func NewMockLogStorage(ctrl *gomock.Controller) *MockLogStorage

NewMockLogStorage creates a new mock instance

func (*MockLogStorage) BeginForTree

func (m *MockLogStorage) BeginForTree(arg0 context.Context, arg1 int64) (LogTreeTX, error)

BeginForTree mocks base method

func (*MockLogStorage) CheckDatabaseAccessible

func (m *MockLogStorage) CheckDatabaseAccessible(arg0 context.Context) error

CheckDatabaseAccessible mocks base method

func (*MockLogStorage) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockLogStorage) Snapshot

func (m *MockLogStorage) Snapshot(arg0 context.Context) (ReadOnlyLogTX, error)

Snapshot mocks base method

func (*MockLogStorage) SnapshotForTree

func (m *MockLogStorage) SnapshotForTree(arg0 context.Context, arg1 int64) (ReadOnlyLogTreeTX, error)

SnapshotForTree mocks base method

type MockLogStorageMockRecorder

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

MockLogStorageMockRecorder is the mock recorder for MockLogStorage

func (*MockLogStorageMockRecorder) BeginForTree

func (mr *MockLogStorageMockRecorder) BeginForTree(arg0, arg1 interface{}) *gomock.Call

BeginForTree indicates an expected call of BeginForTree

func (*MockLogStorageMockRecorder) CheckDatabaseAccessible

func (mr *MockLogStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call

CheckDatabaseAccessible indicates an expected call of CheckDatabaseAccessible

func (*MockLogStorageMockRecorder) Snapshot

func (mr *MockLogStorageMockRecorder) Snapshot(arg0 interface{}) *gomock.Call

Snapshot indicates an expected call of Snapshot

func (*MockLogStorageMockRecorder) SnapshotForTree

func (mr *MockLogStorageMockRecorder) SnapshotForTree(arg0, arg1 interface{}) *gomock.Call

SnapshotForTree indicates an expected call of SnapshotForTree

type MockLogTreeTX

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

MockLogTreeTX is a mock of LogTreeTX interface

func NewMockLogTreeTX

func NewMockLogTreeTX(ctrl *gomock.Controller) *MockLogTreeTX

NewMockLogTreeTX creates a new mock instance

func (*MockLogTreeTX) Close

func (m *MockLogTreeTX) Close() error

Close mocks base method

func (*MockLogTreeTX) Commit

func (m *MockLogTreeTX) Commit() error

Commit mocks base method

func (*MockLogTreeTX) DequeueLeaves

func (m *MockLogTreeTX) DequeueLeaves(arg0 context.Context, arg1 int, arg2 time.Time) ([]*trillian.LogLeaf, error)

DequeueLeaves mocks base method

func (*MockLogTreeTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockLogTreeTX) GetLeavesByHash

func (m *MockLogTreeTX) GetLeavesByHash(arg0 context.Context, arg1 [][]byte, arg2 bool) ([]*trillian.LogLeaf, error)

GetLeavesByHash mocks base method

func (*MockLogTreeTX) GetLeavesByIndex

func (m *MockLogTreeTX) GetLeavesByIndex(arg0 context.Context, arg1 []int64) ([]*trillian.LogLeaf, error)

GetLeavesByIndex mocks base method

func (*MockLogTreeTX) GetMerkleNodes

func (m *MockLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []NodeID) ([]Node, error)

GetMerkleNodes mocks base method

func (*MockLogTreeTX) GetSequencedLeafCount

func (m *MockLogTreeTX) GetSequencedLeafCount(arg0 context.Context) (int64, error)

GetSequencedLeafCount mocks base method

func (*MockLogTreeTX) IsOpen

func (m *MockLogTreeTX) IsOpen() bool

IsOpen mocks base method

func (*MockLogTreeTX) LatestSignedLogRoot

func (m *MockLogTreeTX) LatestSignedLogRoot(arg0 context.Context) (trillian.SignedLogRoot, error)

LatestSignedLogRoot mocks base method

func (*MockLogTreeTX) QueueLeaves

func (m *MockLogTreeTX) QueueLeaves(arg0 context.Context, arg1 []*trillian.LogLeaf, arg2 time.Time) ([]*trillian.LogLeaf, error)

QueueLeaves mocks base method

func (*MockLogTreeTX) ReadRevision

func (m *MockLogTreeTX) ReadRevision() int64

ReadRevision mocks base method

func (*MockLogTreeTX) Rollback

func (m *MockLogTreeTX) Rollback() error

Rollback mocks base method

func (*MockLogTreeTX) SetMerkleNodes

func (m *MockLogTreeTX) SetMerkleNodes(arg0 context.Context, arg1 []Node) error

SetMerkleNodes mocks base method

func (*MockLogTreeTX) StoreSignedLogRoot

func (m *MockLogTreeTX) StoreSignedLogRoot(arg0 context.Context, arg1 trillian.SignedLogRoot) error

StoreSignedLogRoot mocks base method

func (*MockLogTreeTX) UpdateSequencedLeaves

func (m *MockLogTreeTX) UpdateSequencedLeaves(arg0 context.Context, arg1 []*trillian.LogLeaf) error

UpdateSequencedLeaves mocks base method

func (*MockLogTreeTX) WriteRevision

func (m *MockLogTreeTX) WriteRevision() int64

WriteRevision mocks base method

type MockLogTreeTXMockRecorder

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

MockLogTreeTXMockRecorder is the mock recorder for MockLogTreeTX

func (*MockLogTreeTXMockRecorder) Close

func (mr *MockLogTreeTXMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockLogTreeTXMockRecorder) Commit

func (mr *MockLogTreeTXMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit

func (*MockLogTreeTXMockRecorder) DequeueLeaves

func (mr *MockLogTreeTXMockRecorder) DequeueLeaves(arg0, arg1, arg2 interface{}) *gomock.Call

DequeueLeaves indicates an expected call of DequeueLeaves

func (*MockLogTreeTXMockRecorder) GetLeavesByHash

func (mr *MockLogTreeTXMockRecorder) GetLeavesByHash(arg0, arg1, arg2 interface{}) *gomock.Call

GetLeavesByHash indicates an expected call of GetLeavesByHash

func (*MockLogTreeTXMockRecorder) GetLeavesByIndex

func (mr *MockLogTreeTXMockRecorder) GetLeavesByIndex(arg0, arg1 interface{}) *gomock.Call

GetLeavesByIndex indicates an expected call of GetLeavesByIndex

func (*MockLogTreeTXMockRecorder) GetMerkleNodes

func (mr *MockLogTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call

GetMerkleNodes indicates an expected call of GetMerkleNodes

func (*MockLogTreeTXMockRecorder) GetSequencedLeafCount

func (mr *MockLogTreeTXMockRecorder) GetSequencedLeafCount(arg0 interface{}) *gomock.Call

GetSequencedLeafCount indicates an expected call of GetSequencedLeafCount

func (*MockLogTreeTXMockRecorder) IsOpen

func (mr *MockLogTreeTXMockRecorder) IsOpen() *gomock.Call

IsOpen indicates an expected call of IsOpen

func (*MockLogTreeTXMockRecorder) LatestSignedLogRoot

func (mr *MockLogTreeTXMockRecorder) LatestSignedLogRoot(arg0 interface{}) *gomock.Call

LatestSignedLogRoot indicates an expected call of LatestSignedLogRoot

func (*MockLogTreeTXMockRecorder) QueueLeaves

func (mr *MockLogTreeTXMockRecorder) QueueLeaves(arg0, arg1, arg2 interface{}) *gomock.Call

QueueLeaves indicates an expected call of QueueLeaves

func (*MockLogTreeTXMockRecorder) ReadRevision

func (mr *MockLogTreeTXMockRecorder) ReadRevision() *gomock.Call

ReadRevision indicates an expected call of ReadRevision

func (*MockLogTreeTXMockRecorder) Rollback

func (mr *MockLogTreeTXMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback

func (*MockLogTreeTXMockRecorder) SetMerkleNodes

func (mr *MockLogTreeTXMockRecorder) SetMerkleNodes(arg0, arg1 interface{}) *gomock.Call

SetMerkleNodes indicates an expected call of SetMerkleNodes

func (*MockLogTreeTXMockRecorder) StoreSignedLogRoot

func (mr *MockLogTreeTXMockRecorder) StoreSignedLogRoot(arg0, arg1 interface{}) *gomock.Call

StoreSignedLogRoot indicates an expected call of StoreSignedLogRoot

func (*MockLogTreeTXMockRecorder) UpdateSequencedLeaves

func (mr *MockLogTreeTXMockRecorder) UpdateSequencedLeaves(arg0, arg1 interface{}) *gomock.Call

UpdateSequencedLeaves indicates an expected call of UpdateSequencedLeaves

func (*MockLogTreeTXMockRecorder) WriteRevision

func (mr *MockLogTreeTXMockRecorder) WriteRevision() *gomock.Call

WriteRevision indicates an expected call of WriteRevision

type MockMapStorage

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

MockMapStorage is a mock of MapStorage interface

func NewMockMapStorage

func NewMockMapStorage(ctrl *gomock.Controller) *MockMapStorage

NewMockMapStorage creates a new mock instance

func (*MockMapStorage) BeginForTree

func (m *MockMapStorage) BeginForTree(arg0 context.Context, arg1 int64) (MapTreeTX, error)

BeginForTree mocks base method

func (*MockMapStorage) CheckDatabaseAccessible

func (m *MockMapStorage) CheckDatabaseAccessible(arg0 context.Context) error

CheckDatabaseAccessible mocks base method

func (*MockMapStorage) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMapStorage) Snapshot

func (m *MockMapStorage) Snapshot(arg0 context.Context) (ReadOnlyMapTX, error)

Snapshot mocks base method

func (*MockMapStorage) SnapshotForTree

func (m *MockMapStorage) SnapshotForTree(arg0 context.Context, arg1 int64) (ReadOnlyMapTreeTX, error)

SnapshotForTree mocks base method

type MockMapStorageMockRecorder

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

MockMapStorageMockRecorder is the mock recorder for MockMapStorage

func (*MockMapStorageMockRecorder) BeginForTree

func (mr *MockMapStorageMockRecorder) BeginForTree(arg0, arg1 interface{}) *gomock.Call

BeginForTree indicates an expected call of BeginForTree

func (*MockMapStorageMockRecorder) CheckDatabaseAccessible

func (mr *MockMapStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call

CheckDatabaseAccessible indicates an expected call of CheckDatabaseAccessible

func (*MockMapStorageMockRecorder) Snapshot

func (mr *MockMapStorageMockRecorder) Snapshot(arg0 interface{}) *gomock.Call

Snapshot indicates an expected call of Snapshot

func (*MockMapStorageMockRecorder) SnapshotForTree

func (mr *MockMapStorageMockRecorder) SnapshotForTree(arg0, arg1 interface{}) *gomock.Call

SnapshotForTree indicates an expected call of SnapshotForTree

type MockMapTreeTX

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

MockMapTreeTX is a mock of MapTreeTX interface

func NewMockMapTreeTX

func NewMockMapTreeTX(ctrl *gomock.Controller) *MockMapTreeTX

NewMockMapTreeTX creates a new mock instance

func (*MockMapTreeTX) Close

func (m *MockMapTreeTX) Close() error

Close mocks base method

func (*MockMapTreeTX) Commit

func (m *MockMapTreeTX) Commit() error

Commit mocks base method

func (*MockMapTreeTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMapTreeTX) Get

func (m *MockMapTreeTX) Get(arg0 context.Context, arg1 int64, arg2 [][]byte) ([]trillian.MapLeaf, error)

Get mocks base method

func (*MockMapTreeTX) GetMerkleNodes

func (m *MockMapTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []NodeID) ([]Node, error)

GetMerkleNodes mocks base method

func (*MockMapTreeTX) GetSignedMapRoot

func (m *MockMapTreeTX) GetSignedMapRoot(arg0 context.Context, arg1 int64) (trillian.SignedMapRoot, error)

GetSignedMapRoot mocks base method

func (*MockMapTreeTX) IsOpen

func (m *MockMapTreeTX) IsOpen() bool

IsOpen mocks base method

func (*MockMapTreeTX) LatestSignedMapRoot

func (m *MockMapTreeTX) LatestSignedMapRoot(arg0 context.Context) (trillian.SignedMapRoot, error)

LatestSignedMapRoot mocks base method

func (*MockMapTreeTX) ReadRevision

func (m *MockMapTreeTX) ReadRevision() int64

ReadRevision mocks base method

func (*MockMapTreeTX) Rollback

func (m *MockMapTreeTX) Rollback() error

Rollback mocks base method

func (*MockMapTreeTX) Set

func (m *MockMapTreeTX) Set(arg0 context.Context, arg1 []byte, arg2 trillian.MapLeaf) error

Set mocks base method

func (*MockMapTreeTX) SetMerkleNodes

func (m *MockMapTreeTX) SetMerkleNodes(arg0 context.Context, arg1 []Node) error

SetMerkleNodes mocks base method

func (*MockMapTreeTX) StoreSignedMapRoot

func (m *MockMapTreeTX) StoreSignedMapRoot(arg0 context.Context, arg1 trillian.SignedMapRoot) error

StoreSignedMapRoot mocks base method

func (*MockMapTreeTX) WriteRevision

func (m *MockMapTreeTX) WriteRevision() int64

WriteRevision mocks base method

type MockMapTreeTXMockRecorder

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

MockMapTreeTXMockRecorder is the mock recorder for MockMapTreeTX

func (*MockMapTreeTXMockRecorder) Close

func (mr *MockMapTreeTXMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockMapTreeTXMockRecorder) Commit

func (mr *MockMapTreeTXMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit

func (*MockMapTreeTXMockRecorder) Get

func (mr *MockMapTreeTXMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockMapTreeTXMockRecorder) GetMerkleNodes

func (mr *MockMapTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call

GetMerkleNodes indicates an expected call of GetMerkleNodes

func (*MockMapTreeTXMockRecorder) GetSignedMapRoot

func (mr *MockMapTreeTXMockRecorder) GetSignedMapRoot(arg0, arg1 interface{}) *gomock.Call

GetSignedMapRoot indicates an expected call of GetSignedMapRoot

func (*MockMapTreeTXMockRecorder) IsOpen

func (mr *MockMapTreeTXMockRecorder) IsOpen() *gomock.Call

IsOpen indicates an expected call of IsOpen

func (*MockMapTreeTXMockRecorder) LatestSignedMapRoot

func (mr *MockMapTreeTXMockRecorder) LatestSignedMapRoot(arg0 interface{}) *gomock.Call

LatestSignedMapRoot indicates an expected call of LatestSignedMapRoot

func (*MockMapTreeTXMockRecorder) ReadRevision

func (mr *MockMapTreeTXMockRecorder) ReadRevision() *gomock.Call

ReadRevision indicates an expected call of ReadRevision

func (*MockMapTreeTXMockRecorder) Rollback

func (mr *MockMapTreeTXMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback

func (*MockMapTreeTXMockRecorder) Set

func (mr *MockMapTreeTXMockRecorder) Set(arg0, arg1, arg2 interface{}) *gomock.Call

Set indicates an expected call of Set

func (*MockMapTreeTXMockRecorder) SetMerkleNodes

func (mr *MockMapTreeTXMockRecorder) SetMerkleNodes(arg0, arg1 interface{}) *gomock.Call

SetMerkleNodes indicates an expected call of SetMerkleNodes

func (*MockMapTreeTXMockRecorder) StoreSignedMapRoot

func (mr *MockMapTreeTXMockRecorder) StoreSignedMapRoot(arg0, arg1 interface{}) *gomock.Call

StoreSignedMapRoot indicates an expected call of StoreSignedMapRoot

func (*MockMapTreeTXMockRecorder) WriteRevision

func (mr *MockMapTreeTXMockRecorder) WriteRevision() *gomock.Call

WriteRevision indicates an expected call of WriteRevision

type MockReadOnlyAdminTX

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

MockReadOnlyAdminTX is a mock of ReadOnlyAdminTX interface

func NewMockReadOnlyAdminTX

func NewMockReadOnlyAdminTX(ctrl *gomock.Controller) *MockReadOnlyAdminTX

NewMockReadOnlyAdminTX creates a new mock instance

func (*MockReadOnlyAdminTX) Close

func (m *MockReadOnlyAdminTX) Close() error

Close mocks base method

func (*MockReadOnlyAdminTX) Commit

func (m *MockReadOnlyAdminTX) Commit() error

Commit mocks base method

func (*MockReadOnlyAdminTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockReadOnlyAdminTX) GetTree

func (m *MockReadOnlyAdminTX) GetTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)

GetTree mocks base method

func (*MockReadOnlyAdminTX) IsClosed

func (m *MockReadOnlyAdminTX) IsClosed() bool

IsClosed mocks base method

func (*MockReadOnlyAdminTX) ListTreeIDs

func (m *MockReadOnlyAdminTX) ListTreeIDs(arg0 context.Context, arg1 bool) ([]int64, error)

ListTreeIDs mocks base method

func (*MockReadOnlyAdminTX) ListTrees

func (m *MockReadOnlyAdminTX) ListTrees(arg0 context.Context, arg1 bool) ([]*trillian.Tree, error)

ListTrees mocks base method

func (*MockReadOnlyAdminTX) Rollback

func (m *MockReadOnlyAdminTX) Rollback() error

Rollback mocks base method

type MockReadOnlyAdminTXMockRecorder

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

MockReadOnlyAdminTXMockRecorder is the mock recorder for MockReadOnlyAdminTX

func (*MockReadOnlyAdminTXMockRecorder) Close

Close indicates an expected call of Close

func (*MockReadOnlyAdminTXMockRecorder) Commit

Commit indicates an expected call of Commit

func (*MockReadOnlyAdminTXMockRecorder) GetTree

func (mr *MockReadOnlyAdminTXMockRecorder) GetTree(arg0, arg1 interface{}) *gomock.Call

GetTree indicates an expected call of GetTree

func (*MockReadOnlyAdminTXMockRecorder) IsClosed

IsClosed indicates an expected call of IsClosed

func (*MockReadOnlyAdminTXMockRecorder) ListTreeIDs

func (mr *MockReadOnlyAdminTXMockRecorder) ListTreeIDs(arg0, arg1 interface{}) *gomock.Call

ListTreeIDs indicates an expected call of ListTreeIDs

func (*MockReadOnlyAdminTXMockRecorder) ListTrees

func (mr *MockReadOnlyAdminTXMockRecorder) ListTrees(arg0, arg1 interface{}) *gomock.Call

ListTrees indicates an expected call of ListTrees

func (*MockReadOnlyAdminTXMockRecorder) Rollback

Rollback indicates an expected call of Rollback

type MockReadOnlyLogTX

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

MockReadOnlyLogTX is a mock of ReadOnlyLogTX interface

func NewMockReadOnlyLogTX

func NewMockReadOnlyLogTX(ctrl *gomock.Controller) *MockReadOnlyLogTX

NewMockReadOnlyLogTX creates a new mock instance

func (*MockReadOnlyLogTX) Close

func (m *MockReadOnlyLogTX) Close() error

Close mocks base method

func (*MockReadOnlyLogTX) Commit

func (m *MockReadOnlyLogTX) Commit() error

Commit mocks base method

func (*MockReadOnlyLogTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockReadOnlyLogTX) GetActiveLogIDs

func (m *MockReadOnlyLogTX) GetActiveLogIDs(arg0 context.Context) ([]int64, error)

GetActiveLogIDs mocks base method

func (*MockReadOnlyLogTX) GetUnsequencedCounts

func (m *MockReadOnlyLogTX) GetUnsequencedCounts(arg0 context.Context) (CountByLogID, error)

GetUnsequencedCounts mocks base method

func (*MockReadOnlyLogTX) Rollback

func (m *MockReadOnlyLogTX) Rollback() error

Rollback mocks base method

type MockReadOnlyLogTXMockRecorder

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

MockReadOnlyLogTXMockRecorder is the mock recorder for MockReadOnlyLogTX

func (*MockReadOnlyLogTXMockRecorder) Close

Close indicates an expected call of Close

func (*MockReadOnlyLogTXMockRecorder) Commit

Commit indicates an expected call of Commit

func (*MockReadOnlyLogTXMockRecorder) GetActiveLogIDs

func (mr *MockReadOnlyLogTXMockRecorder) GetActiveLogIDs(arg0 interface{}) *gomock.Call

GetActiveLogIDs indicates an expected call of GetActiveLogIDs

func (*MockReadOnlyLogTXMockRecorder) GetUnsequencedCounts

func (mr *MockReadOnlyLogTXMockRecorder) GetUnsequencedCounts(arg0 interface{}) *gomock.Call

GetUnsequencedCounts indicates an expected call of GetUnsequencedCounts

func (*MockReadOnlyLogTXMockRecorder) Rollback

func (mr *MockReadOnlyLogTXMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback

type MockReadOnlyLogTreeTX

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

MockReadOnlyLogTreeTX is a mock of ReadOnlyLogTreeTX interface

func NewMockReadOnlyLogTreeTX

func NewMockReadOnlyLogTreeTX(ctrl *gomock.Controller) *MockReadOnlyLogTreeTX

NewMockReadOnlyLogTreeTX creates a new mock instance

func (*MockReadOnlyLogTreeTX) Close

func (m *MockReadOnlyLogTreeTX) Close() error

Close mocks base method

func (*MockReadOnlyLogTreeTX) Commit

func (m *MockReadOnlyLogTreeTX) Commit() error

Commit mocks base method

func (*MockReadOnlyLogTreeTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockReadOnlyLogTreeTX) GetLeavesByHash

func (m *MockReadOnlyLogTreeTX) GetLeavesByHash(arg0 context.Context, arg1 [][]byte, arg2 bool) ([]*trillian.LogLeaf, error)

GetLeavesByHash mocks base method

func (*MockReadOnlyLogTreeTX) GetLeavesByIndex

func (m *MockReadOnlyLogTreeTX) GetLeavesByIndex(arg0 context.Context, arg1 []int64) ([]*trillian.LogLeaf, error)

GetLeavesByIndex mocks base method

func (*MockReadOnlyLogTreeTX) GetMerkleNodes

func (m *MockReadOnlyLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []NodeID) ([]Node, error)

GetMerkleNodes mocks base method

func (*MockReadOnlyLogTreeTX) GetSequencedLeafCount

func (m *MockReadOnlyLogTreeTX) GetSequencedLeafCount(arg0 context.Context) (int64, error)

GetSequencedLeafCount mocks base method

func (*MockReadOnlyLogTreeTX) IsOpen

func (m *MockReadOnlyLogTreeTX) IsOpen() bool

IsOpen mocks base method

func (*MockReadOnlyLogTreeTX) LatestSignedLogRoot

func (m *MockReadOnlyLogTreeTX) LatestSignedLogRoot(arg0 context.Context) (trillian.SignedLogRoot, error)

LatestSignedLogRoot mocks base method

func (*MockReadOnlyLogTreeTX) ReadRevision

func (m *MockReadOnlyLogTreeTX) ReadRevision() int64

ReadRevision mocks base method

func (*MockReadOnlyLogTreeTX) Rollback

func (m *MockReadOnlyLogTreeTX) Rollback() error

Rollback mocks base method

type MockReadOnlyLogTreeTXMockRecorder

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

MockReadOnlyLogTreeTXMockRecorder is the mock recorder for MockReadOnlyLogTreeTX

func (*MockReadOnlyLogTreeTXMockRecorder) Close

Close indicates an expected call of Close

func (*MockReadOnlyLogTreeTXMockRecorder) Commit

Commit indicates an expected call of Commit

func (*MockReadOnlyLogTreeTXMockRecorder) GetLeavesByHash

func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByHash(arg0, arg1, arg2 interface{}) *gomock.Call

GetLeavesByHash indicates an expected call of GetLeavesByHash

func (*MockReadOnlyLogTreeTXMockRecorder) GetLeavesByIndex

func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByIndex(arg0, arg1 interface{}) *gomock.Call

GetLeavesByIndex indicates an expected call of GetLeavesByIndex

func (*MockReadOnlyLogTreeTXMockRecorder) GetMerkleNodes

func (mr *MockReadOnlyLogTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call

GetMerkleNodes indicates an expected call of GetMerkleNodes

func (*MockReadOnlyLogTreeTXMockRecorder) GetSequencedLeafCount

func (mr *MockReadOnlyLogTreeTXMockRecorder) GetSequencedLeafCount(arg0 interface{}) *gomock.Call

GetSequencedLeafCount indicates an expected call of GetSequencedLeafCount

func (*MockReadOnlyLogTreeTXMockRecorder) IsOpen

IsOpen indicates an expected call of IsOpen

func (*MockReadOnlyLogTreeTXMockRecorder) LatestSignedLogRoot

func (mr *MockReadOnlyLogTreeTXMockRecorder) LatestSignedLogRoot(arg0 interface{}) *gomock.Call

LatestSignedLogRoot indicates an expected call of LatestSignedLogRoot

func (*MockReadOnlyLogTreeTXMockRecorder) ReadRevision

func (mr *MockReadOnlyLogTreeTXMockRecorder) ReadRevision() *gomock.Call

ReadRevision indicates an expected call of ReadRevision

func (*MockReadOnlyLogTreeTXMockRecorder) Rollback

Rollback indicates an expected call of Rollback

type MockReadOnlyMapTreeTX

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

MockReadOnlyMapTreeTX is a mock of ReadOnlyMapTreeTX interface

func NewMockReadOnlyMapTreeTX

func NewMockReadOnlyMapTreeTX(ctrl *gomock.Controller) *MockReadOnlyMapTreeTX

NewMockReadOnlyMapTreeTX creates a new mock instance

func (*MockReadOnlyMapTreeTX) Close

func (m *MockReadOnlyMapTreeTX) Close() error

Close mocks base method

func (*MockReadOnlyMapTreeTX) Commit

func (m *MockReadOnlyMapTreeTX) Commit() error

Commit mocks base method

func (*MockReadOnlyMapTreeTX) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockReadOnlyMapTreeTX) Get

func (m *MockReadOnlyMapTreeTX) Get(arg0 context.Context, arg1 int64, arg2 [][]byte) ([]trillian.MapLeaf, error)

Get mocks base method

func (*MockReadOnlyMapTreeTX) GetMerkleNodes

func (m *MockReadOnlyMapTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []NodeID) ([]Node, error)

GetMerkleNodes mocks base method

func (*MockReadOnlyMapTreeTX) GetSignedMapRoot

func (m *MockReadOnlyMapTreeTX) GetSignedMapRoot(arg0 context.Context, arg1 int64) (trillian.SignedMapRoot, error)

GetSignedMapRoot mocks base method

func (*MockReadOnlyMapTreeTX) IsOpen

func (m *MockReadOnlyMapTreeTX) IsOpen() bool

IsOpen mocks base method

func (*MockReadOnlyMapTreeTX) LatestSignedMapRoot

func (m *MockReadOnlyMapTreeTX) LatestSignedMapRoot(arg0 context.Context) (trillian.SignedMapRoot, error)

LatestSignedMapRoot mocks base method

func (*MockReadOnlyMapTreeTX) ReadRevision

func (m *MockReadOnlyMapTreeTX) ReadRevision() int64

ReadRevision mocks base method

func (*MockReadOnlyMapTreeTX) Rollback

func (m *MockReadOnlyMapTreeTX) Rollback() error

Rollback mocks base method

type MockReadOnlyMapTreeTXMockRecorder

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

MockReadOnlyMapTreeTXMockRecorder is the mock recorder for MockReadOnlyMapTreeTX

func (*MockReadOnlyMapTreeTXMockRecorder) Close

Close indicates an expected call of Close

func (*MockReadOnlyMapTreeTXMockRecorder) Commit

Commit indicates an expected call of Commit

func (*MockReadOnlyMapTreeTXMockRecorder) Get

func (mr *MockReadOnlyMapTreeTXMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockReadOnlyMapTreeTXMockRecorder) GetMerkleNodes

func (mr *MockReadOnlyMapTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call

GetMerkleNodes indicates an expected call of GetMerkleNodes

func (*MockReadOnlyMapTreeTXMockRecorder) GetSignedMapRoot

func (mr *MockReadOnlyMapTreeTXMockRecorder) GetSignedMapRoot(arg0, arg1 interface{}) *gomock.Call

GetSignedMapRoot indicates an expected call of GetSignedMapRoot

func (*MockReadOnlyMapTreeTXMockRecorder) IsOpen

IsOpen indicates an expected call of IsOpen

func (*MockReadOnlyMapTreeTXMockRecorder) LatestSignedMapRoot

func (mr *MockReadOnlyMapTreeTXMockRecorder) LatestSignedMapRoot(arg0 interface{}) *gomock.Call

LatestSignedMapRoot indicates an expected call of LatestSignedMapRoot

func (*MockReadOnlyMapTreeTXMockRecorder) ReadRevision

func (mr *MockReadOnlyMapTreeTXMockRecorder) ReadRevision() *gomock.Call

ReadRevision indicates an expected call of ReadRevision

func (*MockReadOnlyMapTreeTXMockRecorder) Rollback

Rollback indicates an expected call of Rollback

type Node

type Node struct {
	NodeID       NodeID
	Hash         []byte
	NodeRevision int64
}

Node represents a single node in a Merkle tree.

type NodeID

type NodeID struct {
	// path is effectively a BigEndian bit set, with path[0] being the MSB
	// (identifying the root child), and successive bits identifying the lower
	// level children down to the leaf.
	Path []byte
	// PrefixLenBits is the number of MSB in Path which are considered part of
	// this NodeID.
	//
	// e.g. if Path contains two bytes, and PrefixLenBits is 9, then the 8 bits
	// in Path[0] are included, along with the lowest bit of Path[1]
	PrefixLenBits int
}

NodeID uniquely identifies a Node within a versioned MerkleTree.

func NewEmptyNodeID

func NewEmptyNodeID(maxLenBits int) NodeID

NewEmptyNodeID creates a new zero-length NodeID with sufficient underlying capacity to store a maximum of maxLenBits.

func NewNodeIDForTreeCoords

func NewNodeIDForTreeCoords(depth int64, index int64, maxPathBits int) (NodeID, error)

NewNodeIDForTreeCoords creates a new NodeID for a Tree node with a specified depth and index. This method is used exclusively by the Log, and, since the Log model grows upwards from the leaves, we modify the provided coords accordingly.

depth is the Merkle tree level: 0 = leaves, and increases upwards towards the root.

index is the horizontal index into the tree at level depth, so the returned NodeID will be zero padded on the right by depth places.

func NewNodeIDFromBigInt

func NewNodeIDFromBigInt(depth int, index *big.Int, totalDepth int) NodeID

NewNodeIDFromBigInt returns a NodeID of a big.Int with no prefix. index contains the path's least significant bits. depth indicates the number of bits from the most significant bit to treat as part of the path.

func NewNodeIDFromHash

func NewNodeIDFromHash(h []byte) NodeID

NewNodeIDFromHash creates a new NodeID for the given Hash.

func NewNodeIDFromPrefix

func NewNodeIDFromPrefix(prefix []byte, depth int, index int64, subDepth, totalDepth int) NodeID

NewNodeIDFromPrefix returns a nodeID for a particular node within a subtree. Prefix is the prefix of the subtree. depth is the depth of index from the root of the subtree. index is the horizontal location of the subtree leaf. subDepth is the total number of levels in the subtree. totalDepth is the number of levels in the whole tree.

func NewNodeIDFromPrefixSuffix

func NewNodeIDFromPrefixSuffix(prefix []byte, suffix Suffix, maxPathBits int) NodeID

NewNodeIDFromPrefixSuffix undoes Split() and returns the NodeID.

func NewNodeIDWithPrefix

func NewNodeIDWithPrefix(prefix uint64, prefixLenBits, nodeIDLenBits, maxLenBits int) NodeID

NewNodeIDWithPrefix creates a new NodeID of nodeIDLen bits with the prefixLen MSBs set to prefix. NewNodeIDWithPrefix places the lower prefixLenBits of prefix in the most significant bits of path. Path will have enough bytes to hold maxLenBits

func (NodeID) BigInt

func (n NodeID) BigInt() *big.Int

BigInt returns the big.Int for this node.

func (*NodeID) Bit

func (n *NodeID) Bit(i int) uint

Bit returns 1 if the ith bit from the right is true, and false otherwise.

func (*NodeID) CoordString

func (n *NodeID) CoordString() string

CoordString returns a string representation assuming that the NodeID represents a tree coordinate. Using this on a NodeID for a sparse Merkle tree will give incorrect results. Intended for debugging purposes, the format could change.

func (*NodeID) Copy

func (n *NodeID) Copy() *NodeID

Copy returns a duplicate of NodeID

func (*NodeID) Equivalent

func (n *NodeID) Equivalent(other NodeID) bool

Equivalent return true iff the other represents the same path prefix as this NodeID.

func (*NodeID) FlipRightBit

func (n *NodeID) FlipRightBit(i int) *NodeID

FlipRightBit flips the ith bit from LSB

func (*NodeID) MaskLeft

func (n *NodeID) MaskLeft(depth int) *NodeID

MaskLeft returns NodeID with only the left n bits set

func (*NodeID) Neighbor

func (n *NodeID) Neighbor() *NodeID

Neighbor returns the same node with the bit at PrefixLenBits flipped.

func (NodeID) PathLenBits

func (n NodeID) PathLenBits() int

PathLenBits returns 8 * len(path).

func (*NodeID) SetBit

func (n *NodeID) SetBit(i int, b uint)

SetBit sets the ith bit to true if b is non-zero, and false otherwise.

func (*NodeID) Siblings

func (n *NodeID) Siblings() []NodeID

Siblings returns the siblings of the given node.

func (*NodeID) Split

func (n *NodeID) Split(prefixBytes, suffixBits int) ([]byte, Suffix)

Split splits a NodeID into a prefix and a suffix at prefixSplit

func (*NodeID) String

func (n *NodeID) String() string

String returns a string representation of the binary value of the NodeID. The left-most bit is the MSB (i.e. nearer the root of the tree).

type NodeReader

type NodeReader interface {
	// GetMerkleNodes looks up the set of nodes identified by ids, at treeRevision, and returns them.
	GetMerkleNodes(ctx context.Context, treeRevision int64, ids []NodeID) ([]Node, error)
}

NodeReader provides a read-only interface into the stored tree nodes.

type NodeWriter

type NodeWriter interface {
	// SetMerkleNodes stores the provided nodes, at the transaction's writeRevision.
	SetMerkleNodes(ctx context.Context, nodes []Node) error
}

NodeWriter provides a write interface into the stored tree nodes.

type PopulateSubtreeFunc

type PopulateSubtreeFunc func(*storagepb.SubtreeProto) error

PopulateSubtreeFunc is a function which knows how to re-populate a subtree from just its leaf nodes.

type PrepareSubtreeWriteFunc

type PrepareSubtreeWriteFunc func(*storagepb.SubtreeProto) error

PrepareSubtreeWriteFunc is a function that carries out any required tree type specific manipulation of a subtree before it's written to storage

type ReadOnlyAdminTX

type ReadOnlyAdminTX interface {
	AdminReader

	// Commit applies the operations performed to the underlying storage, or
	// returns an error.
	// A commit must be performed before any reads from storage are
	// considered consistent.
	Commit() error

	// Rollback aborts any performed operations, or returns an error.
	// See Close() for a way to automatically manage transactions.
	Rollback() error

	// IsClosed returns true if the transaction is closed.
	// A transaction is closed when either Commit() or Rollback() are
	// called.
	IsClosed() bool

	// Close rolls back the transaction if it's not yet closed.
	// It's advisable to call "defer tx.Close()" after the creation of
	// transaction to ensure that it's always rolled back if not explicitly
	// committed.
	Close() error
}

ReadOnlyAdminTX is a transaction capable only of read operations in the AdminStorage.

type ReadOnlyLogStorage

type ReadOnlyLogStorage interface {
	DatabaseChecker

	// Snapshot starts a read-only transaction not tied to any particular tree.
	Snapshot(ctx context.Context) (ReadOnlyLogTX, error)

	// SnapshotForTree starts a read-only transaction for the specified treeID.
	// Commit must be called when the caller is finished with the returned object,
	// and values read through it should only be propagated if Commit returns
	// without error.
	SnapshotForTree(ctx context.Context, treeID int64) (ReadOnlyLogTreeTX, error)
}

ReadOnlyLogStorage represents a narrowed read-only view into a LogStorage.

type ReadOnlyLogTX

type ReadOnlyLogTX interface {
	LogMetadata

	// Commit ensures the data read by the TX is consistent in the database. Only after Commit the
	// data read should be regarded as valid.
	Commit() error

	// Rollback discards the read-only TX.
	Rollback() error

	// Close attempts to Rollback the TX if it's open, it's a noop otherwise.
	Close() error
}

ReadOnlyLogTX provides a read-only view into log data. A ReadOnlyLogTX, unlike ReadOnlyLogTreeTX, is not tied to a particular tree.

type ReadOnlyLogTreeTX

type ReadOnlyLogTreeTX interface {
	ReadOnlyTreeTX
	LeafReader
	LogRootReader
}

ReadOnlyLogTreeTX provides a read-only view into the Log data. A ReadOnlyLogTreeTX can only read from the tree specified in its creation.

type ReadOnlyMapStorage

type ReadOnlyMapStorage interface {
	DatabaseChecker

	// Snapshot starts a read-only transaction not tied to any particular tree.
	Snapshot(ctx context.Context) (ReadOnlyMapTX, error)

	// SnapshotForTree starts a new read-only transaction.
	// Commit must be called when the caller is finished with the returned object,
	// and values read through it should only be propagated if Commit returns
	// without error.
	SnapshotForTree(ctx context.Context, treeID int64) (ReadOnlyMapTreeTX, error)
}

ReadOnlyMapStorage provides a narrow read-only view into a MapStorage.

type ReadOnlyMapTX

type ReadOnlyMapTX interface {
	// Commit ensures the data read by the TX is consistent in the database. Only after Commit the
	// data read should be regarded as valid.
	Commit() error

	// Rollback discards the read-only TX.
	Rollback() error

	// Close attempts to Rollback the TX if it's open, it's a noop otherwise.
	Close() error
}

ReadOnlyMapTX provides a read-only view into log data. A ReadOnlyMapTX, unlike ReadOnlyMapTreeTX, is not tied to a particular tree.

type ReadOnlyMapTreeTX

type ReadOnlyMapTreeTX interface {
	ReadOnlyTreeTX
	MapRootReader
	Getter
}

ReadOnlyMapTreeTX provides a read-only view into the Map data. A ReadOnlyMapTreeTX can only read from the tree specified in its creation.

type ReadOnlyTreeTX

type ReadOnlyTreeTX interface {
	NodeReader

	// ReadRevision returns the tree revision that was current at the time this
	// transaction was started.
	ReadRevision() int64

	// Commit attempts to commit any reads performed under this transaction.
	Commit() error

	// Rollback aborts this transaction.
	Rollback() error

	// Close attempts to Rollback the TX if it's open, it's a noop otherwise.
	Close() error

	// Open indicates if this transaction is open. An open transaction is one for which
	// Commit() or Rollback() has never been called. Implementations must do all clean up
	// in these methods so transactions are assumed closed regardless of the reported success.
	IsOpen() bool
}

ReadOnlyTreeTX represents a read-only transaction on a TreeStorage. A ReadOnlyTreeTX can only modify the tree specified in its creation.

type Setter

type Setter interface {
	// Set sets key to leaf
	Set(ctx context.Context, keyHash []byte, value trillian.MapLeaf) error
}

Setter allows the setting of key->value pairs on the map.

type Suffix

type Suffix struct {
	// bits is the number of bits in the node ID suffix.
	// TODO(gdbelvin): make bits an integer.
	Bits byte
	// path is the suffix itself.
	Path []byte
}

Suffix represents the tail of a NodeID. It is the path within the subtree. The portion of the path that extends beyond the subtree is not part of this suffix.

func ParseSuffix

func ParseSuffix(s string) (Suffix, error)

ParseSuffix converts a suffix string back into a Suffix.

func (Suffix) String

func (s Suffix) String() string

String returns a string that represents Suffix. This is a base64 encoding of the following format: [ 1 byte for depth || path bytes ]

type TreeTX

type TreeTX interface {
	ReadOnlyTreeTX
	NodeWriter

	// WriteRevision returns the tree revision that any writes through this TreeTX will be stored at.
	WriteRevision() int64
}

TreeTX represents an in-process tree-modifying transaction. The transaction must end with a call to Commit or Rollback. After a call to Commit or Rollback, all operations on the transaction will fail. After a call to Commit or Rollback implementations must be in a clean state and have released any resources owned by the TreeTX. A TreeTX can only modify the tree specified in its creation.

Directories

Path Synopsis
Package cache provides subtree caching functionality.
Package cache provides subtree caching functionality.
Package memory provides a simple in-process implementation of the tree- and log-storage interfaces.
Package memory provides a simple in-process implementation of the tree- and log-storage interfaces.
Package mysql provides a MySQL-based storage layer implementation.
Package mysql provides a MySQL-based storage layer implementation.
Package storagepb is a generated protocol buffer package.
Package storagepb is a generated protocol buffer package.
Package testdb creates new databases for tests.
Package testdb creates new databases for tests.
Package testonly holds test-specific code for Trillian storage layers.
Package testonly holds test-specific code for Trillian storage layers.
tools
dump_tree
The dump_tree program uses the in memory storage implementation to create a sequenced log tree of a particular size using known leaf data and then dumps out the resulting SubTree protos for examination and debugging.
The dump_tree program uses the in memory storage implementation to create a sequenced log tree of a particular size using known leaf data and then dumps out the resulting SubTree protos for examination and debugging.
fetch_leaves
The fetch_leaves program retrieves leaves from a tree.
The fetch_leaves program retrieves leaves from a tree.
hasher
The hasher program provides a simple CLI for producing Merkle tree hashes.
The hasher program provides a simple CLI for producing Merkle tree hashes.
log_client
The log_client binary retrieves leaves from a log.
The log_client binary retrieves leaves from a log.
queue_leaves
The queue_leaves binary queues a number of leaves for a log from a given start point with predictable hashes.
The queue_leaves binary queues a number of leaves for a log from a given start point with predictable hashes.

Jump to

Keyboard shortcuts

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