Skip to content

installers.db.herodb #

herodb

HeroDB installer for herolib.

To get started

import incubaid.herolib.installers.db.herodb

heroscript := '
!!herodb.configure name:'test'
    adminsecret: 'mysecret1234'
    port: 5555
    path: '/var/lib/herodb'

!!herodb.start name:'test' reset:true
'

mut plbook := playbook.new(text: heroscript)!
herodb.play(mut plbook)!

// or we can call the installer directly
// mut installer := herodb.get(name: 'test')!
// installer.start(reset: true)!

Example heroscript

!!herodb.configure
    name: 'default'
    adminsecret: 'secretpassword'
    host: 'localhost'
    port: 5555
    path: '/var/lib/herodb'
    rpc_socket: '/var/run/herodb/admin.sock'

!!herodb.start reset:true

Constants #

const version = '0.0.0'

fn delete #

fn delete(args ArgsGet) !

fn exists #

fn exists(args ArgsGet) !bool

does the config exists?

fn get #

fn get(args ArgsGet) !&HeroDBInstaller

fn heroscript_loads #

fn heroscript_loads(heroscript string) !HeroDBInstaller

///////////NORMALLY NO NEED TO TOUCH

fn list #

fn list(args ArgsList) ![]&HeroDBInstaller

if fromdb set: load from filesystem, and not from mem, will also reset what is in mem

fn new #

fn new(args ArgsGet) !&HeroDBInstaller

fn play #

fn play(mut plbook PlayBook) !

fn set #

fn set(o HeroDBInstaller) !

register the config for the future

fn switch #

fn switch(name string)

switch instance to be used for herodb

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name   string = 'default'
	fromdb bool // will load from filesystem
	create bool // default will not create if not exist
}

///////FACTORY

struct ArgsList #

@[params]
struct ArgsList {
pub mut:
	fromdb bool // will load from filesystem
}

struct HeroDBInstaller #

@[heap]
struct HeroDBInstaller {
pub mut:
	name        string = 'default'
	adminsecret string
	host        []string // e.g. localhost, ...
	port        int    = 5555
	rpc_socket  string = '/var/run/herodb/admin.sock' // unix socket for admin purposes only, no password or secret needed
	path        string = '/var/lib/herodb'            // e.g. /var/lib/herodb
}

THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED

fn (HeroDBInstaller) install_start #

fn (mut self HeroDBInstaller) install_start(args InstallArgs) !

fn (HeroDBInstaller) reload #

fn (mut self HeroDBInstaller) reload() !

load from disk and make sure is properly intialized

fn (HeroDBInstaller) restart #

fn (mut self HeroDBInstaller) restart(args StartArgs) !

fn (HeroDBInstaller) running #

fn (mut self HeroDBInstaller) running() !bool

fn (HeroDBInstaller) start #

fn (mut self HeroDBInstaller) start(args StartArgs) !

fn (HeroDBInstaller) stop #

fn (mut self HeroDBInstaller) stop() !

struct InstallArgs #

@[params]
struct InstallArgs {
pub mut:
	reset bool
}

struct StartArgs #

@[params]
struct StartArgs {
pub mut:
	reset bool
}