commitlog

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 29 Imported by: 8

Documentation

Overview

Package commitlog is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCommitLogQueueFull is raised when trying to write to the commit log
	// when the queue is full
	ErrCommitLogQueueFull = errors.New("commit log queue is full")
)

Functions

func ReadLogInfo

func ReadLogInfo(filePath string, opts Options) (time.Time, time.Duration, int64, error)

ReadLogInfo reads the commit log info out of a commitlog file

Types

type CommitLog

type CommitLog interface {
	// Open the commit log
	Open() error

	// Write will write an entry in the commit log for a given series
	Write(
		ctx context.Context,
		series Series,
		datapoint ts.Datapoint,
		unit xtime.Unit,
		annotation ts.Annotation,
	) error

	// Close the commit log
	Close() error
}

CommitLog provides a synchronized commit log

func NewCommitLog

func NewCommitLog(opts Options) (CommitLog, error)

NewCommitLog creates a new commit log

type File added in v0.4.0

type File struct {
	FilePath string
	Start    time.Time
	Duration time.Duration
	Index    int64
}

File represents a commit log file and its associated metadata.

func Files added in v0.4.0

func Files(opts Options) ([]File, error)

Files returns a slice of all available commit log files on disk along with their associated metadata.

type FileFilterPredicate

type FileFilterPredicate func(f File) bool

FileFilterPredicate is a predicate that allows the caller to determine which commitlogs the iterator should read from

func ReadAllPredicate

func ReadAllPredicate() FileFilterPredicate

ReadAllPredicate can be passed as the ReadCommitLogPredicate for callers that want a convenient way to read all the commitlogs

type Iterator

type Iterator interface {
	// Next returns whether the iterator has the next value
	Next() bool

	// Current returns the current commit log entry
	Current() (Series, ts.Datapoint, xtime.Unit, ts.Annotation)

	// Err returns an error if an error occurred
	Err() error

	// Close the iterator
	Close()
}

Iterator provides an iterator for commit logs

func NewIterator

func NewIterator(iterOpts IteratorOpts) (Iterator, error)

NewIterator creates a new commit log iterator

type IteratorOpts

type IteratorOpts struct {
	CommitLogOptions      Options
	FileFilterPredicate   FileFilterPredicate
	SeriesFilterPredicate SeriesFilterPredicate
}

IteratorOpts is a struct that contains coptions for the Iterator

type MockCommitLog

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

MockCommitLog is a mock of CommitLog interface

func NewMockCommitLog

func NewMockCommitLog(ctrl *gomock.Controller) *MockCommitLog

NewMockCommitLog creates a new mock instance

func (*MockCommitLog) Close

func (m *MockCommitLog) Close() error

Close mocks base method

func (*MockCommitLog) EXPECT

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

func (*MockCommitLog) Open

func (m *MockCommitLog) Open() error

Open mocks base method

func (*MockCommitLog) Write

func (m *MockCommitLog) Write(ctx context.Context, series Series, datapoint ts.Datapoint, unit time0.Unit, annotation ts.Annotation) error

Write mocks base method

type MockCommitLogMockRecorder

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

MockCommitLogMockRecorder is the mock recorder for MockCommitLog

func (*MockCommitLogMockRecorder) Close

func (mr *MockCommitLogMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockCommitLogMockRecorder) Open

Open indicates an expected call of Open

func (*MockCommitLogMockRecorder) Write

func (mr *MockCommitLogMockRecorder) Write(ctx, series, datapoint, unit, annotation interface{}) *gomock.Call

Write indicates an expected call of Write

type MockIterator

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

MockIterator is a mock of Iterator interface

func NewMockIterator

func NewMockIterator(ctrl *gomock.Controller) *MockIterator

NewMockIterator creates a new mock instance

func (*MockIterator) Close

func (m *MockIterator) Close()

Close mocks base method

func (*MockIterator) Current

func (m *MockIterator) Current() (Series, ts.Datapoint, time0.Unit, ts.Annotation)

Current mocks base method

func (*MockIterator) EXPECT

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

func (*MockIterator) Err

func (m *MockIterator) Err() error

Err mocks base method

func (*MockIterator) Next

func (m *MockIterator) Next() bool

