log

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 20

Documentation

Overview

Package log holds the code that is specific to Trillian logs core operation, particularly the code for sequencing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is the default timeout on a single log operation run.
	DefaultTimeout = 60 * time.Second
)
View Source
var (

	// QuotaIncreaseFactor is the multiplier used for the number of tokens added back to
	// sequencing-based quotas. The resulting PutTokens call is equivalent to
	// "PutTokens(_, numLeaves * QuotaIncreaseFactor, _)".
	// A factor >1 adds resilience to token leakage, on the risk of a system that's overly
	// optimistic in face of true token shortages. The higher the factor, the higher the quota
	// "optimism" is. A factor that's too high (say, >1.5) is likely a sign that the quota
	// configuration should be changed instead.
	// A factor <1 WILL lead to token shortages, therefore it'll be normalized to 1.
	QuotaIncreaseFactor = 1.1
)

Functions

func InitMetrics added in v1.4.0

func InitMetrics(mf monitoring.MetricFactory)

InitMetrics sets up some metrics for this package. Must be called before calling IntegrateBatch. Can be called more than once, but only the first call has any effect. TODO(pavelkalinnikov): Create all metrics in this package together.

func IntegrateBatch added in v1.4.0

func IntegrateBatch(ctx context.Context, tree *trillian.Tree, limit int, guardWindow, maxRootDurationInterval time.Duration, ts clock.TimeSource, ls storage.LogStorage, qm quota.Manager) (int, error)

IntegrateBatch wraps up all the operations needed to take a batch of queued or sequenced leaves and integrate them into the tree.

Types

type MockOperation added in v1.3.0

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

MockOperation is a mock of Operation interface.

func NewMockOperation added in v1.3.0

func NewMockOperation(ctrl *gomock.Controller) *MockOperation

NewMockOperation creates a new mock instance.

func (*MockOperation) EXPECT added in v1.3.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockOperation) ExecutePass added in v1.3.0

func (m *MockOperation) ExecutePass(arg0 context.Context, arg1 int64, arg2 *OperationInfo) (int, error)

ExecutePass mocks base method.

type MockOperationMockRecorder added in v1.3.0

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

MockOperationMockRecorder is the mock recorder for MockOperation.

func (*MockOperationMockRecorder) ExecutePass added in v1.3.0

func (mr *MockOperationMockRecorder) ExecutePass(arg0, arg1, arg2 interface{}) *gomock.Call

ExecutePass indicates an expected call of ExecutePass.

type Operation added in v1.3.0

type Operation interface {
	// ExecutePass performs a single pass of processing on a single log.  It returns
	// a count of items processed (for logging) and an error.
	ExecutePass(ctx context.Context, logID int64, info *OperationInfo) (int, error)
}

Operation defines a task that operates on a log. Examples are scheduling, signing, consistency checking or cleanup.

type OperationInfo added in v1.3.0

type OperationInfo struct {
	// Registry provides access to Trillian storage.
	Registry extension.Registry

	// BatchSize is the batch size to be passed to tasks run by this manager.
	BatchSize int
	// TimeSource should be used by the Operation to allow mocking for tests.
	TimeSource clock.TimeSource

	// Election-related configuration. Copied for each log.
	ElectionConfig election.RunnerConfig

	// RunInterval is the time between starting batches of processing.  If a
	// batch takes longer than this interval to complete, the next batch
	// will start immediately.
	RunInterval time.Duration
	// NumWorkers is the number of worker goroutines to run in parallel.
	NumWorkers int
	// Timeout sets an optional timeout on each operation run.
	// If unset, default to the value of DefaultTimeout.
	Timeout time.Duration
}

OperationInfo bundles up information needed for running a set of Operations.

type OperationManager added in v1.3.0

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

OperationManager controls scheduling activities for logs.

func NewOperationManager added in v1.3.0

func NewOperationManager(info OperationInfo, logOperation Operation) *OperationManager

NewOperationManager creates a new OperationManager instance.

func (*OperationManager) OperationLoop added in v1.3.0

func (o *OperationManager) OperationLoop(ctx context.Context)

OperationLoop starts the manager working. It continues until told to exit. TODO(Martin2112): No mechanism for error reporting etc., this is OK for v1 but needs work

func (*OperationManager) OperationSingle added in v1.3.0

func (o *OperationManager) OperationSingle(ctx context.Context)

OperationSingle performs a single pass of the manager.

TODO(pavelkalinnikov): Deprecate this because it doesn't clean up any state, and is used only for testing.

type SequencerManager added in v1.3.0

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

SequencerManager provides sequencing operations for a collection of Logs.

func NewSequencerManager added in v1.3.0

func NewSequencerManager(registry extension.Registry, gw time.Duration) *SequencerManager

NewSequencerManager creates a new SequencerManager instance based on the provided KeyManager instance and guard window.

func (*SequencerManager) ExecutePass added in v1.3.0

func (s *SequencerManager) ExecutePass(ctx context.Context, logID int64, info *OperationInfo) (int, error)

ExecutePass performs sequencing for the specified Log.

Jump to

Keyboard shortcuts

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