Documentation ¶
Index ¶
- Variables
- func ParseConfig(configFile string) error
- func RedisMakeKey(elements ...string) string
- func RedisPool() *redis.Pool
- func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request, errors chan<- error)
- func SetRedisConfig(config RedisConfig)
- func SetWebSocketConfig(config WebsocketConfig)
- type Client
- type DebounceConfig
- type GenericData
- type GenericDataLoader
- type GenericDataLoaderRedis
- type HttpConfig
- type HttpsConfig
- type Hub
- type Message
- type Milestone
- type MilestoneCollection
- type MilestoneConfig
- type MilestoneValuer
- type Period
- type ProportionData
- type ProportionDataLoader
- type ProportionDataLoaderRedis
- type RedisConfig
- type RedisDataLoader
- type RedisDataPointLoader
- type RedisKeyMaker
- type RedisUpdateListener
- type RollingData
- type RollingDataLoader
- type RollingDataLoaderRedis
- type SingleValueData
- type SingleValueDataLoader
- type SingleValueDataLoaderRedis
- type Source
- func (s *Source) IncrementMilestonesCounter()
- func (s *Source) IncrementUpdatesCounter()
- func (s *Source) PopMilestonesCounter() (poppedCount int)
- func (s *Source) PopUpdatesCounter() (poppedCount int)
- func (s *Source) Publish(hub *Hub, errors chan<- error) error
- func (s *Source) RefreshAll(errors chan<- error)
- func (s *Source) SendInitialDataTo(client *Client) error
- type SourceConfig
- type Stat
- func (s *Stat) ListenForUpdates(min time.Duration, max time.Duration, errors chan<- error) error
- func (s *Stat) Load() (err error)
- func (s *Stat) MarshalJSON() ([]byte, error)
- func (s *Stat) NotifyListeners()
- func (s *Stat) Refresh() error
- func (s *Stat) RefreshData() error
- func (s *Stat) RefreshDataPoints() error
- func (s *Stat) RegisterListener(listener chan<- bool)
- func (s *Stat) Reload() error
- func (s *Stat) Reset()
- func (s *Stat) String() string
- type StatConfig
- type StatData
- type StatDataLoader
- type StatDataPointLoader
- type StatGroupConfig
- type StatUpdateListener
- type TimedData
- type TimedDataLoader
- type TimedDataLoaderRedis
- type TimedDataPointLoaderRedis
- type WebsocketConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Config tomlConfig
Functions ¶
func ParseConfig ¶
func RedisMakeKey ¶
func SetRedisConfig ¶
func SetRedisConfig(config RedisConfig)
func SetWebSocketConfig ¶
func SetWebSocketConfig(config WebsocketConfig)
Types ¶
type DebounceConfig ¶
type GenericData ¶
func (*GenericData) MarshalJSON ¶
func (gd *GenericData) MarshalJSON() ([]byte, error)
func (*GenericData) MilestoneValue ¶
func (gd *GenericData) MilestoneValue(field string) float64
func (*GenericData) Refresh ¶
func (gd *GenericData) Refresh() error
func (*GenericData) String ¶
func (gd *GenericData) String() string
type GenericDataLoader ¶
type GenericDataLoader interface { StatDataLoader FetchData() (map[string]int, error) }
type GenericDataLoaderRedis ¶
type GenericDataLoaderRedis struct {
RedisKeyMaker
}
type HttpConfig ¶
type HttpConfig struct {
Address string
}
type HttpsConfig ¶
type Hub ¶
type Hub struct { Broadcast chan []byte // contains filtered or unexported fields }
Hub: as per Gorilla chat example
func (*Hub) ClientCount ¶
type Message ¶
type Message struct { Event string `json:"event"` Payload interface{} `json:"payload"` }
type Milestone ¶
type Milestone struct { sync.Mutex `json:"-"` Name string `json:"name"` DataPoints []string `json:"dataPointNames"` Field string `json:"field"` Target float64 `json:"target"` Comparator string `json:"comparator"` Message string `json:"message"` Achieved bool `json:"-"` AchievedWhen time.Time `json:"achievedWhen"` }
type MilestoneCollection ¶
func (*MilestoneCollection) Publish ¶
func (mc *MilestoneCollection) Publish(achieved chan<- *Milestone)
type MilestoneConfig ¶
type MilestoneValuer ¶
type ProportionData ¶
func (*ProportionData) MarshalJSON ¶
func (pd *ProportionData) MarshalJSON() ([]byte, error)
func (*ProportionData) MilestoneValue ¶
func (pd *ProportionData) MilestoneValue(field string) float64
func (*ProportionData) Percentage ¶
func (pd *ProportionData) Percentage() float64
func (*ProportionData) Proportion ¶
func (pd *ProportionData) Proportion() float64
func (*ProportionData) Refresh ¶
func (pd *ProportionData) Refresh() error
func (*ProportionData) String ¶
func (pd *ProportionData) String() string
type ProportionDataLoader ¶
type ProportionDataLoader interface { StatDataLoader FetchData() ([]int, error) }
type ProportionDataLoaderRedis ¶
type ProportionDataLoaderRedis struct {
RedisKeyMaker
}
func (*ProportionDataLoaderRedis) FetchData ¶
func (pdl *ProportionDataLoaderRedis) FetchData() ([]int, error)
func (*ProportionDataLoaderRedis) Load ¶
func (pdl *ProportionDataLoaderRedis) Load(*Stat) (StatData, error)
func (*ProportionDataLoaderRedis) String ¶
func (pdl *ProportionDataLoaderRedis) String() string
type RedisConfig ¶
type RedisDataLoader ¶
type RedisDataLoader interface { StatDataLoader SetRedisPrefix(string) }
type RedisDataPointLoader ¶
type RedisDataPointLoader struct {
RedisKeyMaker
}
func (*RedisDataPointLoader) DataPointNames ¶
func (rdpl *RedisDataPointLoader) DataPointNames() ([]string, error)
func (*RedisDataPointLoader) NewDataLoader ¶
func (rdpl *RedisDataPointLoader) NewDataLoader(sdl StatDataLoader, dpName string) StatDataLoader
func (*RedisDataPointLoader) NewDataPointLoader ¶
func (rdpl *RedisDataPointLoader) NewDataPointLoader(dpName string) StatDataPointLoader
type RedisKeyMaker ¶
type RedisKeyMaker struct {
RedisPrefix string
}
func (*RedisKeyMaker) MakeKey ¶
func (rkb *RedisKeyMaker) MakeKey(suffices ...string) string
func (*RedisKeyMaker) SetRedisPrefix ¶
func (rkb *RedisKeyMaker) SetRedisPrefix(newPrefix string)
func (*RedisKeyMaker) String ¶
func (rkb *RedisKeyMaker) String() string
type RedisUpdateListener ¶
type RedisUpdateListener struct {
RedisKeyMaker
}
func (*RedisUpdateListener) Subscribe ¶
func (rul *RedisUpdateListener) Subscribe(updated chan<- bool)
type RollingData ¶
type RollingData struct { ProportionData Peak int // contains filtered or unexported fields }
func (*RollingData) MarshalJSON ¶
func (rd *RollingData) MarshalJSON() ([]byte, error)
func (*RollingData) MilestoneValue ¶
func (rd *RollingData) MilestoneValue(field string) float64
func (*RollingData) PeakPercentage ¶
func (rd *RollingData) PeakPercentage() float64
func (*RollingData) PeakProportion ¶
func (rd *RollingData) PeakProportion() float64
func (*RollingData) Refresh ¶
func (rd *RollingData) Refresh() error
func (*RollingData) String ¶
func (rd *RollingData) String() string
type RollingDataLoader ¶
type RollingDataLoader interface { StatDataLoader FetchData() ([]int, error) }
type RollingDataLoaderRedis ¶
type RollingDataLoaderRedis struct {
RedisKeyMaker
}
func (*RollingDataLoaderRedis) FetchData ¶
func (rdl *RollingDataLoaderRedis) FetchData() ([]int, error)
func (*RollingDataLoaderRedis) Load ¶
func (rdl *RollingDataLoaderRedis) Load(*Stat) (StatData, error)
func (*RollingDataLoaderRedis) String ¶
func (rdl *RollingDataLoaderRedis) String() string
type SingleValueData ¶
func (*SingleValueData) MarshalJSON ¶
func (svd *SingleValueData) MarshalJSON() ([]byte, error)
func (*SingleValueData) MilestoneValue ¶
func (svd *SingleValueData) MilestoneValue(string) float64
func (*SingleValueData) Refresh ¶
func (svd *SingleValueData) Refresh() error
func (*SingleValueData) String ¶
func (svd *SingleValueData) String() string
type SingleValueDataLoader ¶
type SingleValueDataLoader interface { StatDataLoader FetchData() (int, error) }
type SingleValueDataLoaderRedis ¶
type SingleValueDataLoaderRedis struct {
RedisKeyMaker
}
func (*SingleValueDataLoaderRedis) FetchData ¶
func (svdl *SingleValueDataLoaderRedis) FetchData() (int, error)
type Source ¶
type Source struct { Name string IsLive bool Available map[string][]string Stats map[string]map[string]*Stat Milestones []*MilestoneCollection // contains filtered or unexported fields }
func MakeSourcesFromConfig ¶
func MakeSourcesFromConfig(config tomlConfig) (sources []*Source)
func (*Source) IncrementMilestonesCounter ¶
func (s *Source) IncrementMilestonesCounter()
func (*Source) IncrementUpdatesCounter ¶
func (s *Source) IncrementUpdatesCounter()
func (*Source) PopMilestonesCounter ¶
func (*Source) PopUpdatesCounter ¶
func (*Source) RefreshAll ¶
func (*Source) SendInitialDataTo ¶
type SourceConfig ¶
type SourceConfig struct { Name string RedisPrefix string StartTime time.Time EndTime time.Time IsLive bool TimedStatPeriods []Period Stats StatGroupConfig Milestones []MilestoneConfig }
type Stat ¶
type Stat struct { sync.Mutex Name string Depth int DataLoader StatDataLoader DataPointLoader StatDataPointLoader UpdateListener StatUpdateListener // contains filtered or unexported fields }
func MakeStatFromConfig ¶
func MakeStatFromConfig(sourceConfig SourceConfig, statConfig StatConfig) *Stat
func (*Stat) ListenForUpdates ¶
func (*Stat) MarshalJSON ¶
func (*Stat) NotifyListeners ¶
func (s *Stat) NotifyListeners()
func (*Stat) RefreshData ¶
func (*Stat) RefreshDataPoints ¶
func (*Stat) RegisterListener ¶
type StatConfig ¶
type StatDataPointLoader ¶
type StatDataPointLoader interface { DataPointNames() ([]string, error) NewDataLoader(StatDataLoader, string) StatDataLoader NewDataPointLoader(string) StatDataPointLoader }
type StatGroupConfig ¶
type StatGroupConfig struct { Proportion []StatConfig Rolling []StatConfig Timed []StatConfig Other []StatConfig }
type StatUpdateListener ¶
type StatUpdateListener interface {
Subscribe(chan<- bool)
}
type TimedData ¶
type TimedData struct { StartTime time.Time EndTime time.Time Period *Period // contains filtered or unexported fields }
func (*TimedData) MarshalJSON ¶
type TimedDataLoader ¶
type TimedDataLoader interface { StatDataLoader FetchBucket(int64) (int, error) }
type TimedDataLoaderRedis ¶
type TimedDataLoaderRedis struct { RedisKeyMaker StartTime time.Time EndTime time.Time Periods []Period }
func (*TimedDataLoaderRedis) FetchBucket ¶
func (tdl *TimedDataLoaderRedis) FetchBucket(bucket int64) (int, error)
type TimedDataPointLoaderRedis ¶
type TimedDataPointLoaderRedis struct { RedisKeyMaker Periods []Period }
func (*TimedDataPointLoaderRedis) DataPointNames ¶
func (tdplr *TimedDataPointLoaderRedis) DataPointNames() (dpNames []string, err error)
func (*TimedDataPointLoaderRedis) NewDataLoader ¶
func (tdplr *TimedDataPointLoaderRedis) NewDataLoader(sdl StatDataLoader, dpName string) StatDataLoader
func (*TimedDataPointLoaderRedis) NewDataPointLoader ¶
func (tdplr *TimedDataPointLoaderRedis) NewDataPointLoader(dpName string) StatDataPointLoader
type WebsocketConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.