zkocc

package
v0.0.0-...-d271c08 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2014 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

cache for zkocc

Index

Constants

View Source
const (
	// DISCONNECTED: initial state of the cell.
	// connect will only work in that state, and will go to CONNECTING
	CELL_DISCONNECTED = iota

	// CONNECTING: a 'connect' function started the connection process.
	// It will then go to CONNECTED or BACKOFF. Only one connect
	// function will run at a time.
	// requests will be blocked until the state changes (if it goes to
	// CONNECTED, request will then try to get the value, if it goes to
	// CELL_BACKOFF, they will fail)
	CELL_CONNECTING

	// steady state, when all is good and dandy.
	CELL_CONNECTED

	// BACKOFF: we're waiting for a bit before trying to reconnect.
	// a go routine will go to DISCONNECTED and start login soon.
	// we're failing all requests in this state.
	CELL_BACKOFF
)

Our state. We need this to be independent as we want to decorelate the connection from what clients are asking for. For instance, if a cell is not used often, and gets disconnected, we want to reconnect in the background, independently of the clients. Also we want to support a BACKOFF mode for fast client failure reporting while protecting the server from high rates of connections.

Variables

View Source
var (
	ErrPartialRead = errors.New("zkocc: partial read")
	ErrLocalCell   = errors.New("zkocc: cannot resolve local cell")
)

Functions

This section is empty.

Types

type ZkCache

type ZkCache struct {
	Cache map[string]*zkCacheEntry
	// contains filtered or unexported fields
}

the ZkCache is a map from resolved zk path (where 'local' has been replaced with the cell name) to the entry

type ZkReader

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

ZkReader is the main object receiving RPC calls

func NewZkReader

func NewZkReader(resolveLocal bool, preload []string) *ZkReader

func (*ZkReader) Children

func (zkr *ZkReader) Children(req *zk.ZkPath, reply *zk.ZkNode) (err error)

func (*ZkReader) Get

func (zkr *ZkReader) Get(req *zk.ZkPath, reply *zk.ZkNode) (err error)

func (*ZkReader) GetV

func (zkr *ZkReader) GetV(req *zk.ZkPathV, reply *zk.ZkNodeV) (err error)

Jump to

Keyboard shortcuts

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