Documentation ¶
Overview ¶
NanoNanostate implementation. Nanostate example:
---------------------------------------------- id: some-Nanostate descr: This describes what this Nanostate is for.
state:
maintain-database: - sshrunner: - stop-db: systemctl stop postgresql.service - backup-db: pg-backup /var/lib/pgsql/data /opt/backups/ - start-db: systemctl start postgresql.service - somemodule: keyparam: valueparam keyparam2: valueparam2 keyparam3: valueparam3 some-other-group: - sshrunner: - uptime: uptime - id : cat /etc/machine-id
----------------------------------------------
In the example above, three fields are required:
- id This an ID of the Nanostate. It is used for the reporting at the end.
- descr: Description of the Nanostate. Also reporting.
- state: This is the entire tree of the Nanostate structure. It has twofold tree: a group IDs with a list of modules and the params or commands below.
Currently only one module is implemented: sshrunner, which performs a series of synchronous commands in the order they were placed for orchestration purposes.
In the nanoNanostate groups are asynchronous, but the commands inside the groups are synchronous.
Index ¶
- type NanoStateIndex
- func (nsf *NanoStateIndex) AddStateRoot(pth string) *NanoStateIndex
- func (nsf *NanoStateIndex) AddStateRoots(pth ...string) *NanoStateIndex
- func (nsf *NanoStateIndex) GetStateByFileName(name string) *NanoStateMeta
- func (nsf *NanoStateIndex) GetStateById(id string) *NanoStateMeta
- func (nsf *NanoStateIndex) Index()
- type NanoStateMeta
- type Nanostate
- type StateGroup
- type StateModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NanoStateIndex ¶
type NanoStateIndex struct {
// contains filtered or unexported fields
}
func NewNanoStateIndex ¶
func NewNanoStateIndex() *NanoStateIndex
func (*NanoStateIndex) AddStateRoot ¶
func (nsf *NanoStateIndex) AddStateRoot(pth string) *NanoStateIndex
AddStateRoot is used to chain-add another state root
func (*NanoStateIndex) AddStateRoots ¶
func (nsf *NanoStateIndex) AddStateRoots(pth ...string) *NanoStateIndex
AddStateRoots is used to chain-add another state roots (array)
func (*NanoStateIndex) GetStateByFileName ¶
func (nsf *NanoStateIndex) GetStateByFileName(name string) *NanoStateMeta
func (*NanoStateIndex) GetStateById ¶
func (nsf *NanoStateIndex) GetStateById(id string) *NanoStateMeta
func (*NanoStateIndex) Index ¶
func (nsf *NanoStateIndex) Index()
Index all the files in the all roots
type NanoStateMeta ¶
type Nanostate ¶
type Nanostate struct { Id string Descr string Groups []*StateGroup }
func NewNanostate ¶
func NewNanostate() *Nanostate
type StateGroup ¶
type StateGroup struct { Id string Group []*StateModule }