cache

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCarbonlinkRequest

func ReadCarbonlinkRequest(reader io.Reader) ([]byte, error)

ReadCarbonlinkRequest from socket/buffer

Types

type Cache

type Cache struct {
	helper.Stoppable
	// contains filtered or unexported fields
}

Cache stores and aggregate metrics in memory

func New

func New() *Cache

New create Cache instance and run in/out goroutine

func (*Cache) Add

func (c *Cache) Add(p *points.Points)

Add points to cache

func (*Cache) Confirm added in v0.7.1

func (c *Cache) Confirm() chan *points.Points

Confirm returns confirmation channel for persister

func (*Cache) Get

func (c *Cache) Get() *points.Points

Get any key/values pair from Cache

func (*Cache) In

func (c *Cache) In() chan *points.Points

In returns input channel

func (*Cache) Out

func (c *Cache) Out() chan *points.Points

Out returns output channel

func (*Cache) Pop

func (c *Cache) Pop() *points.Points

Pop return and remove next for save point from cache

func (*Cache) Query

func (c *Cache) Query() chan *Query

Query returns carbonlink query channel

func (*Cache) Remove

func (c *Cache) Remove(key string)

Remove key from cache

func (*Cache) SetGraphPrefix

func (c *Cache) SetGraphPrefix(prefix string)

SetGraphPrefix for internal cache metrics

func (*Cache) SetInputCapacity

func (c *Cache) SetInputCapacity(size int)

SetInputCapacity set buffer size of input channel. Call before In() getter

func (*Cache) SetMaxSize

func (c *Cache) SetMaxSize(maxSize int)

SetMaxSize of cache

func (*Cache) SetMetricInterval added in v0.7.1

func (c *Cache) SetMetricInterval(interval time.Duration)

SetMetricInterval sets doChekpoint interval

func (*Cache) SetOutputChanSize

func (c *Cache) SetOutputChanSize(size int)

SetOutputChanSize ...

func (*Cache) Size

func (c *Cache) Size() int

Size returns size

func (*Cache) Start

func (c *Cache) Start() error

Start worker

type CarbonlinkListener

type CarbonlinkListener struct {
	helper.Stoppable
	// contains filtered or unexported fields
}

CarbonlinkListener receive cache Carbonlinkrequests from graphite-web

func NewCarbonlinkListener

func NewCarbonlinkListener(queryChan chan *Query) *CarbonlinkListener

NewCarbonlinkListener create new instance of CarbonlinkListener

func (*CarbonlinkListener) Addr added in v0.5.1

func (listener *CarbonlinkListener) Addr() net.Addr

Addr returns binded socket address. For bind port 0 in tests

func (*CarbonlinkListener) Listen

func (listener *CarbonlinkListener) Listen(addr *net.TCPAddr) error

Listen bind port. Receive messages and send to out channel

func (*CarbonlinkListener) SetQueryTimeout

func (listener *CarbonlinkListener) SetQueryTimeout(timeout time.Duration)

SetQueryTimeout for queries to cache

func (*CarbonlinkListener) SetReadTimeout

func (listener *CarbonlinkListener) SetReadTimeout(timeout time.Duration)

SetReadTimeout for read request from client

type CarbonlinkRequest

type CarbonlinkRequest struct {
	Type   string
	Metric string
	Key    string
	Value  string
}

CarbonlinkRequest ...

func NewCarbonlinkRequest

func NewCarbonlinkRequest() *CarbonlinkRequest

NewCarbonlinkRequest creates instance of CarbonlinkRequest

func ParseCarbonlinkRequest

func ParseCarbonlinkRequest(data []byte) (*CarbonlinkRequest, error)

ParseCarbonlinkRequest from pickle encoded data

type Query

type Query struct {
	Metric       string
	Wait         chan bool        // close after finish collect reply
	CacheData    *points.Points   // from cache
	InFlightData []*points.Points // from confirm tracker
}

Query request from carbonlink

func NewQuery

func NewQuery(metric string) *Query

NewQuery create Query instance

Jump to

Keyboard shortcuts

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