writes

package
v0.15.17-hotfix.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package writes is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchWrite

type BatchWrite struct {
	// Used by the commitlog. If this is false, the commitlog should not write
	// the series at this index.
	SkipWrite bool
	// PendingIndex returns whether a write has a pending index.
	PendingIndex bool
	// Used by the commitlog (series needed to be updated by the shard
	// object first, cannot use the Series provided by the caller as it
	// is missing important fields like Tags.)
	Write Write
	// Not used by the commitlog, provided by the caller (since the request
	// is usually coming from over the wire) and is superseded by the Tags
	// in Write.Series which will get set by the Shard object.
	TagIter ident.TagIterator
	// EncodedTags is used by the commit log, but also held onto as a reference
	// here so that it can be returned to the pool after the write to commit log
	// completes (since the Write.Series gets overwritten in SetOutcome so can't
	// use the reference there for returning to the pool).
	EncodedTags ts.EncodedTags
	// Used to help the caller tie errors back to an index in their
	// own collection.
	OriginalIndex int
	// Used by the commitlog.
	Err error
}

BatchWrite represents a write that was added to the BatchWriter.

type BatchWriter

type BatchWriter interface {
	Add(
		originalIndex int,
		id ident.ID,
		timestamp time.Time,
		value float64,
		unit xtime.Unit,
		annotation []byte,
	) error

	AddTagged(
		originalIndex int,
		id ident.ID,
		tags ident.TagIterator,
		encodedTags ts.EncodedTags,
		timestamp time.Time,
		value float64,
		unit xtime.Unit,
		annotation []byte,
	) error

	SetFinalizeEncodedTagsFn(f FinalizeEncodedTagsFn)

	SetFinalizeAnnotationFn(f FinalizeAnnotationFn)
}

BatchWriter is the interface that is used for preparing a batch of writes.

type FinalizeAnnotationFn

type FinalizeAnnotationFn func(b []byte)

FinalizeAnnotationFn is a function that will be called for each annotation once the WriteBatch itself is finalized.

type FinalizeEncodedTagsFn

type FinalizeEncodedTagsFn func(b []byte)

FinalizeEncodedTagsFn is a function that will be called for each encoded tags once the WriteBatch itself is finalized.

type MockBatchWriter

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

MockBatchWriter is a mock of BatchWriter interface

func NewMockBatchWriter

func NewMockBatchWriter(ctrl *gomock.Controller) *MockBatchWriter

NewMockBatchWriter creates a new mock instance

func (*MockBatchWriter) Add

func (m *MockBatchWriter) Add(originalIndex int, id ident.ID, timestamp time.Time, value float64, unit time0.Unit, annotation []byte) error

Add mocks base method

func (*MockBatchWriter) AddTagged

func (m *MockBatchWriter) AddTagged(originalIndex int, id ident.ID, tags ident.TagIterator, encodedTags ts.EncodedTags, timestamp time.Time, value float64, unit time0.Unit, annotation []byte) error

AddTagged mocks base method

func (*MockBatchWriter) EXPECT

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

func (*MockBatchWriter) SetFinalizeAnnotationFn

func (m *MockBatchWriter) SetFinalizeAnnotationFn(f FinalizeAnnotationFn)

SetFinalizeAnnotationFn mocks base method

func (*MockBatchWriter) SetFinalizeEncodedTagsFn

func (m *MockBatchWriter) SetFinalizeEncodedTagsFn(f FinalizeEncodedTagsFn)

SetFinalizeEncodedTagsFn mocks base method

type MockBatchWriterMockRecorder

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

MockBatchWriterMockRecorder is the mock recorder for MockBatchWriter

func (*MockBatchWriterMockRecorder) Add

func (mr *MockBatchWriterMockRecorder) Add(originalIndex, id, timestamp, value, unit, annotation interface{}) *gomock.Call

Add indicates an expected call of Add

func (*MockBatchWriterMockRecorder) AddTagged

func (mr *MockBatchWriterMockRecorder) AddTagged(originalIndex, id, tags, encodedTags, timestamp, value, unit, annotation interface{}) *gomock.Call

