cluster

package
v0.0.0-...-6e7a5f8 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package cluster implements a gossip-based cluster based on HashiCorp memberlist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ClusterHost   string
	ClusterPort   int
	AdvertiseHost string // optional; by default, ClusterHost is used
	AdvertisePort int    // optional; by default, ClusterPort is used
	APIHost       string
	APIPort       int
	Type          string
	InitialPeers  []string
	Logger        log.Logger
}

Config for our node in the cluster. All fields are mandatory unless otherwise noted.

type Peer

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

Peer models a node in the cluster.

func NewPeer

func NewPeer(config Config) (*Peer, error)

NewPeer joins the cluster. Don't forget to leave it, at some point.

func (*Peer) Leave

func (p *Peer) Leave(timeout time.Duration) error

Leave the cluster, waiting up to timeout for a confirmation.

func (*Peer) Query

func (p *Peer) Query(f func(peerType string) bool) (apiHostPorts []string)

Query for other peers in the cluster whose type passes the function f. Results are returned as matching API host:port pairs.

Directories

Path Synopsis
Package httpcluster enhances a plain cluster peer with extension.Cluster behavior.
Package httpcluster enhances a plain cluster peer with extension.Cluster behavior.

Jump to

Keyboard shortcuts

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