warpcache

package module
v0.0.0-...-670a074 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

README

warpcache

A Go library to provide sync between some GTS and your application

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSingleGTS = errors.New("FIND on selector doesn't not return a single GTS")

ErrNotSingleGTS is the error thrown when call on FIND doesn't return [1]

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	ReadToken         string
	WriteToken        string
	Endpoint          string
	WebSocketProtol   string
	HTTPProtocol      string
	ForceSyncInterval *time.Duration
	HTTPClient        *http.Client
}

Configuration is holding the configuration for one cache

type MultipleCache

type MultipleCache struct {
	// contains filtered or unexported fields
}

MultipleCache is watching other multiples GTS

func NewMultipleCache

func NewMultipleCache(s Selector, pivot string, c Configuration) (*MultipleCache, error)

NewMultipleCache is creating a new MultipleCache

func (*MultipleCache) Copy

func (c *MultipleCache) Copy() map[string]float64

Copy is returning a copy of the map

func (*MultipleCache) Get

func (c *MultipleCache) Get(label string) float64

Get is returning the latest value for a MultipleCache

func (*MultipleCache) Inc

func (c *MultipleCache) Inc(label string)

Inc is incrementing the value. Cache is updated and a new datapoint is pushed

func (*MultipleCache) Set

func (c *MultipleCache) Set(label string, f float64)

Set is setting a new value. Cache is updated and a new datapoint is pushed

type Selector

type Selector struct {
	Classname string
	Labels    map[string]string
}

Selector is a warp10 selector

func (*Selector) String

func (s *Selector) String() string

String is returning the string version of a Warp10 Selector

type SingleCache

type SingleCache struct {
	// contains filtered or unexported fields
}

SingleCache is a cache for a single GTS. To watch multiple GTS at the same time, please use MultipleCache

func NewSingleCache

func NewSingleCache(s Selector, c Configuration) (*SingleCache, error)

NewSingleCache is creating a new SingleCache

func (*SingleCache) Get

func (c *SingleCache) Get() float64

Get is returning the latest value for a SingleCache

func (*SingleCache) Inc

func (c *SingleCache) Inc()

Inc is incrementing the value. Cache is updated and a new datapoint is pushed

func (*SingleCache) Set

func (c *SingleCache) Set(f float64)

Set is setting a new value. Cache is updated and a new datapoint is pushed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL