Skip to content

installers.db.zerodb #

Vlang ZDB Client

to use:

to use test

##r#mkdir -p ~/.zdb
zdb --socket ~/.zdb/socket --admin 1234
redis-cli -s ~/.zdb/socket
#redis-cli -s ~/.zdb/socket --raw nsinfo default

then in the redis-cli can do e.g.

nsinfo default

Constants #

const version = '2.0.7'

fn delete #

fn delete(args_ ArgsGet) !

fn exists #

fn exists(args_ ArgsGet) !bool

does the config exists?

fn get #

fn get(args_ ArgsGet) !&ZeroDB

fn heroscript_dumps #

fn heroscript_dumps(obj ZeroDB) !string

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

fn heroscript_loads #

fn heroscript_loads(heroscript string) !ZeroDB

fn play #

fn play(args_ PlayArgs) !

fn set #

fn set(o ZeroDB) !

register the config for the future

fn switch #

fn switch(name string)

switch instance to be used for zerodb

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string
}

///////FACTORY

struct DefaultConfigArgs #

@[params]
struct DefaultConfigArgs {
	instance string = 'default'
}

helpers

struct InstallArgs #

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

struct PlayArgs #

@[params]
struct PlayArgs {
pub mut:
	heroscript string // if filled in then plbook will be made out of it
	plbook     ?playbook.PlayBook
	reset      bool
}

struct ZeroDB #

@[heap]
struct ZeroDB {
pub mut:
	name         string = 'default'
	secret       string @[secret]
	sequential   bool // if sequential then we autoincrement the keys
	datadir      string ='${os.home_dir()}/var/zdb/data'
	indexdir     string ='${os.home_dir()}/var/zdb/index'
	rotateperiod int    = 1200 // 20 min
	port         int    = 3355
}

fn (ZeroDB) build #

fn (mut self ZeroDB) build() !

fn (ZeroDB) destroy #

fn (mut self ZeroDB) destroy() !

fn (ZeroDB) install #

fn (mut self ZeroDB) install(args InstallArgs) !

fn (ZeroDB) install_start #

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

fn (ZeroDB) reload #

fn (mut self ZeroDB) reload() !

load from disk and make sure is properly intialized

fn (ZeroDB) restart #

fn (mut self ZeroDB) restart() !

fn (ZeroDB) running #

fn (mut self ZeroDB) running() !bool

fn (ZeroDB) start #

fn (mut self ZeroDB) start() !

fn (ZeroDB) stop #

fn (mut self ZeroDB) stop() !