Next mocks base method

type MockIteratorMockRecorder

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

MockIteratorMockRecorder is the mock recorder for MockIterator

func (*MockIteratorMockRecorder) Close

func (mr *MockIteratorMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockIteratorMockRecorder) Current

func (mr *MockIteratorMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current

func (*MockIteratorMockRecorder) Err

Err indicates an expected call of Err

func (*MockIteratorMockRecorder) Next

func (mr *MockIteratorMockRecorder) Next() *gomock.Call

Next indicates an expected call of Next

type MockOptions

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

MockOptions is a mock of Options interface

func NewMockOptions

func NewMockOptions(ctrl *gomock.Controller) *MockOptions

NewMockOptions creates a new mock instance

func (*MockOptions) BacklogQueueSize

func (m *MockOptions) BacklogQueueSize() int

BacklogQueueSize mocks base method

func (*MockOptions) BlockSize

func (m *MockOptions) BlockSize() time.Duration

BlockSize mocks base method

func (*MockOptions) BytesPool

func (m *MockOptions) BytesPool() pool.CheckedBytesPool

BytesPool mocks base method

func (*MockOptions) ClockOptions

func (m *MockOptions) ClockOptions() clock.Options

ClockOptions mocks base method

func (*MockOptions) EXPECT

func (m *MockOptions) EXPECT() *MockOptionsMockRecorder

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

func (*MockOptions) FilesystemOptions

func (m *MockOptions) FilesystemOptions() fs.Options

FilesystemOptions mocks base method

func (*MockOptions) FlushInterval

func (m *MockOptions) FlushInterval() time.Duration

FlushInterval mocks base method

func (*MockOptions) FlushSize

func (m *MockOptions) FlushSize() int

FlushSize mocks base method

func (*MockOptions) IdentifierPool

func (m *MockOptions) IdentifierPool() ident.Pool

IdentifierPool mocks base method

func (*MockOptions) InstrumentOptions

func (m *MockOptions) InstrumentOptions() instrument.Options

InstrumentOptions mocks base method

func (*MockOptions) ReadConcurrency

func (m *MockOptions) ReadConcurrency() int

ReadConcurrency mocks base method

func (*MockOptions) SetBacklogQueueSize

func (m *MockOptions) SetBacklogQueueSize(value int) Options

SetBacklogQueueSize mocks base method

func (*MockOptions) SetBlockSize

func (m *MockOptions) SetBlockSize(value time.Duration) Options

SetBlockSize mocks base method

func (*MockOptions) SetBytesPool

func (m *MockOptions) SetBytesPool(value pool.CheckedBytesPool) Options

SetBytesPool mocks base method

func (*MockOptions) SetClockOptions

func (m *MockOptions) SetClockOptions(value clock.Options) Options

SetClockOptions mocks base method

func (*MockOptions) SetFilesystemOptions

func (m *MockOptions) SetFilesystemOptions(value fs.Options) Options

SetFilesystemOptions mocks base method

func (*MockOptions) SetFlushInterval

func (m *MockOptions) SetFlushInterval(value time.Duration) Options

SetFlushInterval mocks base method

func (*MockOptions) SetFlushSize

func (m *MockOptions) SetFlushSize(value int) Options

SetFlushSize mocks base method

func (*MockOptions) SetIdentifierPool

func (m *MockOptions) SetIdentifierPool(value ident.Pool) Options

SetIdentifierPool mocks base method

func (*MockOptions) SetInstrumentOptions

func (m *MockOptions) SetInstrumentOptions(value instrument.Options) Options

SetInstrumentOptions mocks base method

func (*MockOptions) SetReadConcurrency

func (m *MockOptions) SetReadConcurrency(concurrency int) Options

SetReadConcurrency mocks base method

func (*MockOptions) SetStrategy

func (m *MockOptions) SetStrategy(value Strategy) Options

SetStrategy mocks base method

func (*MockOptions) Strategy

func (m *MockOptions) Strategy() Strategy

Strategy mocks base method

func (*MockOptions) Validate

func (m *MockOptions) Validate() error

Validate mocks base method

type MockOptionsMockRecorder

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

MockOptionsMockRecorder is the mock recorder for MockOptions

func (*MockOptionsMockRecorder) BacklogQueueSize

func (mr *MockOptionsMockRecorder) BacklogQueueSize() *gomock.Call

BacklogQueueSize indicates an expected call of BacklogQueueSize

func (*MockOptionsMockRecorder) BlockSize

func (mr *MockOptionsMockRecorder) BlockSize() *gomock.Call

BlockSize indicates an expected call of BlockSize

func (*MockOptionsMockRecorder) BytesPool

func (mr *MockOptionsMockRecorder) BytesPool() *gomock.Call

BytesPool indicates an expected call of BytesPool

func (*MockOptionsMockRecorder) ClockOptions

func (mr *MockOptionsMockRecorder) ClockOptions() *gomock.Call

ClockOptions indicates an expected call of ClockOptions

func (*MockOptionsMockRecorder) FilesystemOptions

func (mr *MockOptionsMockRecorder) FilesystemOptions() *gomock.Call

FilesystemOptions indicates an expected call of FilesystemOptions

func (*MockOptionsMockRecorder) FlushInterval

func (mr *MockOptionsMockRecorder) FlushInterval() *gomock.Call

FlushInterval indicates an expected call of FlushInterval

func (*MockOptionsMockRecorder) FlushSize

func (mr *MockOptionsMockRecorder) FlushSize() *gomock.Call

FlushSize indicates an expected call of FlushSize

func (*MockOptionsMockRecorder) IdentifierPool

func (mr *MockOptionsMockRecorder) IdentifierPool() *gomock.Call

IdentifierPool indicates an expected call of IdentifierPool

func (*MockOptionsMockRecorder) InstrumentOptions

func (mr *MockOptionsMockRecorder) InstrumentOptions() *gomock.Call

InstrumentOptions indicates an expected call of InstrumentOptions

func (*MockOptionsMockRecorder) ReadConcurrency

func (mr *MockOptionsMockRecorder) ReadConcurrency() *gomock.Call

ReadConcurrency indicates an expected call of ReadConcurrency

func (*MockOptionsMockRecorder) SetBacklogQueueSize

func (mr *MockOptionsMockRecorder) SetBacklogQueueSize(value interface{}) *gomock.Call

SetBacklogQueueSize indicates an expected call of SetBacklogQueueSize

func (*MockOptionsMockRecorder) SetBlockSize

func (mr *MockOptionsMockRecorder) SetBlockSize(value interface{}) *gomock.Call

SetBlockSize indicates an expected call of SetBlockSize

func (*MockOptionsMockRecorder) SetBytesPool

func (mr *MockOptionsMockRecorder) SetBytesPool(value interface{}) *gomock.Call

SetBytesPool indicates an expected call of SetBytesPool

func (*MockOptionsMockRecorder) SetClockOptions

func (mr *MockOptionsMockRecorder) SetClockOptions(value interface{}) *gomock.Call

SetClockOptions indicates an expected call of SetClockOptions

func (*MockOptionsMockRecorder) SetFilesystemOptions

func (mr *MockOptionsMockRecorder) SetFilesystemOptions(value interface{}) *gomock.Call

SetFilesystemOptions indicates an expected call of SetFilesystemOptions

func (*MockOptionsMockRecorder) SetFlushInterval

func (mr *MockOptionsMockRecorder) SetFlushInterval(value interface{}) *gomock.Call

SetFlushInterval indicates an expected call of SetFlushInterval

func (*MockOptionsMockRecorder) SetFlushSize

func (mr *MockOptionsMockRecorder) SetFlushSize(value interface{}) *gomock.Call

SetFlushSize indicates an expected call of SetFlushSize

func (*MockOptionsMockRecorder) SetIdentifierPool

func (mr *MockOptionsMockRecorder) SetIdentifierPool(value interface{}) *gomock.Call

SetIdentifierPool indicates an expected call of SetIdentifierPool

func (*MockOptionsMockRecorder) SetInstrumentOptions

func (mr *MockOptionsMockRecorder) SetInstrumentOptions(value interface{}) *gomock.Call

SetInstrumentOptions indicates an expected call of SetInstrumentOptions

func (*MockOptionsMockRecorder) SetReadConcurrency

func (mr *MockOptionsMockRecorder) SetReadConcurrency(concurrency interface{}) *gomock.Call

SetReadConcurrency indicates an expected call of SetReadConcurrency

func (*MockOptionsMockRecorder) SetStrategy

func (mr *MockOptionsMockRecorder) SetStrategy(value interface{}) *gomock.Call

SetStrategy indicates an expected call of SetStrategy

func (*MockOptionsMockRecorder) Strategy

func (mr *MockOptionsMockRecorder) Strategy() *gomock.Call

Strategy indicates an expected call of Strategy

func (*MockOptionsMockRecorder) Validate

func (mr *MockOptionsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type Options

type Options interface {
	// Validate validates the Options
	Validate() error

	// SetClockOptions sets the clock options
	SetClockOptions(value clock.Options) Options

	// ClockOptions returns the clock options
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrumentation options
	SetInstrumentOptions(value instrument.Options) Options

	// InstrumentOptions returns the instrumentation options
	InstrumentOptions() instrument.Options

	// SetBlockSize sets the block size
	SetBlockSize(value time.Duration) Options

	// BlockSize returns the block size
	BlockSize() time.Duration

	// SetFilesystemOptions sets the filesystem options
	SetFilesystemOptions(value fs.Options) Options

	// FilesystemOptions returns the filesystem options
	FilesystemOptions() fs.Options

	// SetFlushSize sets the flush size
	SetFlushSize(value int) Options

	// FlushSize returns the flush size
	FlushSize() int

	// SetStrategy sets the strategy
	SetStrategy(value Strategy) Options

	// Strategy returns the strategy
	Strategy() Strategy

	// SetFlushInterval sets the flush interval
	SetFlushInterval(value time.Duration) Options

	// FlushInterval returns the flush interval
	FlushInterval() time.Duration

	// SetBacklogQueueSize sets the backlog queue size
	SetBacklogQueueSize(value int) Options

	// BacklogQueueSize returns the backlog queue size
	BacklogQueueSize() int

	// SetBytesPool sets the checked bytes pool
	SetBytesPool(value pool.CheckedBytesPool) Options

	// BytesPool returns the checked bytes pool
	BytesPool() pool.CheckedBytesPool

	// SetReadConcurrency sets the concurrency of the reader
	SetReadConcurrency(concurrency int) Options

	// ReadConcurrency returns the concurrency of the reader
	ReadConcurrency() int

	// SetIdentifierPool sets the IdentifierPool to use for pooling identifiers.
	SetIdentifierPool(value ident.Pool) Options

	// IdentifierPool returns the IdentifierPool to use for pooling identifiers.
	IdentifierPool() ident.Pool
}

Options represents the options for the commit log

func NewOptions

func NewOptions() Options

NewOptions creates new commit log options

type Series

type Series struct {
	// UniqueIndex is the unique index assigned to this series
	UniqueIndex uint64

	// Namespace is the namespace the series belongs to
	Namespace ident.ID

	// ID is the series identifier
	ID ident.ID

	// Tags are the series tags
	Tags ident.Tags // FOLLOWUP(prateek): wire Tags to commit log writer

	// Shard is the shard the series belongs to
	Shard uint32
}

Series describes a series in the commit log

type SeriesFilterPredicate

type SeriesFilterPredicate func(id ident.ID, namespace ident.ID) bool

SeriesFilterPredicate is a predicate that determines whether datapoints for a given series should be returned from the Commit log reader. The predicate is pushed down to the reader level to prevent having to run the same function for every datapoint for a given series.

func ReadAllSeriesPredicate

func ReadAllSeriesPredicate() SeriesFilterPredicate

ReadAllSeriesPredicate can be passed as the seriesPredicate for callers that want a convenient way to read all series in the commitlogs

type Strategy

type Strategy int

Strategy describes the commit log writing strategy

const (
	// StrategyWriteWait describes the strategy that waits
	// for the buffered commit log chunk that contains a write to flush
	// before acknowledging a write
	StrategyWriteWait Strategy = iota

	// StrategyWriteBehind describes the strategy that does not wait
	// for the buffered commit log chunk that contains a write to flush
	// before acknowledging a write
	StrategyWriteBehind
)

Jump to

Keyboard shortcuts

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