onecache

package
v0.0.0-...-1204f0f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2016 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node holds all the necessary information to store data, handle client connections, forward among the ring and replicate.

func Create

func Create(config *NodeConfig) (*Node, error)

Create creates a new Node instance and initializes all resources necessary to be a member of the hash ring.

func (*Node) Exit

func (n *Node) Exit() error

Exit removes this Node from the ring, kills background tasks and frees any used resources. Once this is called the Node will no longer accept connections and can not be used.

func (*Node) Join

func (n *Node) Join(nodes []string) error

Join adds this Node to an existing set ring. Nodes is a list of ip:port port pairs or DNS addresses.

func (*Node) Start

func (n *Node) Start()

Start starts handling connections from other rings in the cluster as well as clients.

type NodeConfig

type NodeConfig struct {
	// The number of key/value replicas.
	Replicas int

	// The port to accept RPC connections on.
	RpcPort int

	// The space alloted to store key/values in bytes.
	MaxMemoryUsage int64

	// Routes log output to the writer. If nil, output will be sent to stderr.
	LogOutput io.Writer

	// Serf configuration used to fine tune Node discovery, define whether the DHT is running in a LAN or WAN and more.
	// The name does not need to be set as it will be overriden with a UUID.
	SerfConfig *serf.Config
}

NodeConfig is the configuration for a DHT Node instance.

func DefaultNodeConfig

func DefaultNodeConfig() *NodeConfig

DefaultNodeConfig returns a reasonable default to use.

type ReplicaStorageArgs

type ReplicaStorageArgs struct {
	StorageArgs
	ReplicaVersion
}

ReplicaStorageArgs is a versioned key set by a replica peer.

type ReplicaVersion

type ReplicaVersion struct {
	// The peer sending the replica information
	Peer string

	// A version which should only increment
	Version int64
}

ReplicaVersion is used to version replicated data of a key from a peer.

type StorageArgs

type StorageArgs struct {
	Key   string
	Value []byte
	Flags int32
	Exp   int64
	Cas   int64

	// Used for increment and decrement.
	Delta int64

	// Used internally as a means to determine when to forward.
	ExplicitPeer string
}

StorageArgs is the struct used to make data related RPC calls.

Jump to

Keyboard shortcuts

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