db

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotIncluded = errors.New("not included")

Functions

This section is empty.

Types

type AddLeafStatus added in v0.6.1

type AddLeafStatus struct {
	AlreadyExists bool
	IsSequenced   bool
}

type Client

type Client interface {
	AddLeaf(context.Context, *types.Leaf, uint64) (AddLeafStatus, error)
	AddSequencedLeaves(ctx context.Context, leaves []types.Leaf, index int64) error
	GetTreeHead(context.Context) (types.TreeHead, error)
	GetConsistencyProof(context.Context, *requests.ConsistencyProof) (types.ConsistencyProof, error)
	GetInclusionProof(context.Context, *requests.InclusionProof) (types.InclusionProof, error)
	GetLeaves(context.Context, *requests.Leaves) ([]types.Leaf, error)
}

Client is an interface that interacts with a log's database backend

func NewMemoryDb added in v0.6.1

func NewMemoryDb() Client

type MemoryDb added in v0.6.1

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

func (*MemoryDb) AddLeaf added in v0.6.1

func (db *MemoryDb) AddLeaf(_ context.Context, leaf *types.Leaf, treeSize uint64) (AddLeafStatus, error)

func (*MemoryDb) AddSequencedLeaves added in v0.6.1

func (db *MemoryDb) AddSequencedLeaves(_ context.Context, leaves []types.Leaf, index int64) error

func (*MemoryDb) GetConsistencyProof added in v0.6.1

func (db *MemoryDb) GetConsistencyProof(_ context.Context, req *requests.ConsistencyProof) (types.ConsistencyProof, error)

func (*MemoryDb) GetInclusionProof added in v0.6.1

func (db *MemoryDb) GetInclusionProof(_ context.Context, req *requests.InclusionProof) (types.InclusionProof, error)

func (*MemoryDb) GetLeaves added in v0.6.1

func (db *MemoryDb) GetLeaves(_ context.Context, req *requests.Leaves) ([]types.Leaf, error)

func (*MemoryDb) GetTreeHead added in v0.6.1

func (db *MemoryDb) GetTreeHead(_ context.Context) (types.TreeHead, error)

type TreeType added in v0.9.0

type TreeType int
const (
	PrimaryTree TreeType = iota
	SecondaryTree
)

type TrillianClient

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

TrillianClient implements the Client interface for Trillian's gRPC backend

func DialTrillian added in v0.8.0

func DialTrillian(target string, timeout time.Duration, treeType TreeType, treeIdFile string) (*TrillianClient, error)

func (*TrillianClient) AddLeaf

func (c *TrillianClient) AddLeaf(ctx context.Context, leaf *types.Leaf, treeSize uint64) (AddLeafStatus, error)

AddLeaf adds a leaf to the tree and returns true if the leaf has been sequenced into the tree of size treeSize.

func (*TrillianClient) AddSequencedLeaves

func (c *TrillianClient) AddSequencedLeaves(ctx context.Context, leaves []types.Leaf, index int64) error

AddSequencedLeaves adds a set of already sequenced leaves to the tree.

func (*TrillianClient) GetConsistencyProof

func (c *TrillianClient) GetConsistencyProof(ctx context.Context, req *requests.ConsistencyProof) (types.ConsistencyProof, error)

func (*TrillianClient) GetInclusionProof

func (c *TrillianClient) GetInclusionProof(ctx context.Context, req *requests.InclusionProof) (types.InclusionProof, error)

func (*TrillianClient) GetLeaves

func (c *TrillianClient) GetLeaves(ctx context.Context, req *requests.Leaves) ([]types.Leaf, error)

func (*TrillianClient) GetTreeHead

func (c *TrillianClient) GetTreeHead(ctx context.Context) (types.TreeHead, error)

Jump to

Keyboard shortcuts

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