mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2014 License: Apache-2.0, BSD-3-Clause, Zlib Imports: 4 Imported by: 0

Documentation

Overview

Package mock is a mock Backend for Flitter. It should be used as an example of what a fully featured Backend implementation should look like. It is also used in testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

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

Struct Actor represents a single worker running a given image with given tags.

func (*Actor) Image

func (a *Actor) Image() string

Image returns the Actor's image as a string.

func (*Actor) Info

func (a *Actor) Info() *ActorInfo

Info returns the serializable form of the Actor.

func (*Actor) Name

func (a *Actor) Name() string

Name returns the Actor's name as a string.

func (*Actor) Restart

func (a *Actor) Restart() error

Restart calls Stop and then Start and returns an error if either fails, bailing out on the first failure.

func (*Actor) Start

func (a *Actor) Start() error

Start commands the Actor to start, returning an error if the start fails.

func (*Actor) Status

func (a *Actor) Status() deployment.Status

Status returns the Actor's status as a deployment.Status.

func (*Actor) Stop

func (a *Actor) Stop() error

Stop commands the Actor to stop, returning an error if the stop fails.

func (*Actor) String

func (a *Actor) String() string

String returns a representation of the Actor as a simple string.

func (*Actor) Tags

func (a *Actor) Tags() []string

Tags returns the Actor's metadata tags as a string slice.

type ActorInfo

type ActorInfo struct {
	Name   string            `json:"name"`
	Tags   []string          `json:"tags"`
	Image  string            `json:"image"`
	Status deployment.Status `json:"status"`
}

Struct ActorInfo is the serializable form of Actor.

type Backend

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

Struct Backend is a mock backend for scheduling and starting Actors.

func (*Backend) Deploy

func (b *Backend) Deploy(a *Actor) error

Deploy introduces a new Actor to the Backend if the Actor is unique to the Backend.

func (*Backend) Destroy

func (b *Backend) Destroy(a *Actor) error

Destroy destroys the Actor from the list of active Actors and returns an error if the given actor doesn't exist.

func (*Backend) GetActorer

func (b *Backend) GetActorer(pattern string) (*Actor, error)

GetActorer looks for an Actor by name pattern and returns it or an error describing the failure.

func (*Backend) Info

func (b *Backend) Info() (i *BackendInfo)

Info returns the serializable information about a mock Backend.

func (*Backend) ListDeploys

func (b *Backend) ListDeploys(pattern string) (res []*Actor, err error)

ListDeploys returns a list of the Actors in the Backend.

func (*Backend) Restart

func (b *Backend) Restart(a *Actor) error

Restart asks the Actor to restart and returns its output.

func (*Backend) Start

func (b *Backend) Start(a *Actor) error

Start asks the Actor to start and returns its output.

func (*Backend) Stop

func (b *Backend) Stop(a *Actor) error

Stop asks the Actor to stop and returns its output.

type BackendInfo

type BackendInfo struct {
	Name       string `json:"name"`
	ActorCount int    `json:"count"`
}

Struct BackendInfo is the serializable version of a Backend.

Jump to

Keyboard shortcuts

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