ct

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: 18 Imported by: 0

Documentation

Overview

Package ct implements trillian's interfaces using cheap cloud infrastructure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLeafCacheSize

func SetLeafCacheSize(size int)

SetLeafCacheSize sets the max size of the in-memory cache of leaves that have been queued but may not have been integrated into an STH yet. This helps reduce the number of duplicate leaves.

Types

type LogStorage

type LogStorage struct {
	Local  *custom.Local
	Remote *custom.Remote

	AdminStorage storage.AdminStorage
}

LogStorage implements storage.LogStorage over a Backblaze B2 bucket and a local queue of unsequenced certificates.

func (*LogStorage) AddSequencedLeaves

func (ls *LogStorage) AddSequencedLeaves(ctx context.Context, tree *trillian.Tree, leaves []*trillian.LogLeaf, ts 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.

func (*LogStorage) CheckDatabaseAccessible

func (ls *LogStorage) CheckDatabaseAccessible(ctx context.Context) error

CheckDatabaseAccessible returns nil if the database is accessible, error otherwise.

func (*LogStorage) QueueLeaves

func (ls *LogStorage) QueueLeaves(ctx context.Context, tree *trillian.Tree, leaves []*trillian.LogLeaf, queueTimestamp time.Time) ([]*trillian.QueuedLogLeaf, error)

QueueLeaves enqueues leaves for later integration into the tree.

func (*LogStorage) ReadWriteTransaction

func (ls *LogStorage) ReadWriteTransaction(ctx context.Context, tree *trillian.Tree, f storage.LogTXFunc) error

ReadWriteTransaction starts a RW transaction on the underlying storage, and calls f with it.

func (*LogStorage) Snapshot

func (ls *LogStorage) Snapshot(ctx context.Context) (storage.ReadOnlyLogTX, error)

Snapshot starts a read-only transaction not tied to any particular tree.

func (*LogStorage) SnapshotForTree

func (ls *LogStorage) SnapshotForTree(ctx context.Context, tree *trillian.Tree) (storage.ReadOnlyLogTreeTX, error)

SnapshotForTree starts a read-only transaction for the specified treeID.

type QuotaManager

type QuotaManager struct {
	TreeSize, UnsequencedLeaves *prometheus.GaugeVec
	// contains filtered or unexported fields
}

QuotaManager is the mechanism which provides backpressure from the signer to the servers, when leaves are being queued faster than they're being sequenced.

func NewQuotaManager

func NewQuotaManager(maxUnsequencedLeaves int64) *QuotaManager

func (*QuotaManager) GetTokens

func (qm *QuotaManager) GetTokens(ctx context.Context, numTokens int, specs []quota.Spec) error

GetTokens acquires numTokens from all specs. Tokens are taken in the order specified by specs. Returns error if numTokens could not be acquired for all specs.

func (*QuotaManager) GetUser

func (qm *QuotaManager) GetUser(ctx context.Context, req interface{}) string

GetUser returns the quota user, as defined by the manager implementation. req is the RPC request message.

func (*QuotaManager) PeekTokens

func (qm *QuotaManager) PeekTokens(ctx context.Context, specs []quota.Spec) (map[quota.Spec]int, error)

PeekTokens returns how many tokens are available for each spec, without acquiring any. Infinite quotas should return MaxTokens.

func (*QuotaManager) PutTokens

func (qm *QuotaManager) PutTokens(ctx context.Context, numTokens int, specs []quota.Spec) error

PutTokens adds numTokens for all specs.

func (*QuotaManager) ResetQuota

func (qm *QuotaManager) ResetQuota(ctx context.Context, specs []quota.Spec) error

ResetQuota resets the quota for all specs.

func (*QuotaManager) WatchLog

func (qm *QuotaManager) WatchLog(local *custom.Local, treeID int64)

WatchLog spawns a goroutine to keep track of the number of unsequenced leaves in the log with the given treeID.

Directories

Path Synopsis
Package cache implements a capped-size in-memory cache that randomly evicts elements when it reaches max size.
Package cache implements a capped-size in-memory cache that randomly evicts elements when it reaches max size.

Jump to

Keyboard shortcuts

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