ts

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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

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

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

type EncodedTags []byte

EncodedTags represents the encoded tags for the series.

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 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 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) Reset

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

Reset 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) SetOutcome

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

SetOutcome 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) Reset

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

Reset indicates an expected call of Reset

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) SetOutcome

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

SetOutcome indicates an expected call of SetOutcome

func (*MockWriteBatchMockRecorder) SetSkipWrite

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

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

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

type Write struct {
	Series     Series
	Datapoint  Datapoint
	Unit       xtime.Unit
	Annotation 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
	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

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