Documentation ¶
Index ¶
- Constants
- Variables
- type AutoIncrementer
- type Data
- func (m *Data) AddEnv(s *Env) error
- func (m *Data) AddNode(n *Node) error
- func (m *Data) AddProject(p *Project) error
- func (m *Data) AddVarInProject(d *Var, project string) error
- func (m *Data) BindEnvInProject(s *Env, project string) error
- func (m *Data) Close() error
- func (m *Data) DeleteNode(n *Node) error
- func (m *Data) DeleteProject(p *Project) error
- func (m *Data) DeleteVarInProject(d *Var, project string) error
- func (m *Data) Envs(ignores ...uint64) ([]Keyer, error)
- func (m *Data) GetEnv(key uint64) (Keyer, error)
- func (m *Data) GetNode(key string) (Keyer, error)
- func (m *Data) GetProject(key string) (Keyer, error)
- func (m *Data) GetVarInProject(key uint64, project string) (Keyer, error)
- func (m *Data) Nodes() ([]Keyer, error)
- func (m *Data) Projects() ([]Keyer, error)
- func (m *Data) UnbindEnvInProject(s *Env, project string) error
- func (m *Data) UpdateVarInProject(d *Var, project string) error
- func (m *Data) UpsertEnv(s *Env) error
- func (m *Data) UpsertProject(p *Project) error
- type Deploy
- type Env
- type EnvsValue
- type Keyer
- type Kind
- type Node
- type Project
- func (p *Project) AddEnv(e *Env) error
- func (p *Project) AddVar(v *Var) error
- func (p *Project) AutoIncrementing() bool
- func (p *Project) DeleteEnv(e *Env) (err error)
- func (p *Project) DeleteVar(v *Var) (err error)
- func (p *Project) Deployed() bool
- func (p *Project) Envs() (envs []Keyer)
- func (p *Project) EnvsValues() (firstEnvValues, secondEnvValues []string)
- func (p *Project) FirstEnv() *Env
- func (p *Project) Hash(s string) []byte
- func (p *Project) Key() []byte
- func (p *Project) SecondEnv() *Env
- func (p *Project) SetKey(k []byte) error
- func (p *Project) ToDeploy(firstEnvValues, secondEnvValues []string) map[string]interface{}
- func (p *Project) Updated()
- func (p *Project) Valid(insert bool) error
- func (p *Project) Vars() []Keyer
- type Server
- type Updater
- type Validator
- type Valuable
- type Var
- func (v *Var) AutoIncrementing() bool
- func (v *Var) CleanValues(env1, env2 *Env) error
- func (v *Var) Deleted() bool
- func (v *Var) Key() []byte
- func (v *Var) NewValues(env1, env2 *Env) EnvsValue
- func (v *Var) SetKey(k []byte) error
- func (v *Var) SetValues(m map[string]string) (err error)
- func (v *Var) Updated()
- func (v *Var) Valid(insert bool) error
- type VarID
Constants ¶
const ( VarIDPrefix = "_" VarIDTie = "." )
envTie is used to join two environment'values.
Variables ¶
var ( ErrAlreadyExists = errors.New("already exists") ErrInvalid = errors.New("invalid data") ErrMissing = errors.New("missing data") ErrNotFound = errors.New("not found") ErrOutOfBounds = errors.New("out of bounds") ErrUnknown = errors.New("unknown data") )
Error messages.
var DefaultEnv = &Env{Values: []string{""}}
DefaultEnv is the default Environment used to build the variables's values.
Kinds returns the list of available kinds.
Functions ¶
This section is empty.
Types ¶
type AutoIncrementer ¶
type AutoIncrementer interface {
AutoIncrementing() bool
}
AutoIncrementer must be implement to manage the kind of primary key.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data manages the collection of buckets.
func (*Data) AddProject ¶
AddProject creates a project or returns on error if already exists.
func (*Data) AddVarInProject ¶
AddVarInProject adds a var on a project with its name.
func (*Data) BindEnvInProject ¶
BindEnvInProject binds a env to a project
func (*Data) DeleteProject ¶
DeleteProject removes a project.
func (*Data) DeleteVarInProject ¶
DeleteVarInProject removes a variable in the given project.
func (*Data) GetProject ¶
GetProject returns an error or the project if it exists. It contains all its properties, as the list of vars or envs.
func (*Data) GetVarInProject ¶
GetVarInProject returns an error or the var if it exists.
func (*Data) UnbindEnvInProject ¶
UnbindEnvInProject unbinds a env to a project.
func (*Data) UpdateVarInProject ¶
UpdateVarInProject updates a project's var or returns in error if not exists.
func (*Data) UpsertProject ¶
UpsertProject updates or creates if not exists a project.
type Deploy ¶
type Deploy struct { ID uint64 `json:"id"` ProjectID string `json:"project_id"` ServerList []*Server `json:"servers"` ItemList map[string]interface{} `json:"items"` LastUpdateTs time.Time `json:"upd_ts"` }
Deploy represents one deployment.
func (*Deploy) AutoIncrementing ¶
AutoIncrementing return true in order to have auo-increment primary key.
type Env ¶
type Env struct { ID uint64 `json:"id"` Name string `json:"name"` Values []string `json:"vals"` LastUpdateTs time.Time `json:"upd_ts"` }
Env represents a env of execution.
func (*Env) AutoIncrementing ¶
AutoIncrementing return true in order to have auo-increment primary key.
type EnvsValue ¶
type EnvsValue map[string]interface{}
EnvsValue contains all variable's values by given envs. Key combines environment names with a colon.
type Keyer ¶
Keyer is implemented by any value that has a Key method, which returns the “key” identifier for that value.
type Kind ¶
type Kind int
Kind specifies the kind of value.
const ( // Unknown values Unknown Kind = iota // Numeric values Int Float // Non-numeric values Bool String )
List of value's kind.
func (Kind) ZeroString ¶
ZeroString returns the zero value of the kind as string.
type Node ¶
Node represents a server used as cache by EVE.
func (*Node) AutoIncrementing ¶
AutoIncrementing return true in order to have auo-increment primary key.
type Project ¶
type Project struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"desc,omitempty"` LastUpdateTs time.Time `json:"upd_ts"` LastDeployTs time.Time `json:"dep_ts,omitempty"` EnvList []uint64 `json:"envs,omitempty"` VarList []uint64 `json:"vars,omitempty"` // contains filtered or unexported fields }
Project represents the container of the vars.
func NewProject ¶
NewProject creates a new instance of Project.
func (*Project) AddEnv ¶
AddEnv adds a env to the project. Only two dimensions are managed by the system.
func (*Project) AutoIncrementing ¶
AutoIncrementing return false in order to manage primary by itself.
func (*Project) EnvsValues ¶
EnvsValues returns all available values by environment.
func (*Project) ToDeploy ¶
ToDeploy returns the list of key / value to deploy. This list if filtered by the values of the first and the second env. Variable to remove are given with nil value.
func (*Project) Updated ¶
func (p *Project) Updated()
Updated changes the last update date of the variable.
type Updater ¶
type Updater interface {
Updated()
}
Updater is implemented to mark as updated the data.
type Valuable ¶
type Valuable interface { AutoIncrementer Keyer Updater Validator }
Valuable must be implemented by any value to store.
type Var ¶
type Var struct { ID uint64 `json:"id"` Name string `json:"name"` Kind Kind `json:"kind"` Values EnvsValue `json:"vals,omitempty"` LastUpdateTs time.Time `json:"upd_ts"` DeletionTs time.Time `json:"del_ts,omitempty"` Partial bool }
Var represents a variable.
func (*Var) AutoIncrementing ¶
AutoIncrementing return true in order to have auo-increment primary key.
func (*Var) CleanValues ¶
CleanValues ensures that all values use the kind of the variable. It also checks that only the current environments values are used. A partial result is returned if one the environment does not exist. It return on error if the kind of value does not match.
func (*Var) NewValues ¶
NewValues returns a new map of values for the given environments. Each value use the default value of the kind of the variable.