This commit is contained in:
Linh Vo 2017-04-20 21:39:47 -05:00
parent f9792cb9e8
commit 100fcfdc6b
4 changed files with 31 additions and 33 deletions

20
db.go
View file

@ -22,31 +22,31 @@ const (
// DB represents a container for frames.
type DB struct {
mu sync.Mutex
path string
name string
mu sync.Mutex
path string
name string
// Default time quantum for all frames in database.
// This can be overridden by individual frames.
timeQuantum TimeQuantum
timeQuantum TimeQuantum
// Label used for referring to columns in database.
columnLabel string
columnLabel string
// Frames by name.
frames map[string]*Frame
frames map[string]*Frame
// Max Slice on any node in the cluster, according to this node
remoteMaxSlice uint64
remoteMaxInverseSlice uint64
// Profile attribute storage and cache
profileAttrStore *AttrStore
profileAttrStore *AttrStore
broadcaster Broadcaster
Stats StatsClient
broadcaster Broadcaster
Stats StatsClient
LogOutput io.Writer
LogOutput io.Writer
}
// NewDB returns a new instance of DB.

View file

@ -27,29 +27,29 @@ const (
// Frame represents a container for views.
type Frame struct {
mu sync.Mutex
path string
db string
name string
timeQuantum TimeQuantum
mu sync.Mutex
path string
db string
name string
timeQuantum TimeQuantum
views map[string]*View
views map[string]*View
// Bitmap attribute storage and cache
bitmapAttrStore *AttrStore
broadcaster Broadcaster
Stats StatsClient
broadcaster Broadcaster
Stats StatsClient
// Frame settings.
rowLabel string
cacheType string
inverseEnabled bool
rowLabel string
cacheType string
inverseEnabled bool
// Cache size for ranked frames
cacheSize uint32
cacheSize uint32
LogOutput io.Writer
LogOutput io.Writer
}
// NewFrame returns a new instance of frame.

View file

@ -47,14 +47,14 @@ var NopStatsClient StatsClient
// nopStatsClient represents a client that doesn't do anything.
type nopStatsClient struct{}
func (c *nopStatsClient) Tags() []string { return nil }
func (c *nopStatsClient) WithTags(tags ...string) StatsClient { return c }
func (c *nopStatsClient) Count(name string, value int64) {}
func (c *nopStatsClient) Tags() []string { return nil }
func (c *nopStatsClient) WithTags(tags ...string) StatsClient { return c }
func (c *nopStatsClient) Count(name string, value int64) {}
func (c *nopStatsClient) CountWithCustomTags(name string, value int64, tags []string) {}
func (c *nopStatsClient) Gauge(name string, value float64) {}
func (c *nopStatsClient) Histogram(name string, value float64) {}
func (c *nopStatsClient) Set(name string, value string) {}
func (c *nopStatsClient) Timing(name string, value time.Duration) {}
func (c *nopStatsClient) Gauge(name string, value float64) {}
func (c *nopStatsClient) Histogram(name string, value float64) {}
func (c *nopStatsClient) Set(name string, value string) {}
func (c *nopStatsClient) Timing(name string, value time.Duration) {}
// ExpvarStatsClient writes stats out to expvars.
type ExpvarStatsClient struct {
@ -150,14 +150,12 @@ func (a MultiStatsClient) Count(name string, value int64) {
}
}
func (a MultiStatsClient) CountWithCustomTags(name string, value int64, tags []string) {
for _, c := range a {
c.CountWithCustomTags(name, value, tags)
}
}
// Gauge sets the value of a metric on all clients.
func (a MultiStatsClient) Gauge(name string, value float64) {
for _, c := range a {

View file

@ -160,4 +160,4 @@ func (c *MockStats) WithTags(tags ...string) pilosa.StatsClient { return c }
func (c *MockStats) Gauge(name string, value float64) {}
func (c *MockStats) Histogram(name string, value float64) {}
func (c *MockStats) Set(name string, value string) {}
func (c *MockStats) Timing(name string, value time.Duration) {}
func (c *MockStats) Timing(name string, value time.Duration) {}