generator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalAggregation

func MarshalAggregation(agg query.Aggregation) (*aggContainer, error)

Marshal a aggregation to a re-parsable JSON object

func MarshalPredicate

func MarshalPredicate(pred query.Predicate) ([]byte, error)

Marshal a predicate to a re-parsable JSON object

func MarshalQueries

func MarshalQueries(q []query.Query, config string) ([]byte, error)

func MarshalQuery

func MarshalQuery(q query.Query) ([]byte, error)

func UnmarshalAggregation

func UnmarshalAggregation(data aggContainer) (query.Aggregation, error)

Unmarshal a aggregation to a re-parsable JSON object

func UnmarshalPredicate

func UnmarshalPredicate(data []byte) (query.Predicate, error)

Unmarshal a predicate to a re-parsable JSON object

func UnmarshalQueries

func UnmarshalQueries(b []byte) ([]query.Query, string, error)

func UnmarshalQuery

func UnmarshalQuery(b []byte) (*query.Query, error)

Types

type AggregationFactory

type AggregationFactory interface {
	// Checks whether the aggregation can be used on the given dataset
	IsApplicable(p dataset.DataPath) bool
	// Generates the aggregation
	Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Aggregation
	// Returns the ID/name of the generated aggregation
	ID() string
	// Returns the Type of the aggregation
	Type() reflect.Type
}

A AggregationFactory generates a aggregation from a given Datapath

type AggregationFactoryRepo

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

func GetAggregationFactoryRepo

func GetAggregationFactoryRepo() AggregationFactoryRepo

func (*AggregationFactoryRepo) Exclude

func (repo *AggregationFactoryRepo) Exclude(id string)

Excludes a AggregationFactory from the list of chosen factories

func (AggregationFactoryRepo) GetAll

Return a list of all aggregations

func (AggregationFactoryRepo) GetAllIDs

func (repo AggregationFactoryRepo) GetAllIDs() []string

Return a list of all aggregation IDs

func (AggregationFactoryRepo) GetByID

Returns a AggregationFactory by ID

func (AggregationFactoryRepo) GetChosen

func (repo AggregationFactoryRepo) GetChosen() []AggregationFactory

Return a list of the chosen aggregations

func (*AggregationFactoryRepo) Include

func (repo *AggregationFactoryRepo) Include(id string) error

Include the Aggregation Factory of the given name

func (*AggregationFactoryRepo) SetAll

func (repo *AggregationFactoryRepo) SetAll()

Sets the chosen aggregations to all available aggregations

func (*AggregationFactoryRepo) SetDefault

func (repo *AggregationFactoryRepo) SetDefault()

Sets the chosen aggregations to the default aggregations (all)

type ArraySizePredicateFactory

type ArraySizePredicateFactory struct {
}

Array Size

func (ArraySizePredicateFactory) Generate

