generators

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIndexesForColumn

func CreateIndexesForColumn(table *typedef.Table, maxIndexes int) []typedef.IndexDef

func CreateMaterializedViews added in v1.8.3

func CreateMaterializedViews(c typedef.Columns, tableName string, partitionKeys, clusteringKeys typedef.Columns, r *rand.Rand) []typedef.MaterializedView

func CreatePartitionKeyValues added in v1.8.5

func CreatePartitionKeyValues(table *typedef.Table, r *rand.Rand, g *typedef.PartitionRangeConfig) []interface{}

func CreatePkColumns

func CreatePkColumns(cnt int, prefix string) typedef.Columns

func GenColumnName

func GenColumnName(prefix string, idx int) string

func GenColumnType

func GenColumnType(numColumns int, sc *typedef.SchemaConfig, r *rand.Rand) typedef.Type

func GenIndexName

func GenIndexName(prefix string, idx int) string

func GenListType

func GenListType(sc *typedef.SchemaConfig, r *rand.Rand) *typedef.BagType

func GenMapType

func GenMapType(sc *typedef.SchemaConfig, r *rand.Rand) *typedef.MapType

func GenPartitionKeyColumnType

func GenPartitionKeyColumnType(r *rand.Rand) typedef.Type

func GenPrimaryKeyColumnType

func GenPrimaryKeyColumnType(r *rand.Rand) typedef.Type

func GenSchema

func GenSchema(sc typedef.SchemaConfig, seed uint64) *typedef.Schema

func GenSetType

func GenSetType(sc *typedef.SchemaConfig, r *rand.Rand) *typedef.BagType

func GenSimpleType

func GenSimpleType(_ *typedef.SchemaConfig, r *rand.Rand) typedef.SimpleType

func GenTupleType

func GenTupleType(sc *typedef.SchemaConfig, r *rand.Rand) typedef.Type

func GenUDTType

func GenUDTType(sc *typedef.SchemaConfig, r *rand.Rand) *typedef.UDTType

func GetCreateKeyspaces

func GetCreateKeyspaces(s *typedef.Schema) (string, string)

func GetCreateSchema

func GetCreateSchema(s *typedef.Schema) []string

func GetCreateTable

func GetCreateTable(t *typedef.Table, ks typedef.Keyspace) string

func GetCreateTypes

func GetCreateTypes(t *typedef.Table, keyspace typedef.Keyspace) []string

func GetDropSchema

func GetDropSchema(s *typedef.Schema) []string

Types

type Config

type Config struct {
	PartitionsDistributionFunc DistributionFunc
	PartitionsRangeConfig      typedef.PartitionRangeConfig
	PartitionsCount            uint64
	Seed                       uint64
	PkUsedBufferSize           uint64
}

type DistributionFunc

type DistributionFunc func() TokenIndex

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(table *typedef.Table, config *Config, logger *zap.Logger) *Generator

func (*Generator) FindAndMarkStalePartitions added in v1.8.7

func (g *Generator) FindAndMarkStalePartitions()

func (*Generator) Get

func (g *Generator) Get() *typedef.ValueWithToken

func (*Generator) GetOld

func (g *Generator) GetOld() *typedef.ValueWithToken

GetOld returns a previously used value and token or a new if the old queue is empty.

func (*Generator) GetPartitionForToken added in v1.8.7

func (g *Generator) GetPartitionForToken(token TokenIndex) *Partition

func (*Generator) GiveOld

func (g *Generator) GiveOld(v *typedef.ValueWithToken)

GiveOld returns the supplied value for later reuse unless

func (*Generator) GiveOlds added in v1.8.7

func (g *Generator) GiveOlds(tokens []*typedef.ValueWithToken)

GiveOlds returns the supplied values for later reuse unless

func (*Generator) PartitionCount

func (g *Generator) PartitionCount() uint64

func (*Generator) ReleaseToken

func (g *Generator) ReleaseToken(token uint64)

ReleaseToken removes the corresponding token from the in-flight tracking.

func (*Generator) Start added in v1.8.5

func (g *Generator) Start(stopFlag *stop.Flag)

type GeneratorInterface

type GeneratorInterface interface {
	Get() *typedef.ValueWithToken
	GetOld() *typedef.ValueWithToken
	GiveOld(_ *typedef.ValueWithToken)
	GiveOlds(_ []*typedef.ValueWithToken)
	ReleaseToken(_ uint64)
}

type Generators added in v1.8.5

type Generators []*Generator

func (Generators) StartAll added in v1.8.5

func (g Generators) StartAll(stopFlag *stop.Flag)

type Partition

type Partition struct {
	// contains filtered or unexported fields
}

func (*Partition) Close added in v1.8.5

func (s *Partition) Close()

func (*Partition) MarkStale added in v1.8.7

func (s *Partition) MarkStale()

func (*Partition) Stale added in v1.8.7

func (s *Partition) Stale() bool

type Partitions added in v1.8.3

type Partitions []*Partition

func NewPartitions added in v1.8.5

func NewPartitions(count, pkBufferSize int, wakeUpSignal chan struct{}) Partitions

func (Partitions) CloseAll added in v1.8.5

func (p Partitions) CloseAll()

type TokenIndex

type TokenIndex uint64

TokenIndex represents the position of a token in the token ring. A token index is translated to a token by a generators. If the generators preserves the exact position, then the token index becomes the token; otherwise token index represents an approximation of the token.

We use a token index approach, because our generators actually generate partition keys, and map them to tokens. The generators, therefore, do not populate the full token ring space. With token index, we can approximate different token distributions from a sparse set of tokens.

Jump to

Keyboard shortcuts

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