ts

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: 3 Imported by: 50

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

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
)

Jump to

Keyboard shortcuts

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