forked from timescale/tsbs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
benchmark.go
41 lines (33 loc) · 932 Bytes
/
benchmark.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
package akumuli
import (
"github.com/benchant/tsbs/load"
"github.com/benchant/tsbs/pkg/targets"
"sync"
)
func NewBenchmark(loadFileName, endpoint string, bufPool *sync.Pool) targets.Benchmark {
return &benchmark{
loadFileName: loadFileName,
endpoint: endpoint,
bufPool: bufPool,
}
}
type benchmark struct {
loadFileName string
endpoint string
bufPool *sync.Pool
}
func (b *benchmark) GetDataSource() targets.DataSource {
return &fileDataSource{reader: load.GetBufferedReader(b.loadFileName)}
}
func (b *benchmark) GetBatchFactory() targets.BatchFactory {
return &factory{bufPool: b.bufPool}
}
func (b *benchmark) GetPointIndexer(n uint) targets.PointIndexer {
return &pointIndexer{nchan: n}
}
func (b *benchmark) GetProcessor() targets.Processor {
return &processor{endpoint: b.endpoint, bufPool: b.bufPool}
}
func (b *benchmark) GetDBCreator() targets.DBCreator {
return &dbCreator{}
}