targets

package
v0.0.0-...-37fced7 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 6 Imported by: 65

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Len() uint
	Append(data.LoadedPoint)
}

Batch is an aggregate of points for a particular data system. It needs to have a way to measure it's size to make sure it does not get too large and it needs a way to append a point

type BatchFactory

type BatchFactory interface {
	// New returns a new Batch to add Points to
	New() Batch
}

BatchFactory returns a new empty batch for storing points.

type Benchmark

type Benchmark interface {
	// GetDataSource returns the DataSource to use for this Benchmark
	GetDataSource() DataSource

	// GetBatchFactory returns the BatchFactory to use for this Benchmark
	GetBatchFactory() BatchFactory

	// GetPointIndexer returns the PointIndexer to use for this Benchmark
	GetPointIndexer(maxPartitions uint) PointIndexer

	// GetProcessor returns the Processor to use for this Benchmark
	GetProcessor() Processor

	// GetDBCreator returns the DBCreator to use for this Benchmark
	GetDBCreator() DBCreator
}

Benchmark is an interface that represents the skeleton of a program needed to run an insert or load benchmark.

type ConstantIndexer

type ConstantIndexer struct{}

ConstantIndexer always puts the item on a single channel. This is the typical use case where all the workers share the same channel

func (*ConstantIndexer) GetIndex

func (i *ConstantIndexer) GetIndex(_ data.LoadedPoint) uint

GetIndex returns a constant index (0) regardless of Point

type DBCreator

type DBCreator interface {
	// Init should set up any connection or other setup for talking to the DB, but should NOT create any databases
	Init()

	// DBExists checks if a database with the given name currently exists.
	DBExists(dbName string) bool

	// CreateDB creates a database with the given name.
	CreateDB(dbName string) error

	// RemoveOldDB removes an existing database with the given name.
	RemoveOldDB(dbName string) error
}

DBCreator is an interface for a benchmark to do the initial setup of a database in preparation for running a benchmark against it.

type DBCreatorCloser

type DBCreatorCloser interface {
	DBCreator

	// Close cleans up any database connections
	Close()
}

DBCreatorCloser is a DBCreator that also needs a Close method to cleanup any connections after the benchmark is finished.

type DBCreatorPost

type DBCreatorPost interface {
	DBCreator

	// PostCreateDB does further initialization after the database is created
	PostCreateDB(dbName string) error
}

DBCreatorPost is a DBCreator that also needs to do some initialization after the database is created (e.g., only one client should actually create the DB, so non-creator clients should still set themselves up for writing)

type DataSource

type DataSource interface {
	NextItem() data.LoadedPoint
	Headers() *common.GeneratedDataHeaders
}

type ImplementedTarget

type ImplementedTarget interface {
	Benchmark(targetDB string, dataSourceConfig *source.DataSourceConfig, v *viper.Viper) (Benchmark, error)
	Serializer() serialize.PointSerializer
	// TargetSpecificFlags adds to the supplied flagSet a number of target-specific
	// flags that will be enabled only when executing a command for this specific
	// target database.
	// flagPrefix is a string that should be concatenated with the names of all flags defined here
	// it is needed to prevent namespace collisions and the ability to override properties
	// defined in the yaml config
	TargetSpecificFlags(flagPrefix string, flagSet *pflag.FlagSet)
	TargetName() string
}

type PointIndexer

type PointIndexer interface {
	// GetIndex returns a partition for the given Point
	GetIndex(data.LoadedPoint) uint
}

PointIndexer determines the index of the Batch (and subsequently the channel) that a particular point belongs to

type Processor

type Processor interface {
	// Init does per-worker setup needed before receiving data
	Init(workerNum int, doLoad, hashWorkers bool)
	// ProcessBatch handles a single batch of data
	ProcessBatch(b Batch, doLoad bool) (metricCount, rowCount uint64)
}

Processor is a type that processes the work for a loading worker

type ProcessorCloser

type ProcessorCloser interface {
	Processor
	// Close cleans up after a Processor
	Close(doLoad bool)
}

ProcessorCloser is a Processor that also needs to close or cleanup afterwards

Jump to

Keyboard shortcuts

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