localcluster

package
v0.0.0-...-d6fed6f Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2015 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventCreate     = "create"
	EventDestroy    = "destroy"
	EventDie        = "die"
	EventExecCreate = "exec_create"
	EventExecStart  = "exec_start"
	EventExport     = "export"
	EventKill       = "kill"
	EventOom        = "oom"
	EventPause      = "pause"
	EventRestart    = "restart"
	EventStart      = "start"
	EventStop       = "stop"
	EventUnpause    = "unpause"
)

The various event types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Nodes    []*Container
	Events   chan Event
	CertsDir string

	LogDir       string
	ForceLogging bool // Forces logging to disk on a per test basis
	// contains filtered or unexported fields
}

Cluster manages a local cockroach cluster running on docker. The cluster is composed of a "dns" container which automatically registers dns entries for the cockroach nodes, a "volumes" container which manages the persistent volumes used for certs and node data and N cockroach nodes.

func Create

func Create(numNodes int, stopper chan struct{}) *Cluster

Create creates a new local cockroach cluster. The stopper is used to gracefully shutdown the channel (e.g. when a signal arrives). The cluster must be started before being used.

func (*Cluster) Start

func (l *Cluster) Start()

Start starts the cluster.

func (*Cluster) Stop

func (l *Cluster) Stop()

Stop stops the clusters. It is safe to stop the cluster multiple times.

type Container

type Container struct {
	ID string
	// contains filtered or unexported fields
}

Container provides the programmatic interface for a single docker container.

func (*Container) Addr

func (c *Container) Addr(name string) *net.TCPAddr

Addr returns the address to connect to the specified port.

func (*Container) GetJSON

func (c *Container) GetJSON(port, path string, v interface{}) error

GetJSON retrieves the URL specified by https://Addr(<port>)<path> and unmarshals the result as JSON.

func (*Container) Inspect

func (c *Container) Inspect() error

Inspect retrieves detailed info about a container.

func (*Container) Kill

func (c *Container) Kill() error

Kill stops a running container and removes it.

func (*Container) Logs

func (c *Container) Logs() error

Logs outputs the containers logs to stdout/stderr.

func (*Container) Pause

func (c *Container) Pause() error

Pause pauses a running container.

func (*Container) Remove

func (c *Container) Remove() error

Remove removes the container from docker. It is an error to remove a running container.

func (*Container) Restart

func (c *Container) Restart(timeoutSeconds int) error

Restart restarts a running container. Container will be killed after 'timeout' seconds if it fails to stop.

func (*Container) Start

func (c *Container) Start(binds []string, dns, vols *Container) error

Start starts a non-running container.

TODO(pmattis): Generalize the setting of parameters here.

func (*Container) Stop

func (c *Container) Stop(timeoutSeconds int) error

Stop a running container.

func (*Container) Unpause

func (c *Container) Unpause() error

Unpause resumes a paused container.

func (*Container) Wait

func (c *Container) Wait() error

Wait waits for a running container to exit.

type Event

type Event struct {
	NodeIndex int
	Status    string
}

Event for a node containing a node index and the type of event.

Jump to

Keyboard shortcuts

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