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 ¶
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.
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.