Documentation
¶
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 (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
// 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,
)
AddTagged(
originalIndex int,
id ident.ID,
tags ident.TagIterator,
timestamp time.Time,
value float64,
unit xtime.Unit,
annotation []byte,
)
}
BatchWriter is the interface that is used for preparing a batch of writes.
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) Equal ¶
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.
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
// 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)
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.