cache

package
v0.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A "thread" safe map of type string:Anything. To avoid lock bottlenecks this map is dived to several (shardCount) map shards.

func New

func New() *Cache

Creates a new cache instance

func (*Cache) Add

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

Sets the given value under the specified key.

func (*Cache) Confirm added in v0.7.1

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

func (*Cache) DivertToXlog added in v0.9.0

func (c *Cache) DivertToXlog(w io.Writer)

func (*Cache) Dump added in v0.8.0

func (c *Cache) Dump(w io.Writer) error

func (*Cache) Get

func (c *Cache) Get(key string) []points.Point

func (*Cache) GetShard added in v0.9.0

func (c *Cache) GetShard(key string) *Shard

Returns shard under given key

func (*Cache) Len added in v0.9.0

func (c *Cache) Len() int32

func (*Cache) Pop

func (c *Cache) Pop(key string) (p *points.Points, exists bool)

Removes an element from the map and returns it

func (*Cache) PopNotConfirmed added in v0.9.0

func (c *Cache) PopNotConfirmed(key string) (p *points.Points, exists bool)

func (*Cache) SetMaxSize

func (c *Cache) SetMaxSize(maxSize uint32)

SetMaxSize of cache

func (*Cache) SetWriteStrategy added in v0.7.3

func (c *Cache) SetWriteStrategy(s string) (err error)

SetWriteStrategy ...

func (*Cache) Size

func (c *Cache) Size() int32

func (*Cache) Stat added in v0.8.0

func (c *Cache) Stat(send helper.StatCallback)

Collect cache metrics

func (*Cache) Stop

func (c *Cache) Stop()

func (*Cache) WriteoutQueue added in v0.9.0

func (c *Cache) WriteoutQueue() *WriteoutQueue

type CarbonlinkListener

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

CarbonlinkListener receive cache Carbonlinkrequests from graphite-web

func NewCarbonlinkListener

func NewCarbonlinkListener(cache *Cache) *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) HandleConnection added in v0.8.0

func (listener *CarbonlinkListener) HandleConnection(conn framing.Conn)

func (*CarbonlinkListener) Listen

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

Listen bind port. Receive messages and send to out channel

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(d []byte) (*CarbonlinkRequest, error)

ParseCarbonlinkRequest from pickle encoded data

type Shard added in v0.9.0

type Shard struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

A "thread" safe string to anything map.

type WriteStrategy added in v0.8.0

type WriteStrategy int
const (
	MaximumLength WriteStrategy = iota
	TimestampOrder
	Noop
)

type WriteoutQueue added in v0.9.0

type WriteoutQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewWriteoutQueue added in v0.9.0

func NewWriteoutQueue(cache *Cache) *WriteoutQueue

func (*WriteoutQueue) Get added in v0.9.0

func (q *WriteoutQueue) Get(abort chan bool) *points.Points

func (*WriteoutQueue) GetNotConfirmed added in v0.9.0

func (q *WriteoutQueue) GetNotConfirmed(abort chan bool) *points.Points

Jump to

Keyboard shortcuts

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