cache

package
v0.14.1-0...-915d78e Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 17 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

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

func (*Cache) DivertToXlog

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

func (*Cache) Dump

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

func (*Cache) DumpBinary

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

func (*Cache) Get

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

func (*Cache) GetShard

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

GetShard returns shard under given key

func (*Cache) Len

func (c *Cache) Len() int32

func (*Cache) NotConfirmedLength

func (c *Cache) NotConfirmedLength() int32

func (*Cache) Pop

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

Pop removes an element from the map and returns it

func (*Cache) PopNotConfirmed

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) SetTagsEnabled

func (c *Cache) SetTagsEnabled(value bool)

func (*Cache) SetWriteStrategy

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

SetWriteStrategy ...

func (*Cache) Size

func (c *Cache) Size() int32

func (*Cache) Stat

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

Collect cache metrics

func (*Cache) Stop

func (c *Cache) Stop()

func (*Cache) WriteoutQueue

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

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

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

func (*CarbonlinkListener) HandleConnection

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

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

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

type WriteoutQueue

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

func NewWriteoutQueue

func NewWriteoutQueue(cache *Cache) *WriteoutQueue

func (*WriteoutQueue) Get

func (q *WriteoutQueue) Get(abort chan bool) string

Jump to

Keyboard shortcuts

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