-
Notifications
You must be signed in to change notification settings - Fork 0
EMP Object Reference
Alex Dean edited this page Jun 24, 2013
·
1 revision
There are a few objects that EMP has, which the DB will need to know about and how to store. This is subject to change while in pre-alpha, and should probably be in the EMPD wiki (but for now, this will do). You can find more information about these in empinternal.hrl and emptypes.hrl.
-record(user,
{
uid :: 'UUID'(),
name=(<<>>) :: 'BINARYSTRING'() %Note: default required.
}).
-type 'EMPUSER'() :: #user{}.
-define(EMPUSER( UID, NAME ),
#user{
uid=UID,
name=NAME
}).-record(param,
{
name :: 'BINARYSTRING'(),
default :: json_valid_value(),
type :: 'EMPTYPEDEF'()
}).
-type 'EMPPARAM'() :: #param{}.
-define(EMPPARAM(Name, TypeDef, Default),
#param{name=Name,
type=TypeDef,
default=Default}).-record(event,
{
pid :: 'UUID'(),
eid :: 'UUID'(),
name :: 'BINARYSTRING'(),
dvalues=[] :: ['EMPPARAM'()]
}).
-type 'EMPEVENT'() :: #command{}.
-define(EMPEVENT(Name, ValueList),
#event{name=Name,
dvalues=ValueList}).-record(command,
{
pid :: 'UUID'(),
cid :: 'UUID'(),
name :: 'BINARYSTRING'(),
func :: fun(),
dparams=[] :: ['EMPPARAM'()],
rettype :: 'EMPTYPEDEF'()
}).
-type 'EMPCOMMAND'() :: #command{}.
-define(EMPCOMMAND(Name, Function, ParamList, RetList),
#command{name=Name,
func=Function,
dparams=ParamList,
rettype=RetList}).-record(plugindef,
{
id :: 'UUID'(),
module :: atom(),
state :: [ { 'BINARYSTRING'(), any() } ],
commands :: 'EMPCOMMAND'()
}).
-type 'EMPPLUGINDEF'() :: #plugindef{}.
-define(EMPPLUGINDEF(ID, MODULE, STATE, COMMANDS ),
#plugindef{
id = ID,
module = MODULE,
state = STATE,
commands = COMMANDS
}).-record(subscription,
{
event :: 'EMPEVENT'(),
command :: 'EMPCOMMAND'(),
temp=false :: boolean(),
mapping=[] :: [tuple()]
}).
-type 'EMPSUBSCRIPTION'() :: #subscription{}.
-define(EMPSUBSCRIPTION(EVENT,COMMAND,MAPPING),
#subscription{
event=EVENT,
command=COMMAND,
mapping=MAPPING
}).