generate

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: Apache-2.0 Imports: 18 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(_ TestValue) bool

WriteAllPredicate writes all datapoints

Types

type AnnotationGenerator added in v0.9.2

type AnnotationGenerator interface {
	Next() []byte
}

AnnotationGenerator generates the next annotation.

type BlockConfig

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

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 []TestValue
}

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 {
	Value TestValue
	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 TestValue added in v0.9.2

type TestValue struct {
	ts.Datapoint
	ts.Annotation
}

TestValue is a test datapoint and an annotation.

type UpdateBlockConfig added in v0.9.2

type UpdateBlockConfig func([]BlockConfig)

UpdateBlockConfig is a function used o update BlockConfigs.

type WriteDatapointPredicate added in v0.4.0

type WriteDatapointPredicate func(dp TestValue) 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(
		nsCtx ns.Context,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		volume int,
	) error

	// WriteSnapshot writes the data as snapshot files.
	WriteSnapshot(
		nsCtx ns.Context,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		volume int,
		snapshotInterval time.Duration,
	) error

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

	// WriteSnapshotWithPredicate writes all data that passes the predicate test as snapshot files.
	WriteSnapshotWithPredicate(
		nsCtx ns.Context,
		shards sharding.ShardSet,
		data SeriesBlocksByStart,
		volume int,
		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