- Add base module with context, session, and configurator. - Implement session management and configuration loading/saving. - Introduce error handling and logging mechanisms. - Include template files for Lua scripts.
context & sessions
Everything we do in hero lives in a context, each context has a unique name.
Redis is used to manage the contexts and the sessions.
- redis db 0
context:currentcurent id of the context, is also the DB if redis if redis is used
- redis db X, x is nr of context
context:namename of this contextcontext:secretsecret as is used in context (is md5 of original config secret)context:privkeysecp256k1 privkey as is used in context (encrypted by secret)context:paramsparams for a context, can have metadatacontext:lastidlast id for our dbsession:$idthe location of sessionsession:$id:paramsparams for the session, can have metadata
Session id is $contextid:$sessionid (e.g. 10:111)
The SessionNewArgs:
- context_name string = 'default'
- session_name string //default will be an incremental nr if not filled in
- interactive bool = true //can ask questions, default on true
- coderoot string //this will define where all code is checked out
import freeflowuniverse.crystallib.core.base
mut session:=context_new(
coderoot:'/tmp/code'
interactive:true
)!
mut session:=session_new(context:'default',session:'mysession1')!
mut session:=session_new()! //returns default context & incremental new session