Skip to content

Commit f3cc98d

Browse files
committed
Merge branch 'split-find-render'
2 parents a0b8eb5 + adfe707 commit f3cc98d

File tree

20 files changed

+603
-564
lines changed

20 files changed

+603
-564
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
NAME:=graphite-clickhouse
22
MAINTAINER:="Roman Lomonosov <[email protected]>"
33
DESCRIPTION:="Graphite cluster backend with ClickHouse support"
4+
MODULE:=github.com/lomik/graphite-clickhouse
45

56
GO ?= go
67
export GOPATH := $(CURDIR)/_vendor
@@ -14,7 +15,17 @@ submodules:
1415
git submodule update --recursive
1516

1617
$(NAME):
17-
$(GO) build github.com/lomik/$(NAME)
18+
$(GO) build $(MODULE)
19+
20+
test:
21+
$(GO) test $(MODULE)/helper/clickhouse
22+
$(GO) test $(MODULE)/helper/log
23+
$(GO) test $(MODULE)/helper/pickle
24+
$(GO) test $(MODULE)/helper/point
25+
$(GO) test $(MODULE)/helper/rollup
26+
$(GO) test $(MODULE)/config
27+
$(GO) test $(MODULE)/find
28+
$(GO) test $(MODULE)/render
1829

1930
gox-build:
2031
rm -rf out

backend/find_test.go

Lines changed: 0 additions & 104 deletions
This file was deleted.

backend/rollup_test.go

Lines changed: 0 additions & 158 deletions
This file was deleted.
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package backend
1+
package config
22

33
import (
44
"bytes"
@@ -8,9 +8,9 @@ import (
88

99
"github.com/BurntSushi/toml"
1010
"github.com/uber-go/zap"
11-
)
1211

13-
const MetricEndpointLocal = "local"
12+
"github.com/lomik/graphite-clickhouse/helper/rollup"
13+
)
1414

1515
// Duration wrapper time.Duration for TOML
1616
type Duration struct {
@@ -36,7 +36,7 @@ func (d *Duration) Value() time.Duration {
3636
return d.Duration
3737
}
3838

39-
type commonConfig struct {
39+
type Common struct {
4040
Listen string `toml:"listen"`
4141
LogFile string `toml:"logfile"`
4242
LogLevel zap.Level `toml:"loglevel"`
@@ -46,7 +46,7 @@ type commonConfig struct {
4646
MaxCPU int `toml:"max-cpu"`
4747
}
4848

49-
type clickhouseConfig struct {
49+
type ClickHouse struct {
5050
Url string `toml:"url"`
5151
DataTable string `toml:"data-table"`
5252
DataTimeout *Duration `toml:"data-timeout"`
@@ -58,15 +58,15 @@ type clickhouseConfig struct {
5858

5959
// Config ...
6060
type Config struct {
61-
Common commonConfig `toml:"common"`
62-
ClickHouse clickhouseConfig `toml:"clickhouse"`
63-
Rollup *Rollup `toml:"-"`
61+
Common Common `toml:"common"`
62+
ClickHouse ClickHouse `toml:"clickhouse"`
63+
Rollup *rollup.Rollup `toml:"-"`
6464
}
6565

6666
// NewConfig ...
67-
func NewConfig() *Config {
67+
func New() *Config {
6868
cfg := &Config{
69-
Common: commonConfig{
69+
Common: Common{
7070
Listen: ":9090",
7171
LogFile: "/var/log/graphite-clickhouse/graphite-clickhouse.log",
7272
LogLevel: zap.InfoLevel,
@@ -77,7 +77,7 @@ func NewConfig() *Config {
7777
// MetricEndpoint: MetricEndpointLocal,
7878
MaxCPU: 1,
7979
},
80-
ClickHouse: clickhouseConfig{
80+
ClickHouse: ClickHouse{
8181
Url: "http://localhost:8123",
8282

8383
DataTable: "graphite",
@@ -96,7 +96,7 @@ func NewConfig() *Config {
9696
}
9797

9898
// PrintConfig ...
99-
func PrintConfig(cfg interface{}) error {
99+
func Print(cfg interface{}) error {
100100
buf := new(bytes.Buffer)
101101

102102
encoder := toml.NewEncoder(buf)
@@ -110,8 +110,8 @@ func PrintConfig(cfg interface{}) error {
110110
return nil
111111
}
112112

113-
// ParseConfig ...
114-
func ParseConfig(filename string, cfg *Config) error {
113+
// Parse ...
114+
func Parse(filename string, cfg *Config) error {
115115
if filename != "" {
116116
if _, err := toml.DecodeFile(filename, cfg); err != nil {
117117
return err
@@ -123,7 +123,7 @@ func ParseConfig(filename string, cfg *Config) error {
123123
return err
124124
}
125125

126-
r, err := ParseRollupXML(rollupConfBody)
126+
r, err := rollup.ParseXML(rollupConfBody)
127127
if err != nil {
128128
return err
129129
}

0 commit comments

Comments
 (0)