trees

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 13 Imported by: 33

Documentation

Overview

Package trees contains utility method for retrieving trees and acquiring objects (hashers, signers) associated with them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (*trillian.Tree, bool)

FromContext returns the tree within ctx if present, together with an indication of whether a tree was present.

func GetTree

func GetTree(ctx context.Context, s storage.AdminStorage, treeID int64, opts GetOpts) (*trillian.Tree, error)

GetTree returns the specified tree, either from the ctx (if present) or read from storage. The tree will be validated according to GetOpts before returned. Tree state is also considered (for example, deleted tree will return NotFound errors).

func Hash

func Hash(tree *trillian.Tree) (crypto.Hash, error)

Hash returns the crypto.Hash configured by the tree.

func NewContext

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

NewContext returns a ctx with the given tree.

func Signer

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

Signer returns a Trillian crypto.Signer configured by the tree.

Types

type GetOpts

type GetOpts struct {
	// TreeTypes is a set of allowed tree types. If empty, any type is allowed.
	TreeTypes map[trillian.TreeType]bool
	// Operation indicates what operation is being performed.
	Operation OpType
}

GetOpts contains validation options for GetTree.

func NewGetOpts added in v1.0.7

func NewGetOpts(op OpType, types ...trillian.TreeType) GetOpts

NewGetOpts creates GetOps that allows the listed set of tree types, and optionally forces the tree to be readonly.

type OpType added in v1.0.7

type OpType int

OpType indicates how a tree is to be used and participates in permissions decisions.

const (
	// Unknown is an access type that will always get rejected.
	Unknown OpType = iota
	// Admin access is for general administration purposes.
	Admin
	// Query implies access to serve query, typically readonly.
	Query
	// QueueLog is log specific - adding entries to the queue.
	QueueLog
	// SequenceLog is log specific - integrating entries into the tree.
	SequenceLog
	// UpdateMap is map specific - set / update leaves.
	UpdateMap
)

func (OpType) String added in v1.3.0

func (i OpType) String() string

Jump to

Keyboard shortcuts

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