AddTagged indicates an expected call of AddTagged

func (*MockBatchWriterMockRecorder) SetFinalizeAnnotationFn

func (mr *MockBatchWriterMockRecorder) SetFinalizeAnnotationFn(f interface{}) *gomock.Call

SetFinalizeAnnotationFn indicates an expected call of SetFinalizeAnnotationFn

func (*MockBatchWriterMockRecorder) SetFinalizeEncodedTagsFn

func (mr *MockBatchWriterMockRecorder) SetFinalizeEncodedTagsFn(f interface{}) *gomock.Call

SetFinalizeEncodedTagsFn indicates an expected call of SetFinalizeEncodedTagsFn

type MockWriteBatch

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

MockWriteBatch is a mock of WriteBatch interface

func NewMockWriteBatch

func NewMockWriteBatch(ctrl *gomock.Controller) *MockWriteBatch

NewMockWriteBatch creates a new mock instance

func (*MockWriteBatch) Add

func (m *MockWriteBatch) Add(originalIndex int, id ident.ID, timestamp time.Time, value float64, unit time0.Unit, annotation []byte) error

Add mocks base method

func (*MockWriteBatch) AddTagged

func (m *MockWriteBatch) AddTagged(originalIndex int, id ident.ID, tags ident.TagIterator, encodedTags ts.EncodedTags, timestamp time.Time, value float64, unit time0.Unit, annotation []byte) error

AddTagged mocks base method

func (*MockWriteBatch) EXPECT

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

func (*MockWriteBatch) Finalize

func (m *MockWriteBatch) Finalize()

Finalize mocks base method

func (*MockWriteBatch) Iter

func (m *MockWriteBatch) Iter() []BatchWrite

Iter mocks base method

func (*MockWriteBatch) PendingIndex

func (m *MockWriteBatch) PendingIndex() []PendingIndexInsert

PendingIndex mocks base method

func (*MockWriteBatch) Reset

func (m *MockWriteBatch) Reset(batchSize int, ns ident.ID)

Reset mocks base method

func (*MockWriteBatch) SetError

func (m *MockWriteBatch) SetError(idx int, err error)

SetError mocks base method

func (*MockWriteBatch) SetFinalizeAnnotationFn

func (m *MockWriteBatch) SetFinalizeAnnotationFn(f FinalizeAnnotationFn)

SetFinalizeAnnotationFn mocks base method

func (*MockWriteBatch) SetFinalizeEncodedTagsFn

func (m *MockWriteBatch) SetFinalizeEncodedTagsFn(f FinalizeEncodedTagsFn)

SetFinalizeEncodedTagsFn mocks base method

func (*MockWriteBatch) SetPendingIndex

func (m *MockWriteBatch) SetPendingIndex(idx int, pending PendingIndexInsert)

SetPendingIndex mocks base method

func (*MockWriteBatch) SetSeries

func (m *MockWriteBatch) SetSeries(idx int, series ts.Series)

SetSeries mocks base method

func (*MockWriteBatch) SetSkipWrite

func (m *MockWriteBatch) SetSkipWrite(idx int)

SetSkipWrite mocks base method

type MockWriteBatchMockRecorder

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

MockWriteBatchMockRecorder is the mock recorder for MockWriteBatch

func (*MockWriteBatchMockRecorder) Add

func (mr *MockWriteBatchMockRecorder) Add(originalIndex, id, timestamp, value, unit, annotation interface{}) *gomock.Call

Add indicates an expected call of Add

func (*MockWriteBatchMockRecorder) AddTagged

func (mr *MockWriteBatchMockRecorder) AddTagged(originalIndex, id, tags, encodedTags, timestamp, value, unit, annotation interface{}) *gomock.Call

AddTagged indicates an expected call of AddTagged

func (*MockWriteBatchMockRecorder) Finalize

func (mr *MockWriteBatchMockRecorder) Finalize() *gomock.Call

Finalize indicates an expected call of Finalize

