generate

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteAllPredicate added in v0.4.0

func WriteAllPredicate(_ ts.Datapoint) bool

WriteAllPredicate writes all datapoints

Types

type BlockConfig

type BlockConfig struct {
	IDs       []string
	Tags      ident.Tags
	NumPoints int
	Start     time.Time
}

BlockConfig represents the configuration to generate a SeriesBlock

type Options

type Options interface {
	// SetClockOptions sets the clock options
	SetClockOptions(value clock.Options) Options

	// ClockOptions returns the clock options
	ClockOptions() clock.Options

	// SetRetentionPeriod sets how long we intend to keep data in memory
	SetRetentionPeriod(value time.Duration) Options

	// RetentionPeriod returns how long we intend to keep data in memory
	RetentionPeriod() time.Duration

	// SetBlockSize sets the blockSize
	SetBlockSize(value time.Duration) Options

	// BlockSize returns the blockSize
	BlockSize() time.Duration

	// SetFilePathPrefix sets the file path prefix for sharded TSDB files
	SetFilePathPrefix(value string) Options

	// FilePathPrefix returns the file path prefix for sharded TSDB files
	FilePathPrefix() string

	// SetNewFileMode sets the new file mode
	SetNewFileMode(value os.FileMode) Options

	// NewFileMode returns the new file mode
	NewFileMode() os.FileMode

	// SetNewDirectoryMode sets the new directory mode
	SetNewDirectoryMode(value os.FileMode) Options

	// NewDirectoryMode returns the new directory mode
	NewDirectoryMode() os.FileMode

	// SetWriterBufferSize sets the buffer size for writing TSDB files
	SetWriterBufferSize(value int) Options

	// WriterBufferSize returns the buffer size for writing TSDB files
	WriterBufferSize() int

	// SetWriteEmptyShards sets whether writes are done even for empty start periods
	SetWriteEmptyShards(bool) Options

	// WriteEmptyShards returns whether writes are done even for empty start periods
	WriteEmptyShards() bool

	// SetWriteSnapshot sets whether writes are written as snapshot files
	SetWriteSnapshot(bool) Options

	// WriteSnapshots returns whether writes are written as snapshot files
	WriteSnapshot() bool

	// SetEncoderPool sets the contextPool
	SetEncoderPool(value encoding.EncoderPool) Options

	// EncoderPool returns the contextPool
	EncoderPool() encoding.EncoderPool
}

Options represent the parameters needed for the Writer

func NewOptions

func NewOptions() Options

NewOptions creates a new set of fs options

type Series

type Series struct {
	ID   ident.ID
	Tags ident.Tags
	Data []ts.Datapoint
}

Series represents a generated series of data

type SeriesBlock

type SeriesBlock []Series

SeriesBlock is a collection of Series'

func Block

func Block(conf BlockConfig) SeriesBlock

Block generates a SeriesBlock based on provided config

func (SeriesBlock) Len

func (l SeriesBlock) Len() int

Making SeriesBlock sortable

func (SeriesBlock) Less

func (l SeriesBlock) Less(i, j int) bool

func (SeriesBlock) Swap

func (l SeriesBlock) Swap(i, j int)

type SeriesBlocksByStart

type SeriesBlocksByStart map[xtime.UnixNano]SeriesBlock

SeriesBlocksByStart is a map of time -> SeriesBlock

func BlocksByStart

func BlocksByStart(confs []BlockConfig) SeriesBlocksByStart

BlocksByStart generates a map of SeriesBlocks keyed by Start time for the provided configs

type SeriesDataPoint

type SeriesDataPoint struct {
	ts.Datapoint
	ID ident.ID
}

SeriesDataPoint represents a single data point of a generated series of data

type SeriesDataPointsByTime

type SeriesDataPointsByTime []SeriesDataPoint

SeriesDataPointsByTime are a sorted list of SeriesDataPoints

func ToPointsByTime

func ToPointsByTime(seriesMaps SeriesBlocksByStart) SeriesDataPointsByTime

ToPointsByTime converts a SeriesBlocksByStart to SeriesDataPointsByTime

func (SeriesDataPointsByTime) Dearrange

Dearrange de-arranges the list by the defined percent.

func (SeriesDataPointsByTime) Len

func (l SeriesDataPointsByTime) Len() int

func (SeriesDataPointsByTime) Less

func (l SeriesDataPointsByTime) Less(i, j int) bool

func (SeriesDataPointsByTime) Swap

func (l SeriesDataPointsByTime) Swap(i, j int)

type WriteDatapointPredicate added in v0.4.0

type WriteDatapointPredicate func(dp ts.Datapoint) bool

WriteDatapointPredicate returns a boolean indicating whether a datapoint should be written.

type Writer

type Writer interface {
	// WriteData writes the data as data files.
	WriteData(
		ns ident.ID, shards sharding.ShardSet, data SeriesBlocksByStart) error

	// WriteSnapshot writes the data as snapshot files.
	WriteSnapshot(
		ns ident.ID,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		snapshotInterval time.Duration,
	) error

	// WriteDataWithPredicate writes all data that passes the predicate test as data files.
	WriteDataWithPredicate(
		ns ident.ID,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		pred WriteDatapointPredicate,
	) error

	// WriteSnapshotWithPredicate writes all data that passes the predicate test as snapshot files.
	WriteSnapshotWithPredicate(
		ns ident.ID,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		pred WriteDatapointPredicate,
		snapshotInterval time.Duration,
	) error
}

Writer writes generated data to disk

func NewWriter

func NewWriter(opts Options) Writer

NewWriter returns a new writer

Jump to

Keyboard shortcuts

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