state

package
v0.0.0-...-7e4321c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEvent = errors.New("no such event")
	ErrNoTask  = errors.New("no such task")
)

Functions

This section is empty.

Types

type ConsulEventStore

type ConsulEventStore struct {
	*ConsulStore
}

func (*ConsulEventStore) Delete

func (c *ConsulEventStore) Delete(id string) error

func (*ConsulEventStore) Get

func (c *ConsulEventStore) Get(id string) (*Event, error)

func (*ConsulEventStore) List

func (c *ConsulEventStore) List() ([]*Event, error)

func (*ConsulEventStore) Update

func (c *ConsulEventStore) Update(e *Event) error

type ConsulStore

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

func NewConsulStore

func NewConsulStore(root string, client *api.Client) *ConsulStore

func (*ConsulStore) Events

func (c *ConsulStore) Events() EventStorer

func (*ConsulStore) Tasks

func (c *ConsulStore) Tasks() TaskStorer

type ConsulTaskStore

type ConsulTaskStore struct {
	*ConsulStore
}

func (*ConsulTaskStore) Delete

func (c *ConsulTaskStore) Delete(id string) error

func (*ConsulTaskStore) Get

func (c *ConsulTaskStore) Get(id string) (*Task, error)

func (*ConsulTaskStore) GetBySubscription

func (c *ConsulTaskStore) GetBySubscription(sub string) ([]*Task, error)

func (*ConsulTaskStore) List

func (c *ConsulTaskStore) List() ([]*Task, error)

func (*ConsulTaskStore) Update

func (c *ConsulTaskStore) Update(e *Task) error

type Event

type Event struct {
	ID       string            `json:"id"`
	Resolved bool              `json:"resolved"`
	Type     string            `json:"type"`
	Payload  []byte            `json:"payload"`
	Meta     map[string]string `json:"meta"`
}

type EventStorer

type EventStorer interface {
	List() ([]*Event, error)
	Get(string) (*Event, error)
	Update(*Event) error
	Delete(string) error
}

type IOPair

type IOPair struct {
	Task       *Task
	Event      *Event
	InProgress bool
}

type Storer

type Storer interface {
	Tasks() TaskStorer
	Events() EventStorer
}

type Task

type Task struct {
	ID           string            `json:"id"`
	SubscribesTo []string          `json:"subscribesTo"`
	Image        string            `json:"image"`
	Env          map[string]string `json:"env"`
	CPU          float64           `json:"cpu"`
	Mem          float64           `json:"mem"`
}

type TaskStorer

type TaskStorer interface {
	List() ([]*Task, error)
	Get(string) (*Task, error)
	GetBySubscription(string) ([]*Task, error)
	Update(*Task) error
	Delete(string) error
}

Jump to

Keyboard shortcuts

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