clusteredBigCache

package
v0.3.2-0...-638bef3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REPLICATION_MODE_FULL_REPLICATE byte = iota
	REPLICATION_MODE_SHARD
)

Constants used to specify various conditions and state within the system

View Source
const CHAN_SIZE = 1024 * 64

CHAN_SIZE for all defined channels

Variables

View Source
var (
	ErrNotEnoughReplica = errors.New("not enough replica")
	ErrNotFound         = errors.New("data not found")
	ErrTimedOut         = errors.New("not found as a result of timing out")
	ErrNotStarted       = errors.New("node not started, call Start()")
)

Global errors that can be returned to callers

Functions

This section is empty.

Types

type ClusteredBigCache

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

ClusteredBigCache definition

func New

New creates a new local node

func NewPassiveClient

func NewPassiveClient(id string, serverEndpoint string, localPort, pingInterval, pingTimeout int, pingFailureThreashold int32, logger utils.AppLogger) *ClusteredBigCache

NewPassiveClient creates a new local node that does not store any data locally

func (*ClusteredBigCache) Delete

func (node *ClusteredBigCache) Delete(key string) error

Delete removes a key from the cluster

func (*ClusteredBigCache) Get

func (node *ClusteredBigCache) Get(key string, timeout time.Duration) ([]byte, error)

Get retrieves data from the cluster

func (*ClusteredBigCache) Put

func (node *ClusteredBigCache) Put(key string, data []byte, duration time.Duration) error

Put adds data into the cluster

func (*ClusteredBigCache) ShutDown

func (node *ClusteredBigCache) ShutDown()

ShutDown shuts this Cluster and all terminate all connections to remoteNodes

func (*ClusteredBigCache) Start

func (node *ClusteredBigCache) Start() error

Start this Cluster running

func (*ClusteredBigCache) Statistics

func (node *ClusteredBigCache) Statistics() string

Statistics returns the cache stats

type ClusteredBigCacheConfig

type ClusteredBigCacheConfig struct {
	Id                      string   `json:"id"`
	Join                    bool     `json:"join"`
	JoinIp                  string   `json:"join_ip"`
	LocalAddresses          []string `json:"local_addresses"`
	LocalPort               int      `json:"local_port"`
	BindAll                 bool     `json:"bind_all"`
	ConnectRetries          int      `json:"connect_retries"`
	TerminateOnListenerExit bool     `json:"terminate_on_listener_exit"`
	ReplicationMode         byte     `json:"replication_mode"`
	ReplicationFactor       int      `json:"replication_factor"`
	WriteAck                bool     `json:"write_ack"`
	DebugMode               bool     `json:"debug_mode"`
	DebugPort               int      `json:"debug_port"`
	ReconnectOnDisconnect   bool     `json:"reconnect_on_disconnect"`
	PingFailureThreshHold   int32    `json:"ping_failure_thresh_hold"`
	PingInterval            int      `json:"ping_interval"`
	PingTimeout             int      `json:"ping_timeout"`
	ShardSize               int      `json:"shard_size"`
}

ClusteredBigCacheConfig is configuration for the cache

func DefaultClusterConfig

func DefaultClusterConfig() *ClusteredBigCacheConfig

DefaultClusterConfig creates a new default configuration

Jump to

Keyboard shortcuts

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