model

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCreated = Action(1)
	ActionRemoved = Action(2)
	ActionUpdate  = Action(3)
)
View Source
const (
	TypeCustom = "CUSTOM"
)

Variables

View Source
var DatabaseMetaKey = "_db"
View Source
var DepBucketName = "deps"
View Source
var IsolationBucketName = "isolations"
View Source
var MetaBucketName = "meta"

Functions

This section is empty.

Types

type Action

type Action int

type Build added in v0.2.1

type Build struct {
	ID        string  `json:"id"`
	State     State   `json:"state"`
	Dep       Dep     `json:"dep"`
	Error     error   `json:"error"`
	ImageName string  `json:"image_name"`
	IsRunning bool    `json:"is_running"`
	Output    *Output `json:"output"`
}

func NewBuild added in v0.2.1

func NewBuild(d Dep, s State) (*Build, error)

type Dep

type Dep struct {
	Name   string   `json:"name"`
	States []*State `json:"states"`
}

func NewDep

func NewDep(name string) (*Dep, error)

func NewDepFromSerialized

func NewDepFromSerialized(data []byte) (*Dep, error)

func (*Dep) AddState

func (d *Dep) AddState(s *State)

func (*Dep) GetState

func (d *Dep) GetState(sname string) *State

func (*Dep) Serialize

func (i *Dep) Serialize() ([]byte, error)

func (*Dep) UpdateState added in v0.2.1

func (d *Dep) UpdateState(newstate *State)

type Event

type Event struct {
	Action  Action
	Subject interface{}
}

func NewEvent

func NewEvent(a Action, s interface{}) Event

type Isolation

type Isolation struct {
	ID     string            `json:"id"`
	Name   string            `json:"name"`
	States map[string]string `json:"states"`
}

func NewIsolation

func NewIsolation(name string) (*Isolation, error)

func NewIsolationFromSerialized

func NewIsolationFromSerialized(data []byte) (*Isolation, error)

func (*Isolation) AddDep

func (i *Isolation) AddDep(dep *Dep, state string)

func (*Isolation) HasDep

func (i *Isolation) HasDep(dep *Dep) bool

func (*Isolation) HasDepState

func (i *Isolation) HasDepState(dep *Dep, sname string) bool

func (*Isolation) RemoveDep

func (i *Isolation) RemoveDep(dep *Dep)

func (*Isolation) Serialize

func (i *Isolation) Serialize() ([]byte, error)

type Meta

type Meta struct {
	ID       string            `json:"name"`
	Machines map[string]string `json:"machines"`
}

func NewMeta

func NewMeta() (*Meta, error)

func NewMetaFromSerialized

func NewMetaFromSerialized(data []byte) (*Meta, error)

func (*Meta) Serialize

func (m *Meta) Serialize() ([]byte, error)

type Model

type Model struct {
	DBPath string

	Events chan Event
	// contains filtered or unexported fields
}

func NewModel

func NewModel(dbpath string) (*Model, error)

func (*Model) FindDepByName

func (m *Model) FindDepByName(name string) (*Dep, error)

func (*Model) FindIsolationByID added in v0.1.2

func (m *Model) FindIsolationByID(ID string) (*Isolation, error)

func (*Model) FindIsolationByName

func (m *Model) FindIsolationByName(name string) (*Isolation, error)

func (*Model) GetAllDeps

func (m *Model) GetAllDeps() ([]*Dep, error)

func (*Model) GetAllIsolations

func (m *Model) GetAllIsolations() ([]*Isolation, error)

func (*Model) GetDBMetaData

func (m *Model) GetDBMetaData() (*Meta, error)

func (*Model) GetIsolationDepsAndStates

func (m *Model) GetIsolationDepsAndStates(iso *Isolation) (map[*Dep]*State, error)

func (*Model) InsertDep

func (m *Model) InsertDep(dep *Dep) error

func (*Model) InsertIsolation

func (m *Model) InsertIsolation(iso *Isolation) error

func (*Model) RemoveDep

func (m *Model) RemoveDep(dep *Dep) error

func (*Model) RemoveDepStateByName

func (m *Model) RemoveDepStateByName(dep *Dep, sname string) error

func (*Model) RemoveIsolation

func (m *Model) RemoveIsolation(iso *Isolation) error

func (*Model) UpdateDep

func (m *Model) UpdateDep(dep *Dep) error

func (*Model) UpdateIsolation

func (m *Model) UpdateIsolation(iso *Isolation) error

func (*Model) UpsertMetaData

func (m *Model) UpsertMetaData() error

type Output added in v0.2.1

type Output struct {
	Buffer *bytes.Buffer
}

func NewOutput added in v0.2.1

func NewOutput() *Output

func (*Output) MarshalJSON added in v0.2.1

func (o *Output) MarshalJSON() ([]byte, error)

type State

type State struct {
	Name      string            `json:"name"`
	Type      string            `json:"type"`
	Files     map[string]string `json:"files"`
	ImageName string            `json:"image_name"`
}

func NewState

func NewState(name string, t string) (*State, error)

Jump to

Keyboard shortcuts

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