Documentation ¶
Overview ¶
Package ct implements trillian's interfaces using cheap cloud infrastructure.
Index ¶
- func SetLeafCacheSize(size int)
- type LogStorage
- func (ls *LogStorage) AddSequencedLeaves(ctx context.Context, tree *trillian.Tree, leaves []*trillian.LogLeaf, ...) ([]*trillian.QueuedLogLeaf, error)
- func (ls *LogStorage) CheckDatabaseAccessible(ctx context.Context) error
- func (ls *LogStorage) QueueLeaves(ctx context.Context, tree *trillian.Tree, leaves []*trillian.LogLeaf, ...) ([]*trillian.QueuedLogLeaf, error)
- func (ls *LogStorage) ReadWriteTransaction(ctx context.Context, tree *trillian.Tree, f storage.LogTXFunc) error
- func (ls *LogStorage) Snapshot(ctx context.Context) (storage.ReadOnlyLogTX, error)
- func (ls *LogStorage) SnapshotForTree(ctx context.Context, tree *trillian.Tree) (storage.ReadOnlyLogTreeTX, error)
- type QuotaManager
- func (qm *QuotaManager) GetTokens(ctx context.Context, numTokens int, specs []quota.Spec) error
- func (qm *QuotaManager) GetUser(ctx context.Context, req interface{}) string
- func (qm *QuotaManager) PeekTokens(ctx context.Context, specs []quota.Spec) (map[quota.Spec]int, error)
- func (qm *QuotaManager) PutTokens(ctx context.Context, numTokens int, specs []quota.Spec) error
- func (qm *QuotaManager) ResetQuota(ctx context.Context, specs []quota.Spec) error
- func (qm *QuotaManager) WatchLog(local *custom.Local, treeID int64)
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 ¶
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) ResetQuota ¶
ResetQuota resets the quota for all specs.