func (*MockWriteBatchMockRecorder) Iter

Iter indicates an expected call of Iter

func (*MockWriteBatchMockRecorder) PendingIndex

func (mr *MockWriteBatchMockRecorder) PendingIndex() *gomock.Call

PendingIndex indicates an expected call of PendingIndex

func (*MockWriteBatchMockRecorder) Reset

func (mr *MockWriteBatchMockRecorder) Reset(batchSize, ns interface{}) *gomock.Call

Reset indicates an expected call of Reset

func (*MockWriteBatchMockRecorder) SetError

func (mr *MockWriteBatchMockRecorder) SetError(idx, err interface{}) *gomock.Call

SetError indicates an expected call of SetError

func (*MockWriteBatchMockRecorder) SetFinalizeAnnotationFn

func (mr *MockWriteBatchMockRecorder) SetFinalizeAnnotationFn(f interface{}) *gomock.Call

SetFinalizeAnnotationFn indicates an expected call of SetFinalizeAnnotationFn

func (*MockWriteBatchMockRecorder) SetFinalizeEncodedTagsFn

func (mr *MockWriteBatchMockRecorder) SetFinalizeEncodedTagsFn(f interface{}) *gomock.Call

SetFinalizeEncodedTagsFn indicates an expected call of SetFinalizeEncodedTagsFn

func (*MockWriteBatchMockRecorder) SetPendingIndex

func (mr *MockWriteBatchMockRecorder) SetPendingIndex(idx, pending interface{}) *gomock.Call

SetPendingIndex indicates an expected call of SetPendingIndex

func (*MockWriteBatchMockRecorder) SetSeries

func (mr *MockWriteBatchMockRecorder) SetSeries(idx, series interface{}) *gomock.Call

SetSeries indicates an expected call of SetSeries

func (*MockWriteBatchMockRecorder) SetSkipWrite

func (mr *MockWriteBatchMockRecorder) SetSkipWrite(idx interface{}) *gomock.Call

SetSkipWrite indicates an expected call of SetSkipWrite

type PendingIndexInsert

type PendingIndexInsert struct {
	Entry    index.WriteBatchEntry
	Document doc.Document
}

PendingIndexInsert is a pending index insert.

type Write

type Write struct {
	Series     ts.Series
	Datapoint  ts.Datapoint
	Unit       xtime.Unit
	Annotation ts.Annotation
}

Write is a write for the commitlog.

type WriteBatch

type WriteBatch interface {
	BatchWriter
	// Can't use a real iterator pattern here as it slows things down.
	Iter() []BatchWrite
	SetPendingIndex(idx int, pending PendingIndexInsert)
	PendingIndex() []PendingIndexInsert
	SetError(idx int, err error)
	SetSeries(idx int, series ts.Series)
	SetSkipWrite(idx int)
	Reset(batchSize int, ns ident.ID)
	Finalize()
	// contains filtered or unexported methods
}

WriteBatch is the interface that supports adding writes to the batch, as well as iterating through the batched writes and resetting the struct (for pooling).

func NewWriteBatch

func NewWriteBatch(
	batchSize int,
	ns ident.ID,
	finalizeFn func(WriteBatch),
) WriteBatch

NewWriteBatch creates a new WriteBatch.

type WriteBatchPool

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

WriteBatchPool is a pool of WriteBatch.

func NewWriteBatchPool

func NewWriteBatchPool(
	opts pool.ObjectPoolOptions,
	initialBatchSizeOverride,
	maxBatchSizeOverride *int,
) *WriteBatchPool

NewWriteBatchPool constructs a new WriteBatchPool.

func (*WriteBatchPool) Get

func (p *WriteBatchPool) Get() WriteBatch

Get retrieves a WriteBatch from the pool.

func (*WriteBatchPool) Init

func (p *WriteBatchPool) Init()

Init initializes a WriteBatchPool.

func (*WriteBatchPool) Put

func (p *WriteBatchPool) Put(w WriteBatch)

Put stores a WriteBatch in the pool.

Jump to

Keyboard shortcuts

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