ts

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ts is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation []byte

Annotation represents information used to annotate datapoints.

type BatchWrite added in v0.4.8

type BatchWrite struct {
	// Used by the commitlog. If this is false, the commitlog should not write
	// the series at this index.
	SkipWrite 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 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 added in v0.4.8

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 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 Datapoint

type Datapoint struct {
	Timestamp time.Time
	Value     float64
}

A Datapoint is a single data value reported at a given time.

func (Datapoint) Equal

func (d Datapoint) Equal(x Datapoint) bool

Equal returns whether one Datapoint is equal to another

type EncodedTags added in v0.11.0

type EncodedTags []byte

EncodedTags represents the encoded tags for the series.

type FinalizeAnnotationFn added in v0.7.3

type FinalizeAnnotationFn func(b []byte)

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

type FinalizeEncodedTagsFn added in v0.11.0

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 added in v0.7.0

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

MockBatchWriter is a mock of BatchWriter interface

func NewMockBatchWriter added in v0.7.0

func NewMockBatchWriter(ctrl *gomock.Controller) *MockBatchWriter

NewMockBatchWriter creates a new mock instance

func (*MockBatchWriter) Add added in v0.7.0

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 added in v0.7.0

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

AddTagged mocks base method

func (*MockBatchWriter) EXPECT added in v0.7.0

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

func (*MockBatchWriter) SetFinalizeAnnotationFn added in v0.7.3

func (m *MockBatchWriter) SetFinalizeAnnotationFn(f FinalizeAnnotationFn)

SetFinalizeAnnotationFn mocks base method

func (*MockBatchWriter) SetFinalizeEncodedTagsFn added in v0.11.0

func (m *MockBatchWriter) SetFinalizeEncodedTagsFn(f FinalizeEncodedTagsFn)

SetFinalizeEncodedTagsFn mocks base method

type MockBatchWriterMockRecorder added in v0.7.0

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

MockBatchWriterMockRecorder is the mock recorder for MockBatchWriter

func (*MockBatchWriterMockRecorder) Add added in v0.7.0

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

Add indicates an expected call of Add

func (*MockBatchWriterMockRecorder) AddTagged added in v0.7.0

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 added in v0.7.3

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

SetFinalizeAnnotationFn indicates an expected call of SetFinalizeAnnotationFn

func (*MockBatchWriterMockRecorder) SetFinalizeEncodedTagsFn added in v0.11.0

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

SetFinalizeEncodedTagsFn indicates an expected call of SetFinalizeEncodedTagsFn

type MockWriteBatch added in v0.7.0

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

MockWriteBatch is a mock of WriteBatch interface

func NewMockWriteBatch added in v0.7.0

func NewMockWriteBatch(ctrl *gomock.Controller) *MockWriteBatch

NewMockWriteBatch creates a new mock instance

func (*MockWriteBatch) Add added in v0.7.0

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 added in v0.7.0

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

AddTagged mocks base method

func (*MockWriteBatch) EXPECT added in v0.7.0

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

func (*MockWriteBatch) Finalize added in v0.7.0

func (m *MockWriteBatch) Finalize()

Finalize mocks base method

func (*MockWriteBatch) Iter added in v0.7.0

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

Iter mocks base method

func (*MockWriteBatch) Reset added in v0.7.0

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

Reset mocks base method

func (*MockWriteBatch) SetFinalizeAnnotationFn added in v0.7.3

func (m *MockWriteBatch) SetFinalizeAnnotationFn(f FinalizeAnnotationFn)

SetFinalizeAnnotationFn mocks base method

func (*MockWriteBatch) SetFinalizeEncodedTagsFn added in v0.11.0

func (m *MockWriteBatch) SetFinalizeEncodedTagsFn(f FinalizeEncodedTagsFn)

SetFinalizeEncodedTagsFn mocks base method

func (*MockWriteBatch) SetOutcome added in v0.7.0

func (m *MockWriteBatch) SetOutcome(idx int, series Series, err error)

SetOutcome mocks base method

func (*MockWriteBatch) SetSkipWrite added in v0.7.0

func (m *MockWriteBatch) SetSkipWrite(idx int)

SetSkipWrite mocks base method

type MockWriteBatchMockRecorder added in v0.7.0

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

MockWriteBatchMockRecorder is the mock recorder for MockWriteBatch

func (*MockWriteBatchMockRecorder) Add added in v0.7.0

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

Add indicates an expected call of Add

func (*MockWriteBatchMockRecorder) AddTagged added in v0.7.0

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 added in v0.7.0

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

Finalize indicates an expected call of Finalize

func (*MockWriteBatchMockRecorder) Iter added in v0.7.0

Iter indicates an expected call of Iter

func (*MockWriteBatchMockRecorder) Reset added in v0.7.0

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

Reset indicates an expected call of Reset

func (*MockWriteBatchMockRecorder) SetFinalizeAnnotationFn added in v0.7.3

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

SetFinalizeAnnotationFn indicates an expected call of SetFinalizeAnnotationFn

func (*MockWriteBatchMockRecorder) SetFinalizeEncodedTagsFn added in v0.11.0

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

SetFinalizeEncodedTagsFn indicates an expected call of SetFinalizeEncodedTagsFn

func (*MockWriteBatchMockRecorder) SetOutcome added in v0.7.0

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

SetOutcome indicates an expected call of SetOutcome

func (*MockWriteBatchMockRecorder) SetSkipWrite added in v0.7.0

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

SetSkipWrite indicates an expected call of SetSkipWrite

type Segment

type Segment struct {
	// Head is the head of the segment.
	Head checked.Bytes

	// Tail is the tail of the segment.
	Tail checked.Bytes

	// SegmentFlags declares whether to finalize when finalizing the segment.
	Flags SegmentFlags
}

Segment represents a binary blob consisting of two byte slices and declares whether they should be finalized when the segment is finalized.

func NewSegment

func NewSegment(
	head, tail checked.Bytes,
	flags SegmentFlags,
) Segment

NewSegment will create a new segment and increment the refs to head and tail if they are non-nil. When finalized the segment will also finalize the byte slices if FinalizeBytes is passed.

func (*Segment) Clone added in v0.6.0

func (s *Segment) Clone(pool pool.CheckedBytesPool) Segment

Clone will create a copy of this segment with an optional bytes pool.

func (*Segment) Equal

func (s *Segment) Equal(other *Segment) bool

Equal returns if this segment is equal to another. WARNING: This should only be used in code paths not executed often as it allocates bytes to concat each segment head and tail together before comparing the contents.

func (*Segment) Finalize

func (s *Segment) Finalize()

Finalize will finalize the segment by decrementing refs to head and tail if they are non-nil.

func (*Segment) Len

func (s *Segment) Len() int

Len returns the length of the head and tail.

type SegmentFlags

type SegmentFlags uint8

SegmentFlags describes the option to finalize or not finalize bytes in a Segment.

const (
	// FinalizeNone specifies to finalize neither of the bytes
	FinalizeNone SegmentFlags = 1 << 0
	// FinalizeHead specifies to finalize the head bytes
	FinalizeHead SegmentFlags = 1 << 1
	// FinalizeTail specifies to finalize the tail bytes
	FinalizeTail SegmentFlags = 1 << 2
)

type Series added in v0.4.8

type Series struct {
	// UniqueIndex is the unique index assigned to this series (only valid
	// on a per-process basis).
	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

	// EncodedTags are the series encoded tags, if set then call sites can
	// avoid needing to encoded the tags from the series tags provided.
	EncodedTags EncodedTags

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

Series describes a series.

type Write added in v0.4.8

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

Write is a write for the commitlog.

type WriteBatch added in v0.4.8

type WriteBatch interface {
	BatchWriter
	// Can't use a real iterator pattern here as it slows things down.
	Iter() []BatchWrite
	SetOutcome(idx int, series Series, err error)
	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 added in v0.4.8

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

NewWriteBatch creates a new WriteBatch.

type WriteBatchPool added in v0.4.8

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

WriteBatchPool is a pool of WriteBatch.

func NewWriteBatchPool added in v0.4.8

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

NewWriteBatchPool constructs a new WriteBatchPool.

func (*WriteBatchPool) Get added in v0.4.8

func (p *WriteBatchPool) Get() WriteBatch

Get retrieves a WriteBatch from the pool.

func (*WriteBatchPool) Init added in v0.4.8

func (p *WriteBatchPool) Init()

Init initializes a WriteBatchPool.

func (*WriteBatchPool) Put added in v0.4.8

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