-
Notifications
You must be signed in to change notification settings - Fork 23
/
dataprovider.go
25 lines (22 loc) · 921 Bytes
/
dataprovider.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
package dataprovider
import (
"RedisFox/conf"
)
type DataProvider interface {
SaveMemoryInfo(server string, used int, peak int) int64
SaveInfoCommand(server string, info map[string]string) int64
SaveMonitorCommand(server, command, argument, keyname, timestamp string) int64
Close() error
GetInfo(serverId string) (map[string]interface{}, error)
GetMemoryInfo(serverId, fromDate, toDate string) ([]map[string]interface{}, error)
GetCommandStats(serverId, fromDate, toDate, groupBy string) ([]map[string]interface{}, error)
GetTopCommandsStats(serverId, fromDate, toDate string) ([]map[string]interface{}, error)
GetTopKeysStats(serverId, fromDate, toDate string) ([]map[string]interface{}, error)
}
func NewProvider(config *conf.Config) (DataProvider,error) {
if config.Datatype == "sqlite" {
return NewSqliteProvide(config.Datapath)
} else {
return NewSqliteProvide(config.Datapath)//默认返回
}
}