cluster

package
v0.0.0-...-88f351d Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT, CC-BY-4.0, MIT, + 1 more Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TTL = 30 * time.Second

	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	GetDir(key string) (map[string]string, error)
	GetValue(key string) (string, error)
	SetValue(key, value string) error
	GetValueWithDefault(key string, setter func() (string, error)) (string, error)

	GetSecret(kms security.KMS, name string, bytes int) ([]byte, error)

	Update(desc *PeerDesc) error
	Part()
	Peers() []PeerDesc
	Watch() <-chan PeerEvent
}

type PeerAliveEvent

type PeerAliveEvent struct {
	PeerDesc
}

type PeerDesc

type PeerDesc struct {
	ID      string `json:"id"`
	Era     string `json:"era"`
	Version string `json:"version"`
}

func (*PeerDesc) Peer

func (p *PeerDesc) Peer() *PeerDesc

type PeerEvent

type PeerEvent interface {
	Peer() *PeerDesc
}

type PeerJoinedEvent

type PeerJoinedEvent struct {
	PeerDesc
}

type PeerList

type PeerList []PeerDesc

func (PeerList) Len

func (ps PeerList) Len() int

func (PeerList) Less

func (ps PeerList) Less(i, j int) bool

func (PeerList) Swap

func (ps PeerList) Swap(i, j int)

type PeerLostEvent

type PeerLostEvent struct {
	PeerDesc
}

type TestCluster

type TestCluster struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TestCluster) GetDir

func (tc *TestCluster) GetDir(key string) (map[string]string, error)

func (*TestCluster) GetSecret

func (tc *TestCluster) GetSecret(kms security.KMS, name string, bytes int) ([]byte, error)

func (*TestCluster) GetValue

func (tc *TestCluster) GetValue(key string) (string, error)

func (*TestCluster) GetValueWithDefault

func (tc *TestCluster) GetValueWithDefault(key string, setter func() (string, error)) (string, error)

func (*TestCluster) Part

func (tc *TestCluster) Part()

func (*TestCluster) Peers

func (tc *TestCluster) Peers() []PeerDesc

func (*TestCluster) SetValue

func (tc *TestCluster) SetValue(key, value string) error

func (*TestCluster) Update

func (tc *TestCluster) Update(desc *PeerDesc) error

func (*TestCluster) Watch

func (tc *TestCluster) Watch() <-chan PeerEvent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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