func (e ArraySizePredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (ArraySizePredicateFactory) ID

func (ArraySizePredicateFactory) IsApplicable

func (factory ArraySizePredicateFactory) IsApplicable(path dataset.DataPath) bool

func (ArraySizePredicateFactory) Type

type Blacklist

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

type BoolEqualityPredicateFactory

type BoolEqualityPredicateFactory struct {
}

Bool Equality

func (BoolEqualityPredicateFactory) Generate

func (e BoolEqualityPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (BoolEqualityPredicateFactory) ID

func (BoolEqualityPredicateFactory) IsApplicable

func (factory BoolEqualityPredicateFactory) IsApplicable(path dataset.DataPath) bool

func (BoolEqualityPredicateFactory) Type

type CountAggregationFactory

type CountAggregationFactory struct {
}

func (CountAggregationFactory) Generate

func (e CountAggregationFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Aggregation

Generates the aggregation

func (CountAggregationFactory) ID

func (CountAggregationFactory) IsApplicable

func (e CountAggregationFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the aggregation can be used on the given dataset

func (CountAggregationFactory) Type

type CountAllAggregationFactory

type CountAllAggregationFactory struct {
}

func (CountAllAggregationFactory) Generate

func (e CountAllAggregationFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Aggregation

Generates the aggregation

func (CountAllAggregationFactory) ID

func (CountAllAggregationFactory) IsApplicable

func (e CountAllAggregationFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the aggregation can be used on the given dataset

func (CountAllAggregationFactory) Type

type ExistsPredicateFactory

type ExistsPredicateFactory struct {
}

func (ExistsPredicateFactory) Generate

func (e ExistsPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (ExistsPredicateFactory) ID

func (ExistsPredicateFactory) IsApplicable

func (e ExistsPredicateFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the predicate can be used on the given dataset

func (ExistsPredicateFactory) Type

type FloatComparisonPredicateFactory

type FloatComparisonPredicateFactory struct {
}

FloatComparison

func (FloatComparisonPredicateFactory) Generate

Generates the predicate

func (FloatComparisonPredicateFactory) ID

func (FloatComparisonPredicateFactory) IsApplicable

func (factory FloatComparisonPredicateFactory) IsApplicable(path dataset.DataPath) bool

func (FloatComparisonPredicateFactory) Type

type Generator

type Generator struct {

	// The minimum selectivity each query should have
	MinSelectivity float64
	// The maximum selectivity each query should have
	MaxSelectivity float64
	// Maximum chained AND/OR predicates
	MaxChain int
	// Maximum tries to roll valid query parts
	MaxTries int
	// Probability to randomly browse to a new node
	RandomBrowseProb float64
	// Probability to go back to previous node
	GoBackProb float64
	// Predicates to use in Generator
	Predicates []PredicateFactory
	// Aggregations to use in Generator
	Aggregations []AggregationFactory
	// Probability to perform an aggregation
	AggregationProb float64

	// Weighted path choosing
	WeightedPaths bool
	// Blacklist
	Blacklists map[string]*Blacklist
	// contains filtered or unexported fields
}

func New

func New(seed int64) Generator

func (*Generator) GenerateQuerySet

func (g *Generator) GenerateQuerySet(datasets []dataset.DataSet, num_queries int64) (queries []query.Query)

Returns a full benchmark query set

func (*Generator) GenerateQuerySetWithJoda

func (g *Generator) GenerateQuerySetWithJoda(datasets []dataset.DataSet, num_queries int64, joda_con joda.JodaConnection) ([]query.Query, error)

Returns a full benchmark query set. Each query is tested against the JODA backend

func (*Generator) Network

func (g *Generator) Network() Network

Returns the Network

func (*Generator) PrintConfig

func (g *Generator) PrintConfig() string

Returns the config as a string

func (*Generator) Statistics

func (g *Generator) Statistics() Statistics

Returns execution Statistics

type GroupByAggregationFactory

type GroupByAggregationFactory struct {
}

func (GroupByAggregationFactory) Generate

func (e GroupByAggregationFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Aggregation

Generates the aggregation

func (GroupByAggregationFactory) GenerateWithSubAgg

func (e GroupByAggregationFactory) GenerateWithSubAgg(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand, subAgg query.Aggregation) query.Aggregation

func (GroupByAggregationFactory) ID

func (GroupByAggregationFactory) IsApplicable

func (e GroupByAggregationFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the aggregation can be used on the given dataset

func (GroupByAggregationFactory) Type

type IntEqualityPredicateFactory

type IntEqualityPredicateFactory struct {
}

IntEquality

func (IntEqualityPredicateFactory) Generate

func (e IntEqualityPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (IntEqualityPredicateFactory) ID

func (IntEqualityPredicateFactory) IsApplicable

func (factory IntEqualityPredicateFactory) IsApplicable(path dataset.DataPath) bool

func (IntEqualityPredicateFactory) Type

type IsStringPredicateFactory

type IsStringPredicateFactory struct {
}

IsString

func (IsStringPredicateFactory) Generate

func (e IsStringPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (IsStringPredicateFactory) ID

func (IsStringPredicateFactory) IsApplicable

func (e IsStringPredicateFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the predicate can be used on the given dataset

func (IsStringPredicateFactory) Type

type Network

type Network struct {
	Nodes        map[string]NetworkNode
	Edges        []NetworkEdge
	MaxTimestamp uint
}

type NetworkEdge

type NetworkEdge struct {
	From  string
	To    string
	Query query.Query
	// 0 = Stay, 1 = Back, 2 = RandomJump, 3 = Query
	JumpType  int
	Timestamp uint
}

type NetworkNode

type NetworkNode struct {
	DSName    string
	Original  bool
	Size      uint64
	Timestamp uint
}

type ObjectSizePredicateFactory

type ObjectSizePredicateFactory struct {
}

func (ObjectSizePredicateFactory) Generate

func (e ObjectSizePredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (ObjectSizePredicateFactory) ID

func (ObjectSizePredicateFactory) IsApplicable

func (factory ObjectSizePredicateFactory) IsApplicable(path dataset.DataPath) bool

func (ObjectSizePredicateFactory) Type

type PredicateFactory

type PredicateFactory interface {
	// Checks whether the predicate can be used on the given dataset
	IsApplicable(p dataset.DataPath) bool
	// Generates the predicate
	Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate
	// Returns the ID/name of the generated predicate
	ID() string
	// Returns the Type of the predicate
	Type() reflect.Type
}

A PredicateFactory generates a predicate from a given Datapath

type PredicateFactoryRepo

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

func GetPredicateFactoryRepo

func GetPredicateFactoryRepo() PredicateFactoryRepo

func (*PredicateFactoryRepo) Exclude

func (repo *PredicateFactoryRepo) Exclude(id string)

Excludes a PredicateFactory from the list of chosen factories

func (PredicateFactoryRepo) GetAll

func (repo PredicateFactoryRepo) GetAll() []PredicateFactory

Return a list of all predicates

func (PredicateFactoryRepo) GetAllIDs

func (repo PredicateFactoryRepo) GetAllIDs() []string

Return a list of all predicate IDs

func (PredicateFactoryRepo) GetByID

func (repo PredicateFactoryRepo) GetByID(id string) *PredicateFactory

Returns a PredicateFactory by ID

func (PredicateFactoryRepo) GetChosen

func (repo PredicateFactoryRepo) GetChosen() []PredicateFactory

Return a list of the chosen predicates

func (*PredicateFactoryRepo) Include

func (repo *PredicateFactoryRepo) Include(id string) error

Include the Predicate Factory of the given name

func (*PredicateFactoryRepo) SetAll

func (repo *PredicateFactoryRepo) SetAll()

Sets the chosen predicates to all available predicates

func (*PredicateFactoryRepo) SetDefault

func (repo *PredicateFactoryRepo) SetDefault()

Sets the chosen predicates to the default predicates (all)

type Statistics

type Statistics struct {
	RandomJumps int64
	GoBack      int64
	Stay        int64
}

type StrEqualityPredicateFactory

type StrEqualityPredicateFactory struct {
}

func (StrEqualityPredicateFactory) Generate

func (e StrEqualityPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (StrEqualityPredicateFactory) ID

func (StrEqualityPredicateFactory) IsApplicable

func (factory StrEqualityPredicateFactory) IsApplicable(path dataset.DataPath) bool

func (StrEqualityPredicateFactory) Type

type StrPrefixPredicateFactory

type StrPrefixPredicateFactory struct {
}

String Prefix

func (StrPrefixPredicateFactory) Generate

func (e StrPrefixPredicateFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Predicate

Generates the predicate

func (StrPrefixPredicateFactory) ID

func (StrPrefixPredicateFactory) IsApplicable

func (factory StrPrefixPredicateFactory) IsApplicable(path dataset.DataPath) bool

func (StrPrefixPredicateFactory) Type

type SumAggregationFactory

type SumAggregationFactory struct {
}

func (SumAggregationFactory) Generate

func (e SumAggregationFactory) Generate(p dataset.DataPath, blacklist *Blacklist, ranGen *rand.Rand) query.Aggregation

Generates the aggregation

func (SumAggregationFactory) ID

func (SumAggregationFactory) IsApplicable

func (e SumAggregationFactory) IsApplicable(p dataset.DataPath) bool

Checks wether the aggregation can be used on the given dataset

func (SumAggregationFactory) Type

Jump to

Keyboard shortcuts

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