server

package
v0.0.0-...-7fd4116 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndPoint

type EndPoint struct {
	Port     uint
	BindAddr string
	// contains filtered or unexported fields
}

func NewEndPoint

func NewEndPoint(dataDir string) (*EndPoint, error)

func (*EndPoint) BatchIndex

func (m *EndPoint) BatchIndex(stream pb.DStash_BatchIndexServer) error

func (*EndPoint) BatchLookup

func (m *EndPoint) BatchLookup(stream pb.DStash_BatchLookupServer) error

func (*EndPoint) BatchPut

func (m *EndPoint) BatchPut(stream pb.DStash_BatchPutServer) error

func (*EndPoint) Items

func (m *EndPoint) Items(e *empty.Empty, stream pb.DStash_ItemsServer) error

func (*EndPoint) Lookup

func (m *EndPoint) Lookup(ctx context.Context, kv *pb.KVPair) (*pb.KVPair, error)

func (*EndPoint) Put

func (m *EndPoint) Put(ctx context.Context, kv *pb.KVPair) (*empty.Empty, error)

Put - Insert a new key

func (*EndPoint) Search

func (m *EndPoint) Search(searchStr *wrappers.StringValue, stream pb.DStash_SearchServer) error

func (*EndPoint) Start

func (m *EndPoint) Start() error

func (*EndPoint) Status

func (m *EndPoint) Status(ctx context.Context, e *empty.Empty) (*pb.StatusMessage, error)

type HealthImpl

type HealthImpl struct{}

func (*HealthImpl) Check

Check implements the health check interface, which directly returns to health status. There are also more complex health check strategies, such as returning based on server load.

type Node

type Node struct {
	Service *EndPoint

	// Shutdown channels
	Stop chan bool
	Err  chan error
	// contains filtered or unexported fields
}

Node is a single node in a distributed hash table, coordinated using services registered in Consul. Key membership is determined using rendezvous hashing to ensure even distribution of keys and minimal key membership changes when a Node fails or otherwise leaves the hash table.

Errors encountered when making blocking GET requests to the Consul agent API are logged using the log package.

func Join

func Join(name string, e *EndPoint) (node *Node, err error)

Join creates a new Node and adds it to the distributed hash table specified by the given name. The given id should be unique among all Nodes in the hash table.

func (*Node) Leave

func (n *Node) Leave() (err error)

Leave removes the Node from the distributed hash table by de-registering it from Consul. Once Leave is called, the Node should be discarded. An error is returned if the Node is unable to successfully deregister itself from Consul. In that case, Consul's health check for the Node will fail and require manual cleanup.

func (*Node) Member

func (n *Node) Member(key string) bool

Member returns true if the given key belongs to this Node in the distributed hash table.

Jump to

Keyboard shortcuts

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