cluster

package
v0.0.0-...-0fbe54b Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2014 License: BSD-3-Clause Imports: 18 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Attempts = attempt.Strategy{
	Min:   5,
	Total: 5 * time.Second,
	Delay: 200 * time.Millisecond,
}

Attempts is the attempt strategy that is used to connect to the leader. It must not be modified after the first call to NewClient.

View Source
var ErrNoServers = errors.New("cluster: no servers found")

ErrNoServers is returned if no host servers are found

View Source
var ErrWouldWait = errors.New("cluster: attach would wait")

Functions

func RandomJobID

func RandomJobID(prefix string) string

Types

type Client

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

func NewClient

func NewClient() (*Client, error)

func NewClientWithDial

func NewClientWithDial(dial rpcplus.DialFunc, services ServiceSetFunc) (*Client, error)

func NewClientWithSelf

func NewClientWithSelf(id string, self LocalClient) (*Client, error)

func (*Client) AddJobs

func (c *Client) AddJobs(req *host.AddJobsReq) (*host.AddJobsRes, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialHost

func (c *Client) DialHost(id string) (Host, error)

func (*Client) LeaderID

func (c *Client) LeaderID() string

func (*Client) ListHosts

func (c *Client) ListHosts() (map[string]host.Host, error)

func (*Client) NewLeaderSignal

func (c *Client) NewLeaderSignal() <-chan struct{}

NewLeaderSignal returns a channel that strobes exactly once when a new leader connection has been established successfully. It is an error to attempt to receive more than one value from the channel.

func (*Client) RPCClient

func (c *Client) RPCClient() (RPCClient, error)

func (*Client) RegisterHost

func (c *Client) RegisterHost(host *host.Host, jobs chan *host.Job) *error

Register is used by flynn-host to register itself with the leader and get a stream of new jobs. It is not used by clients.

func (*Client) RemoveJobs

func (c *Client) RemoveJobs(jobIDs []string) error

RemoveJobs is used by flynn-host to delete jobs from the cluster state. It does not actually kill jobs running on hosts, and must not be used by clients.

func (*Client) StreamHostEvents

func (c *Client) StreamHostEvents(ch chan<- *host.HostEvent) Stream

type Host

type Host interface {
	ListJobs() (map[string]host.ActiveJob, error)
	GetJob(id string) (*host.ActiveJob, error)
	StopJob(id string) error
	StreamEvents(id string, ch chan<- *host.Event) Stream
	Attach(req *host.AttachReq, wait bool) (ReadWriteCloser, func() error, error)
	Close() error
}

type LocalClient

type LocalClient interface {
	ListHosts() (map[string]host.Host, error)
	AddJobs(*host.AddJobsReq) (*host.AddJobsRes, error)
	RegisterHost(*host.Host, chan *host.Job) *error
	RemoveJobs([]string) error
}

type RPCClient

type RPCClient interface {
	Call(serviceMethod string, args interface{}, reply interface{}) error
	Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpcplus.Call) *rpcplus.Call
	StreamGo(serviceMethod string, args interface{}, replyStream interface{}) *rpcplus.Call
	Close() error
}

type ReadWriteCloser

type ReadWriteCloser interface {
	io.ReadWriteCloser
	CloseWrite() error
}

type ServiceSetFunc

type ServiceSetFunc func(name string) (discoverd.ServiceSet, error)

type Stream

type Stream interface {
	Close() error
	Err() error
}

Jump to

Keyboard shortcuts

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