custom

package
v0.0.0-...-0a9ca34 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package custom implements specific ways to get/modify ct-log data on cheap cloud infrastructure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Local

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

Local implements convenience methods over a local database connection. The local database is for metadata and indices, because they're small and frequently accessed.

func NewLocal

func NewLocal(path string) (*Local, error)

NewLocal returns a new local database, with data stored at `path`.

func (*Local) Begin

func (l *Local) Begin() *LocalTx

func (*Local) GetSequenceByIdentityHash

func (l *Local) GetSequenceByIdentityHash(treeID int64, hashes [][]byte) ([]int64, error)

GetSequenceByIdentityHash returns the sequence numbers for the leaves with the given identity hashes, in the tree with the given tree id. Missing sequence numbers are returned as -1.

func (*Local) GetSequenceByMerkleHash

func (l *Local) GetSequenceByMerkleHash(treeID int64, hashes [][]byte) ([]int64, error)

GetSequenceByMerkleHash returns the sequence numbers for the leaves with the given Merkle hashes, in the tree with the given tree id. Missing sequence numbers are returned as -1.

func (*Local) GetSubtrees

func (l *Local) GetSubtrees(treeID, treeRevision int64, ids []storage.NodeID) ([]*storagepb.SubtreeProto, error)

GetSubtrees returns the most recent revision ( <= treeRevision ) of each subtree with a given id. Missing subtrees are silently elided.

func (*Local) MostRecentRoot

func (l *Local) MostRecentRoot(treeID int64) (trillian.SignedLogRoot, frontier.Frontier, error)

MostRecentRoot returns most-recently committed root for the tree with the given treeID.

func (*Local) QueueLeaves

func (l *Local) QueueLeaves(treeID, queueTimestamp int64, leaves []*trillian.LogLeaf) error

func (*Local) Unsequenced

func (l *Local) Unsequenced(treeID int64) (int, error)

Unsequenced returns the number of unsequenced leaves that a log has on disk.

type LocalTx

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

LocalTx implements convenience methods over a transaction with the local storage.

func (*LocalTx) Commit

func (ltx *LocalTx) Commit() error

func (*LocalTx) DequeueLeaves

func (ltx *LocalTx) DequeueLeaves(treeID, seq, cutoffTime int64, limit int) ([]*trillian.LogLeaf, error)

func (*LocalTx) PutLeaves

func (ltx *LocalTx) PutLeaves(treeID int64, seqs []int64, merkleHashes, idHashes [][]byte) error

PutLeaves creates the index entries that let leaves be looked up by merkle/identity hash. It is assumed that seqs[i] corresponds to merkleHashes[i], corresponds to idHashes[i].

func (*LocalTx) PutSubtrees

func (ltx *LocalTx) PutSubtrees(treeID, treeRevision int64, ids []storage.NodeID, subtrees []*storagepb.SubtreeProto) error

PutSubtrees serializes the subtrees and writes them to disk, indexed by their id. It is assumed that ids[i] corresponds to subtrees[i].

func (*LocalTx) StoreRoot

func (ltx *LocalTx) StoreRoot(treeID int64, root trillian.SignedLogRoot, front frontier.Frontier) error

type Remote

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

Remote implements convenience methods over a large-scale data host. The data is possibly hosted remotely, so may take a long time to fetch.

func NewRemote

func NewRemote(acctId, appKey, bucket, url string) (*Remote, error)

NewRemote returns a new remote database, where `acctId` and `appKey` are the Account ID and Application Key of a B2 bucket. `bucket` is the name of the bucket. `url` is the URL to use to download data.

func (*Remote) GetLeaves

func (r *Remote) GetLeaves(ctx context.Context, treeID int64, seqs []int64) ([]*trillian.LogLeaf, error)

func (*Remote) PutLeaves

func (r *Remote) PutLeaves(ctx context.Context, treeID int64, leaves []*trillian.LogLeaf) error

Directories

Path Synopsis
Package frontier implements tools for protecting the right-most edge of a CT log's Merkle tree.
Package frontier implements tools for protecting the right-most edge of a CT log's Merkle tree.

Jump to

Keyboard shortcuts

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