Documentation ¶
Overview ¶
Package storage provides general interfaces to Trillian storage layers.
Package storage is a generated GoMock package.
Index ¶
- Variables
- func CreateTree(ctx context.Context, admin AdminStorage, tree *trillian.Tree) (*trillian.Tree, error)
- func FromMillisSinceEpoch(ts int64) time.Time
- func GetTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)
- func HardDeleteTree(ctx context.Context, admin AdminStorage, treeID int64) error
- func ListTrees(ctx context.Context, admin AdminStorage, includeDeleted bool) ([]*trillian.Tree, error)
- func NewTreeID() (int64, error)
- func Providers() []string
- func ReadTree(row Row) (*trillian.Tree, error)
- func RegisterProvider(name string, sp NewProviderFunc) error
- func RunInAdminSnapshot(ctx context.Context, admin AdminStorage, fn func(tx ReadOnlyAdminTX) error) error
- func SetNullStringIfValid(src sql.NullString, dest *string)
- func SoftDeleteTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)
- func ToMillisSinceEpoch(t time.Time) int64
- func UndeleteTree(ctx context.Context, admin AdminStorage, treeID int64) (*trillian.Tree, error)
- func UpdateTree(ctx context.Context, admin AdminStorage, treeID int64, fn func(*trillian.Tree)) (*trillian.Tree, error)
- func ValidateTreeForCreation(ctx context.Context, tree *trillian.Tree) error
- func ValidateTreeForUpdate(ctx context.Context, storedTree, newTree *trillian.Tree) error
- type AdminReader
- type AdminStorage
- type AdminTX
- type AdminTXFunc
- type AdminWriter
- type CountByLogID
- type DatabaseChecker
- type LogMetadata
- type LogStorage
- type LogTXFunc
- type LogTreeTX
- type MockAdminStorage
- func (m *MockAdminStorage) CheckDatabaseAccessible(arg0 context.Context) error
- func (m *MockAdminStorage) EXPECT() *MockAdminStorageMockRecorder
- func (m *MockAdminStorage) ReadWriteTransaction(arg0 context.Context, arg1 AdminTXFunc) error
- func (m *MockAdminStorage) Snapshot(arg0 context.Context) (ReadOnlyAdminTX, error)
- type MockAdminStorageMockRecorder
- type MockAdminTX
- func (m *MockAdminTX) Close() error
- func (m *MockAdminTX) Commit() error
- func (m *MockAdminTX) CreateTree(arg0 context.Context, arg1 *trillian.Tree) (*trillian.Tree, error)
- func (m *MockAdminTX) EXPECT() *MockAdminTXMockRecorder
- func (m *MockAdminTX) GetTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)
- func (m *MockAdminTX) HardDeleteTree(arg0 context.Context, arg1 int64) error
- func (m *MockAdminTX) IsClosed() bool
- func (m *MockAdminTX) ListTreeIDs(arg0 context.Context, arg1 bool) ([]int64, error)
- func (m *MockAdminTX) ListTrees(arg0 context.Context, arg1 bool) ([]*trillian.Tree, error)
- func (m *MockAdminTX) Rollback() error
- func (m *MockAdminTX) SoftDeleteTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)
- func (m *MockAdminTX) UndeleteTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)
- func (m *MockAdminTX) UpdateTree(arg0 context.Context, arg1 int64, arg2 func(*trillian.Tree)) (*trillian.Tree, error)
- type MockAdminTXMockRecorder
- func (mr *MockAdminTXMockRecorder) Close() *gomock.Call
- func (mr *MockAdminTXMockRecorder) Commit() *gomock.Call
- func (mr *MockAdminTXMockRecorder) CreateTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) GetTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) HardDeleteTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) IsClosed() *gomock.Call
- func (mr *MockAdminTXMockRecorder) ListTreeIDs(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) ListTrees(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) Rollback() *gomock.Call
- func (mr *MockAdminTXMockRecorder) SoftDeleteTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) UndeleteTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAdminTXMockRecorder) UpdateTree(arg0, arg1, arg2 interface{}) *gomock.Call
- type MockLogStorage
- func (m *MockLogStorage) AddSequencedLeaves(arg0 context.Context, arg1 *trillian.Tree, arg2 []*trillian.LogLeaf, ...) ([]*trillian.QueuedLogLeaf, error)
- func (m *MockLogStorage) CheckDatabaseAccessible(arg0 context.Context) error
- func (m *MockLogStorage) EXPECT() *MockLogStorageMockRecorder
- func (m *MockLogStorage) QueueLeaves(arg0 context.Context, arg1 *trillian.Tree, arg2 []*trillian.LogLeaf, ...) ([]*trillian.QueuedLogLeaf, error)
- func (m *MockLogStorage) ReadWriteTransaction(arg0 context.Context, arg1 *trillian.Tree, arg2 LogTXFunc) error
- func (m *MockLogStorage) Snapshot(arg0 context.Context) (ReadOnlyLogTX, error)
- func (m *MockLogStorage) SnapshotForTree(arg0 context.Context, arg1 *trillian.Tree) (ReadOnlyLogTreeTX, error)
- type MockLogStorageMockRecorder
- func (mr *MockLogStorageMockRecorder) AddSequencedLeaves(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockLogStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call
- func (mr *MockLogStorageMockRecorder) QueueLeaves(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockLogStorageMockRecorder) ReadWriteTransaction(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLogStorageMockRecorder) Snapshot(arg0 interface{}) *gomock.Call
- func (mr *MockLogStorageMockRecorder) SnapshotForTree(arg0, arg1 interface{}) *gomock.Call
- type MockLogTreeTX
- func (m *MockLogTreeTX) Close() error
- func (m *MockLogTreeTX) Commit(arg0 context.Context) error
- func (m *MockLogTreeTX) DequeueLeaves(arg0 context.Context, arg1 int, arg2 time.Time) ([]*trillian.LogLeaf, error)
- func (m *MockLogTreeTX) EXPECT() *MockLogTreeTXMockRecorder
- func (m *MockLogTreeTX) GetLeavesByHash(arg0 context.Context, arg1 [][]byte, arg2 bool) ([]*trillian.LogLeaf, error)
- func (m *MockLogTreeTX) GetLeavesByIndex(arg0 context.Context, arg1 []int64) ([]*trillian.LogLeaf, error)
- func (m *MockLogTreeTX) GetLeavesByRange(arg0 context.Context, arg1, arg2 int64) ([]*trillian.LogLeaf, error)
- func (m *MockLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []tree.NodeID) ([]tree.Node, error)
- func (m *MockLogTreeTX) GetSequencedLeafCount(arg0 context.Context) (int64, error)
- func (m *MockLogTreeTX) IsOpen() bool
- func (m *MockLogTreeTX) LatestSignedLogRoot(arg0 context.Context) (*trillian.SignedLogRoot, error)
- func (m *MockLogTreeTX) ReadRevision(arg0 context.Context) (int64, error)
- func (m *MockLogTreeTX) Rollback() error
- func (m *MockLogTreeTX) SetMerkleNodes(arg0 context.Context, arg1 []tree.Node) error
- func (m *MockLogTreeTX) StoreSignedLogRoot(arg0 context.Context, arg1 *trillian.SignedLogRoot) error
- func (m *MockLogTreeTX) UpdateSequencedLeaves(arg0 context.Context, arg1 []*trillian.LogLeaf) error
- func (m *MockLogTreeTX) WriteRevision(arg0 context.Context) (int64, error)
- type MockLogTreeTXMockRecorder
- func (mr *MockLogTreeTXMockRecorder) Close() *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) Commit(arg0 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) DequeueLeaves(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) GetLeavesByHash(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) GetLeavesByIndex(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) GetLeavesByRange(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) GetSequencedLeafCount(arg0 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) IsOpen() *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) LatestSignedLogRoot(arg0 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) ReadRevision(arg0 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) Rollback() *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) SetMerkleNodes(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) StoreSignedLogRoot(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) UpdateSequencedLeaves(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLogTreeTXMockRecorder) WriteRevision(arg0 interface{}) *gomock.Call
- type MockReadOnlyAdminTX
- func (m *MockReadOnlyAdminTX) Close() error
- func (m *MockReadOnlyAdminTX) Commit() error
- func (m *MockReadOnlyAdminTX) EXPECT() *MockReadOnlyAdminTXMockRecorder
- func (m *MockReadOnlyAdminTX) GetTree(arg0 context.Context, arg1 int64) (*trillian.Tree, error)
- func (m *MockReadOnlyAdminTX) IsClosed() bool
- func (m *MockReadOnlyAdminTX) ListTreeIDs(arg0 context.Context, arg1 bool) ([]int64, error)
- func (m *MockReadOnlyAdminTX) ListTrees(arg0 context.Context, arg1 bool) ([]*trillian.Tree, error)
- func (m *MockReadOnlyAdminTX) Rollback() error
- type MockReadOnlyAdminTXMockRecorder
- func (mr *MockReadOnlyAdminTXMockRecorder) Close() *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) Commit() *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) GetTree(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) IsClosed() *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) ListTreeIDs(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) ListTrees(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockReadOnlyAdminTXMockRecorder) Rollback() *gomock.Call
- type MockReadOnlyLogTX
- func (m *MockReadOnlyLogTX) Close() error
- func (m *MockReadOnlyLogTX) Commit(arg0 context.Context) error
- func (m *MockReadOnlyLogTX) EXPECT() *MockReadOnlyLogTXMockRecorder
- func (m *MockReadOnlyLogTX) GetActiveLogIDs(arg0 context.Context) ([]int64, error)
- func (m *MockReadOnlyLogTX) Rollback() error
- type MockReadOnlyLogTXMockRecorder
- type MockReadOnlyLogTreeTX
- func (m *MockReadOnlyLogTreeTX) Close() error
- func (m *MockReadOnlyLogTreeTX) Commit(arg0 context.Context) error
- func (m *MockReadOnlyLogTreeTX) EXPECT() *MockReadOnlyLogTreeTXMockRecorder
- func (m *MockReadOnlyLogTreeTX) GetLeavesByHash(arg0 context.Context, arg1 [][]byte, arg2 bool) ([]*trillian.LogLeaf, error)
- func (m *MockReadOnlyLogTreeTX) GetLeavesByIndex(arg0 context.Context, arg1 []int64) ([]*trillian.LogLeaf, error)
- func (m *MockReadOnlyLogTreeTX) GetLeavesByRange(arg0 context.Context, arg1, arg2 int64) ([]*trillian.LogLeaf, error)
- func (m *MockReadOnlyLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []tree.NodeID) ([]tree.Node, error)
- func (m *MockReadOnlyLogTreeTX) GetSequencedLeafCount(arg0 context.Context) (int64, error)
- func (m *MockReadOnlyLogTreeTX) IsOpen() bool
- func (m *MockReadOnlyLogTreeTX) LatestSignedLogRoot(arg0 context.Context) (*trillian.SignedLogRoot, error)
- func (m *MockReadOnlyLogTreeTX) ReadRevision(arg0 context.Context) (int64, error)
- func (m *MockReadOnlyLogTreeTX) Rollback() error
- type MockReadOnlyLogTreeTXMockRecorder
- func (mr *MockReadOnlyLogTreeTXMockRecorder) Close() *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) Commit(arg0 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByHash(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByIndex(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByRange(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) GetMerkleNodes(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) GetSequencedLeafCount(arg0 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) IsOpen() *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) LatestSignedLogRoot(arg0 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) ReadRevision(arg0 interface{}) *gomock.Call
- func (mr *MockReadOnlyLogTreeTXMockRecorder) Rollback() *gomock.Call
- type NewProviderFunc
- type Node
- type NodeID
- type NodeReader
- type PopulateSubtreeFunc
- type PrepareSubtreeWriteFunc
- type Provider
- type ReadOnlyAdminTX
- type ReadOnlyLogStorage
- type ReadOnlyLogTX
- type ReadOnlyLogTreeTX
- type ReadOnlyTreeTX
- type Row
- type Suffix
- type TreeTX
- type TreeWriter
Constants ¶
This section is empty.
Variables ¶
var ( NewNodeIDFromHash = tree.NewNodeIDFromHash NewNodeIDFromPrefix = tree.NewNodeIDFromPrefix NewNodeIDFromBigInt = tree.NewNodeIDFromBigInt NewNodeIDForTreeCoords = tree.NewNodeIDForTreeCoords NewNodeIDFromPrefixSuffix = tree.NewNodeIDFromPrefixSuffix EmptySuffix = tree.EmptySuffix ParseSuffix = tree.ParseSuffix )
These are aliases for the functions of the same name in github.com/google/trillian/storage/tree.
var ErrTreeNeedsInit = status.Error(codes.FailedPrecondition, "tree needs initialising")
ErrTreeNeedsInit is returned when calling methods on an uninitialised tree.
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 ReadWriteTransaction and AdminWriter's CreateTree. See ReadWriteTransaction if you need to perform more than one action per transaction.
func FromMillisSinceEpoch ¶ added in v1.3.0
FromMillisSinceEpoch converts
func GetTree ¶ added in v1.0.4
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 ReadWriteTransaction and AdminWriter's HardDeleteTree. See ReadWriteTransaction 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 Providers ¶ added in v1.3.12
func Providers() []string
Providers returns a slice of all registered storage provider names.
func RegisterProvider ¶ added in v1.3.4
func RegisterProvider(name string, sp NewProviderFunc) error
RegisterProvider registers the given storage Provider.
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 SetNullStringIfValid ¶ added in v1.3.0
func SetNullStringIfValid(src sql.NullString, dest *string)
SetNullStringIfValid assigns src to dest if src is Valid.
func SoftDeleteTree ¶ added in v1.0.4
SoftDeleteTree soft-deletes a tree in storage. It's a convenience wrapper around ReadWriteTransaction and AdminWriter's SoftDeleteTree. See ReadWriteTransaction if you need to perform more than one action per transaction.
func ToMillisSinceEpoch ¶ added in v1.3.0
ToMillisSinceEpoch converts a timestamp into milliseconds since epoch
func UndeleteTree ¶ added in v1.0.4
UndeleteTree undeletes a tree in storage. It's a convenience wrapper around ReadWriteTransaction and AdminWriter's UndeleteTree. See ReadWriteTransaction 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 ReadWriteTransaction and AdminWriter's UpdateTree. See ReadWriteTransaction if you need to perform more than one action per transaction.
func ValidateTreeForCreation ¶
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 ¶
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) // ReadWriteTransaction creates a transaction, and runs f with it. // Some storage implementations may retry aborted transactions, so // f MUST be idempotent. ReadWriteTransaction(ctx context.Context, f AdminTXFunc) 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 AdminTXFunc ¶ added in v1.0.7
AdminTXFunc is the signature for functions passed to ReadWriteTransaction.
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 ¶
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 LogMetadata ¶
type LogMetadata interface { // GetActiveLogIDs returns a list of the IDs of all the logs that are // configured in storage and are eligible to have entries sequenced. GetActiveLogIDs(ctx context.Context) ([]int64, error) }
LogMetadata provides access to information about the logs in storage
type LogStorage ¶
type LogStorage interface { ReadOnlyLogStorage // ReadWriteTransaction starts a RW transaction on the underlying storage, and // calls f with it. // If f fails and returns an error, the storage implementation may optionally // retry with a new transaction, and f MUST NOT keep state across calls. ReadWriteTransaction(ctx context.Context, tree *trillian.Tree, f LogTXFunc) error // 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 a passed-in leaf struct and a Status // representing the outcome for that particular leaf: // * a status of OK indicates that the leaf was successfully queued. // * a status of AlreadyExists indicates that the leaf was a duplicate, in this case // the returned leaf data is that of the original. // Other status values may be returned in error cases. // // 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, tree *trillian.Tree, leaves []*trillian.LogLeaf, queueTimestamp time.Time) ([]*trillian.QueuedLogLeaf, error) // AddSequencedLeaves stores the `leaves` and associates them with the log // positions according to their `LeafIndex` field. The indices must be // contiguous. // // If error is nil, the returned slice is the same size as the input, entries // correspond to the `leaves` in the same order. Each entry describes the // result of adding the corresponding leaf. // // Possible `QueuedLogLeaf.status` values with their semantics: // - OK: The leaf has been successfully stored. // - AlreadyExists: The storage already contains an identical leaf at the // specified `LeafIndex`. That leaf is returned in `QueuedLogLeaf.leaf`. // - FailedPrecondition: There is another leaf with the same `LeafIndex`, // but a different value. That leaf is returned in `QueuedLogLeaf.leaf`. // - OutOfRange: The leaf can not be stored at the specified `LeafIndex`. // For example, the storage might not support non-sequential writes. // - Internal, etc: A storage-specific error. // // TODO(pavelkalinnikov): Make returning the resulting/conflicting leaves // optional. Channel these options to the top-level Log API. // TODO(pavelkalinnikov): Not checking values of the occupied indices might // be a good optimization. Could also be optional. AddSequencedLeaves(ctx context.Context, tree *trillian.Tree, leaves []*trillian.LogLeaf, timestamp time.Time) ([]*trillian.QueuedLogLeaf, error) }
LogStorage should be implemented by concrete storage mechanisms which want to support Logs.
type LogTXFunc ¶ added in v1.0.7
LogTXFunc is the func signature for passing into ReadWriteTransaction.
type LogTreeTX ¶
type LogTreeTX interface { ReadOnlyLogTreeTX TreeWriter // StoreSignedLogRoot stores a freshly created SignedLogRoot. StoreSignedLogRoot(ctx context.Context, root *trillian.SignedLogRoot) error // DequeueLeaves returns between [0, limit] leaves to be integrated to the // tree. // // For LOG trees: // - The leaves are taken from the queue. // - If the Tx is rolled back, they become available for dequeueing again. // // For PREORDERED_LOG trees: // - The leaves are taken from the head of as yet un-integrated part of the // sequenced entries, immediately following the current SignedLogRoot tree // size. // - The operation is a no-op with regards to the sequenced entries. // // Leaves queued more recently than the cutoff time will not be returned. // This allows for guard intervals to be configured, and (in case of // PREORDERED_LOG trees) avoiding contention between log signer and writers // appending new entries. // // This method is not required to return fully populated LogLeaf structures, // but it *must* include MerkleLeafHash, QueueTimestamp, and LeafIndex (for // PREORDERED_LOG trees). Storage implementations might apply optimizations // employing this property. Consult the call sites of this method to be sure. DequeueLeaves(ctx context.Context, limit int, cutoff time.Time) ([]*trillian.LogLeaf, error) // UpdateSequencedLeaves associates the leaves with the sequence numbers // assigned to them. UpdateSequencedLeaves(ctx context.Context, leaves []*trillian.LogLeaf) error }
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 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) CheckDatabaseAccessible ¶
func (m *MockAdminStorage) CheckDatabaseAccessible(arg0 context.Context) error
CheckDatabaseAccessible mocks base method
func (*MockAdminStorage) EXPECT ¶
func (m *MockAdminStorage) EXPECT() *MockAdminStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockAdminStorage) ReadWriteTransaction ¶ added in v1.0.7
func (m *MockAdminStorage) ReadWriteTransaction(arg0 context.Context, arg1 AdminTXFunc) error
ReadWriteTransaction mocks base method
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) CheckDatabaseAccessible ¶
func (mr *MockAdminStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call
CheckDatabaseAccessible indicates an expected call of CheckDatabaseAccessible
func (*MockAdminStorageMockRecorder) ReadWriteTransaction ¶ added in v1.0.7
func (mr *MockAdminStorageMockRecorder) ReadWriteTransaction(arg0, arg1 interface{}) *gomock.Call
ReadWriteTransaction indicates an expected call of ReadWriteTransaction
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) CreateTree ¶
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) HardDeleteTree ¶
func (m *MockAdminTX) HardDeleteTree(arg0 context.Context, arg1 int64) error
HardDeleteTree mocks base method
func (*MockAdminTX) ListTreeIDs ¶
ListTreeIDs mocks base method
func (*MockAdminTX) SoftDeleteTree ¶
SoftDeleteTree mocks base method
func (*MockAdminTX) UndeleteTree ¶
UndeleteTree 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) AddSequencedLeaves ¶ added in v1.0.7
func (m *MockLogStorage) AddSequencedLeaves(arg0 context.Context, arg1 *trillian.Tree, arg2 []*trillian.LogLeaf, arg3 time.Time) ([]*trillian.QueuedLogLeaf, error)
AddSequencedLeaves mocks base method
func (*MockLogStorage) CheckDatabaseAccessible ¶
func (m *MockLogStorage) CheckDatabaseAccessible(arg0 context.Context) error
CheckDatabaseAccessible mocks base method
func (*MockLogStorage) EXPECT ¶
func (m *MockLogStorage) EXPECT() *MockLogStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockLogStorage) QueueLeaves ¶ added in v1.0.7
func (m *MockLogStorage) QueueLeaves(arg0 context.Context, arg1 *trillian.Tree, arg2 []*trillian.LogLeaf, arg3 time.Time) ([]*trillian.QueuedLogLeaf, error)
QueueLeaves mocks base method
func (*MockLogStorage) ReadWriteTransaction ¶ added in v1.0.7
func (m *MockLogStorage) ReadWriteTransaction(arg0 context.Context, arg1 *trillian.Tree, arg2 LogTXFunc) error
ReadWriteTransaction mocks base method
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 *trillian.Tree) (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) AddSequencedLeaves ¶ added in v1.0.7
func (mr *MockLogStorageMockRecorder) AddSequencedLeaves(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
AddSequencedLeaves indicates an expected call of AddSequencedLeaves
func (*MockLogStorageMockRecorder) CheckDatabaseAccessible ¶
func (mr *MockLogStorageMockRecorder) CheckDatabaseAccessible(arg0 interface{}) *gomock.Call
CheckDatabaseAccessible indicates an expected call of CheckDatabaseAccessible
func (*MockLogStorageMockRecorder) QueueLeaves ¶ added in v1.0.7
func (mr *MockLogStorageMockRecorder) QueueLeaves(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
QueueLeaves indicates an expected call of QueueLeaves
func (*MockLogStorageMockRecorder) ReadWriteTransaction ¶ added in v1.0.7
func (mr *MockLogStorageMockRecorder) ReadWriteTransaction(arg0, arg1, arg2 interface{}) *gomock.Call
ReadWriteTransaction indicates an expected call of ReadWriteTransaction
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) Commit ¶
func (m *MockLogTreeTX) Commit(arg0 context.Context) 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 ¶
func (m *MockLogTreeTX) EXPECT() *MockLogTreeTXMockRecorder
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) GetLeavesByRange ¶ added in v1.0.6
func (m *MockLogTreeTX) GetLeavesByRange(arg0 context.Context, arg1, arg2 int64) ([]*trillian.LogLeaf, error)
GetLeavesByRange mocks base method
func (*MockLogTreeTX) GetMerkleNodes ¶
func (m *MockLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []tree.NodeID) ([]tree.Node, error)
GetMerkleNodes mocks base method
func (*MockLogTreeTX) GetSequencedLeafCount ¶
func (m *MockLogTreeTX) GetSequencedLeafCount(arg0 context.Context) (int64, error)
GetSequencedLeafCount mocks base method
func (*MockLogTreeTX) LatestSignedLogRoot ¶
func (m *MockLogTreeTX) LatestSignedLogRoot(arg0 context.Context) (*trillian.SignedLogRoot, error)
LatestSignedLogRoot mocks base method
func (*MockLogTreeTX) ReadRevision ¶
func (m *MockLogTreeTX) ReadRevision(arg0 context.Context) (int64, error)
ReadRevision mocks base method
func (*MockLogTreeTX) Rollback ¶
func (m *MockLogTreeTX) Rollback() error
Rollback mocks base method
func (*MockLogTreeTX) SetMerkleNodes ¶
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 ¶
UpdateSequencedLeaves mocks base method
func (*MockLogTreeTX) WriteRevision ¶
func (m *MockLogTreeTX) WriteRevision(arg0 context.Context) (int64, error)
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(arg0 interface{}) *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) GetLeavesByRange ¶ added in v1.0.6
func (mr *MockLogTreeTXMockRecorder) GetLeavesByRange(arg0, arg1, arg2 interface{}) *gomock.Call
GetLeavesByRange indicates an expected call of GetLeavesByRange
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) ReadRevision ¶
func (mr *MockLogTreeTXMockRecorder) ReadRevision(arg0 interface{}) *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(arg0 interface{}) *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 ¶
func (m *MockReadOnlyAdminTX) EXPECT() *MockReadOnlyAdminTXMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReadOnlyAdminTX) IsClosed ¶
func (m *MockReadOnlyAdminTX) IsClosed() bool
IsClosed mocks base method
func (*MockReadOnlyAdminTX) ListTreeIDs ¶
ListTreeIDs 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 ¶
func (mr *MockReadOnlyAdminTXMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockReadOnlyAdminTXMockRecorder) Commit ¶
func (mr *MockReadOnlyAdminTXMockRecorder) Commit() *gomock.Call
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 ¶
func (mr *MockReadOnlyAdminTXMockRecorder) IsClosed() *gomock.Call
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 ¶
func (mr *MockReadOnlyAdminTXMockRecorder) Rollback() *gomock.Call
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) Commit ¶
func (m *MockReadOnlyLogTX) Commit(arg0 context.Context) error
Commit mocks base method
func (*MockReadOnlyLogTX) EXPECT ¶
func (m *MockReadOnlyLogTX) EXPECT() *MockReadOnlyLogTXMockRecorder
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) 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 ¶
func (mr *MockReadOnlyLogTXMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockReadOnlyLogTXMockRecorder) Commit ¶
func (mr *MockReadOnlyLogTXMockRecorder) Commit(arg0 interface{}) *gomock.Call
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) 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(arg0 context.Context) error
Commit mocks base method
func (*MockReadOnlyLogTreeTX) EXPECT ¶
func (m *MockReadOnlyLogTreeTX) EXPECT() *MockReadOnlyLogTreeTXMockRecorder
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) GetLeavesByRange ¶ added in v1.0.6
func (m *MockReadOnlyLogTreeTX) GetLeavesByRange(arg0 context.Context, arg1, arg2 int64) ([]*trillian.LogLeaf, error)
GetLeavesByRange mocks base method
func (*MockReadOnlyLogTreeTX) GetMerkleNodes ¶
func (m *MockReadOnlyLogTreeTX) GetMerkleNodes(arg0 context.Context, arg1 int64, arg2 []tree.NodeID) ([]tree.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(arg0 context.Context) (int64, error)
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 ¶
func (mr *MockReadOnlyLogTreeTXMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockReadOnlyLogTreeTXMockRecorder) Commit ¶
func (mr *MockReadOnlyLogTreeTXMockRecorder) Commit(arg0 interface{}) *gomock.Call
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) GetLeavesByRange ¶ added in v1.0.6
func (mr *MockReadOnlyLogTreeTXMockRecorder) GetLeavesByRange(arg0, arg1, arg2 interface{}) *gomock.Call
GetLeavesByRange indicates an expected call of GetLeavesByRange
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 ¶
func (mr *MockReadOnlyLogTreeTXMockRecorder) IsOpen() *gomock.Call
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(arg0 interface{}) *gomock.Call
ReadRevision indicates an expected call of ReadRevision
func (*MockReadOnlyLogTreeTXMockRecorder) Rollback ¶
func (mr *MockReadOnlyLogTreeTXMockRecorder) Rollback() *gomock.Call
Rollback indicates an expected call of Rollback
type NewProviderFunc ¶ added in v1.3.4
type NewProviderFunc func(monitoring.MetricFactory) (Provider, error)
NewProviderFunc is the signature of a function which can be registered to provide instances of storage providers.
type NodeReader ¶
type NodeReader interface { // GetMerkleNodes looks up the set of nodes identified by ids, at // treeRevision, and returns them in the same order. GetMerkleNodes(ctx context.Context, treeRevision int64, ids []tree.NodeID) ([]tree.Node, error) }
NodeReader provides read-only access to the stored tree nodes, as an interface to allow easier testing of node manipulation.
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 Provider ¶ added in v1.3.4
type Provider interface { // LogStorage creates and returns a LogStorage implementation. LogStorage() LogStorage // AdminStorage creates and returns a AdminStorage implementation. AdminStorage() AdminStorage // Close closes the underlying storage. Close() error }
Provider is an interface which allows Trillian binaries to use different storage implementations.
func NewProvider ¶ added in v1.3.4
func NewProvider(name string, mf monitoring.MetricFactory) (Provider, error)
NewProvider returns a new Provider instance of the type specified by name.
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, tree *trillian.Tree) (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(context.Context) 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 // 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) // GetLeavesByRange returns leaf data for a range of indexes. The returned // slice is a contiguous prefix of leaves in [start, start+count) ordered by // LeafIndex. It will be shorter than `count` if the requested range has // missing entries (e.g., it extends beyond the size of a LOG tree), or // `count` is too big to handle in one go. // For PREORDERED_LOG trees, *must* return leaves beyond the tree size if // they are stored, in order to allow integrating them into the tree. GetLeavesByRange(ctx context.Context, start, count 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) // LatestSignedLogRoot returns the most recent SignedLogRoot, if any. LatestSignedLogRoot(ctx context.Context) (*trillian.SignedLogRoot, error) }
ReadOnlyLogTreeTX provides a read-only view into the Log data. A ReadOnlyLogTreeTX 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(ctx context.Context) (int64, error) // Commit attempts to commit any reads performed under this transaction. Commit(context.Context) error // Rollback aborts this transaction. Rollback() error // Close attempts to Rollback the TX if it's open, it's a noop otherwise. Close() error // IsOpen 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 Row ¶ added in v1.3.0
type Row interface {
Scan(dest ...interface{}) error
}
Row defines a common interface between sql.Row and sql.Rows(!)
type TreeTX ¶
type TreeTX interface { ReadOnlyTreeTX TreeWriter }
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.
type TreeWriter ¶ added in v1.0.7
type TreeWriter interface { // SetMerkleNodes stores the provided nodes, at the transaction's writeRevision. SetMerkleNodes(ctx context.Context, nodes []tree.Node) error // WriteRevision returns the tree revision that any writes through this TreeTX will be stored at. WriteRevision(ctx context.Context) (int64, error) }
TreeWriter represents additional transaction methods that modify the tree.
Source Files ¶
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. |
testdb
Package testdb creates new databases for tests.
|
Package testdb creates new databases for tests. |
Package storagepb contains protobuf definitions used by various storage implementations.
|
Package storagepb contains protobuf definitions used by various storage implementations. |
convert
Package convert contains helpers used by storage implementations.
|
Package convert contains helpers used by storage implementations. |
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. |
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. |
Package tree defines types that help navigating a tree in storage.
|
Package tree defines types that help navigating a tree in storage. |