gossip

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 18 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemberSet added in v1.0.0

func NewMemberSet(cfg Config, api *pilosa.API, options ...memberSetOption) (*memberSet, error)

NewMemberSet returns a new instance of GossipMemberSet based on options. The logging options which can be passed to NewMemberSet are complicated for historical reasons - please pass WithPilosaLogger, and either WithLogOutput or WithLogger. If you pass WithLogOutput, be sure to also pass in a Transport using WithTransport.

func WithLogOutput added in v1.2.0

func WithLogOutput(o io.Writer) memberSetOption

WithLogOutput allows one to pass a Writer which will in turn be passed to memberlist for use in logging.

func WithLogger added in v0.9.0

func WithLogger(logger *log.Logger) memberSetOption

WithLogger is a functional option for providing a Go logger to NewMemberSet. If the memberSet's transport is nil, this logger will be used when creating one. If WithLogOutput is not used, this logger will be passed to memberlist for it to use internally. This logger is not used for logging by code in this (gossip) package - for that, use the WithPilosaLogger option.

func WithPilosaLogger added in v1.3.0

func WithPilosaLogger(l logger.Logger) memberSetOption

WithPilosaLogger allows one to configure a memberSet with a logger of their choice which satisfies the pilosa logger interface.

func WithTransport added in v0.9.0

func WithTransport(transport *Transport) memberSetOption

WithTransport is a functional option for providing a transport to NewMemberSet.

Types

type Config added in v0.9.0

type Config struct {
	// Port indicates the port to which pilosa should bind for internal state sharing.
	Port string `toml:"port"`

	// AdvertiseHost is the hostname or IP other nodes should use to connect to
	// this host. If left blank, the value for Host will be used. This is useful
	// in some proxy and NAT scenarios.
	AdvertiseHost string `toml:"advertise-host"`
	// AdvertisePort is the port other nodes will use to connect to this one.
	// Behaves like AdvertiseHost.
	AdvertisePort string `toml:"advertise-port"`

	Seeds []string `toml:"seeds"`
	Key   string   `toml:"key"`
	// StreamTimeout is the timeout for establishing a stream connection with
	// a remote node for a full state sync, and for stream read and write
	// operations. Maps to memberlist TCPTimeout.
	StreamTimeout toml.Duration `toml:"stream-timeout"`
	// SuspicionMult is the multiplier for determining the time an
	// inaccessible node is considered suspect before declaring it dead.
	// The actual timeout is calculated using the formula:
	//
	//   SuspicionTimeout = SuspicionMult * log(N+1) * ProbeInterval
	//
	// This allows the timeout to scale properly with expected propagation
	// delay with a larger cluster size. The higher the multiplier, the longer
	// an inaccessible node is considered part of the cluster before declaring
	// it dead, giving that suspect node more time to refute if it is indeed
	// still alive.
	SuspicionMult int `toml:"suspicion-mult"`
	// PushPullInterval is the interval between complete state syncs.
	// Complete state syncs are done with a single node over TCP and are
	// quite expensive relative to standard gossiped messages. Setting this
	// to zero will disable state push/pull syncs completely.
	//
	// Setting this interval lower (more frequent) will increase convergence
	// speeds across larger clusters at the expense of increased bandwidth
	// usage.
	PushPullInterval toml.Duration `toml:"push-pull-interval"`
	// ProbeInterval and ProbeTimeout are used to configure probing behavior
	// for memberlist.
	//
	// ProbeInterval is the interval between random node probes. Setting
	// this lower (more frequent) will cause the memberlist cluster to detect
	// failed nodes more quickly at the expense of increased bandwidth usage.
	//
	// ProbeTimeout is the timeout to wait for an ack from a probed node
	// before assuming it is unhealthy. This should be set to 99-percentile
	// of RTT (round-trip time) on your network.
	ProbeInterval toml.Duration `toml:"probe-interval"`
	ProbeTimeout  toml.Duration `toml:"probe-timeout"`

	// Interval and Nodes are used to configure the gossip
	// behavior of memberlist.
	//
	// Interval is the interval between sending messages that need
	// to be gossiped that haven't been able to piggyback on probing messages.
	// If this is set to zero, non-piggyback gossip is disabled. By lowering
	// this value (more frequent) gossip messages are propagated across
	// the cluster more quickly at the expense of increased bandwidth.
	//
	// Nodes is the number of random nodes to send gossip messages to
	// per Interval. Increasing this number causes the gossip messages
	// to propagate across the cluster more quickly at the expense of
	// increased bandwidth.
	//
	// ToTheDeadTime is the interval after which a node has died that
	// we will still try to gossip to it. This gives it a chance to refute.
	Interval      toml.Duration `toml:"interval"`
	Nodes         int           `toml:"nodes"`
	ToTheDeadTime toml.Duration `toml:"to-the-dead-time"`
}

Config holds toml-friendly memberlist configuration.

type Transport added in v0.9.0

type Transport struct {
	URI *pilosa.URI
	// contains filtered or unexported fields
}

Transport is a gossip transport for binding to a port.

func NewTransport added in v0.9.0

func NewTransport(host string, port int, logger *log.Logger) (*Transport, error)

NewTransport returns a NetTransport based on the given host and port. It will dynamically bind to a port if port is 0. This is useful for test cases where specifying a port is not reasonable. func NewTransport(host string, port int) (*memberlist.NetTransport, error) {

Jump to

Keyboard shortcuts

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