state

package
v0.0.0-...-4cfcb05 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package state stores and retrieves the peer information for coordination. Different backend stores should be supported. Currently only Consul is.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrap

type Bootstrap struct {
	First time.Time
}

Bootstrap stores information about when the cluster was first bootstrap'd

type Config

type Config struct {
	Me     Peer
	Prefix string // the prefix for the remote state
}

Config is the high level settings for running capman

type ConsulConfig

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

ConsulConfig is how to connect to the consul agent

type ExternalState

type ExternalState interface {
	IsBootstrap() (*Bootstrap, error)
	SetBootstrap() (*Bootstrap, error)
	Heartbeat() error
	Peers() (Peers, error)
}

ExternalState is the interface for dealing with the external state store.

func NewConsul

func NewConsul(config Config, consulConfig ConsulConfig) ExternalState

NewConsul creates a new consul impl of ExternalState

type Peer

type Peer struct {
	Host     string
	IP       string
	LastSeen time.Time
}

Peer represents the state of a peer

func (Peer) IsHealthy

func (p Peer) IsHealthy(duration time.Duration) bool

IsHealthy determines if this peer is in a healthy state.

type Peers

type Peers []Peer

Peers is a slice of peers

func (Peers) Healthy

func (ps Peers) Healthy(duration time.Duration) Peers

Healthy returns the list of Healthy Peers

Jump to

Keyboard shortcuts

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