-
Notifications
You must be signed in to change notification settings - Fork 0
/
profiles.go
81 lines (62 loc) · 1.37 KB
/
profiles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package profiles
import (
"github.com/gocql/gocql"
"github.com/jsanda/tlp-stress-go/pkg/generators"
)
type PopulationOption interface {}
type Standard struct{
populationOption PopulationOption
}
type Custom struct{
populationOption PopulationOption
Rows uint64
}
type OperationType int16
const (
Mutation = iota
Select
)
type Operation struct {
Query *gocql.Query
OperationType
}
//type Mutation struct {
// Operation
//}
//
//type Select struct {
// Operation
//}
type StressProfile interface {
// gocql automatically prepares queries so we do not need to port this
//Prepare(session *gocql.Session) error
Schema() []string
GetRunner(registry *generators.Registry, session *gocql.Session) StressRunner
GetFieldGenerators() map[generators.Field]generators.FieldGenerator
GetPopulationOption() PopulationOption
}
type StressRunner interface {
GetNextMutation(key *generators.PartitionKey) *Operation
GetNextSelect(key *generators.PartitionKey) *Operation
}
type Plugin struct {
Name string
Instance StressProfile
}
var plugins = map[string]Plugin{
"BasicTimeSeries": {
Name: "BasicTimeSeries",
Instance: NewBasicTimeSeries(),
},
"KeyValue": {
Name: "KeyValue",
Instance: NewKeyValue(),
},
}
func GetPlugins() map[string]Plugin {
return plugins
}
func GetPlugin(name string) (*Plugin, bool) {
plugin, ok := plugins[name]
return &plugin, ok
}