Behaviours: application.
Erlang binding for GT.M database
Example of usage:erl> egtm:start (). ok erl> egtm:zversion(). "GT.M V5.4-002B Linux x86_64" erl> egtm:job(). "13757" erl> egtm:get ("^ZTMR"). [] erl> egtm:set ("^ZTMR", [1,2,3], egtm:zversion ()). ok erl> egtm:get ("^ZTMR"). [] erl> egtm:get ("^ZTMR", [1,2,3]). "GT.M V5.4-002B Linux x86_64" erl> Rand = fun (N) -> random:uniform (N) end. #Fun<erl_eval.6.111823515> erl> egtm:set ("^ZTMR", [Rand (10), Rand (10)], Rand (10000)). ok erl> egtm:set ("^ZTMR", [Rand (10), Rand (10)], Rand (10000)). ok erl> egtm:set ("^ZTMR", [Rand (10), Rand (10)], Rand (10000)). ok erl> egtm:set ("^ZTMR", [Rand (10), Rand (10)], Rand (10000)). ok erl> egtm:set ("^ZTMR", [Rand (10), Rand (10)], Rand (10000)). ok erl> egtm_util:foreach ("^ZTMR", [], fun (G, S, R) -> egtm_util:foreach (G, S), [] end). ^ZTMR["1","2"]=[] ^ZTMR["2","3"]="6972" ^ZTMR["2","6"]="2150" ^ZTMR["4","6"]="9157" ^ZTMR["7","5"]="5966" ^ZTMR["8","10"]="5015" {ok,[]} erl> egtm:order ("^ZTMR", ["2", ""], backward). ["2","6"] erl> egtm:order ("^ZTMR", ["2", ""], forward). ["2","3"] erl> egtm:stop (). ok erl>
call/1 | Equivalent to call(Gvn, []). |
call/2 | Intrinsic call to external routine (MUMPS: $$@Pgm@(Args) ). |
call_fast_order/2 | XXX: Alternative egtm:order () experiment. |
data/1 | data (Gvn, []). |
data/2 | Check if the subtree of global variable
contains any records (MUMPS: $Data(@Gvn@(Subs)) ). |
do/1 | Equivalent to do(Gvn, []). |
do/2 | Extrinsic call to external routine (MUMPS: Do @Pgm@(Args) ). |
fast_order/2 | XXX: Alternative egtm:order () experiment. |
get/1 | Equivalent to get(Gvn, []). |
get/2 | Get value of specified node (MUMPS: $Get(@Gvn@(Subs)) ). |
getp/1 | Equivalent to getp(Gvn, Subs, Piece, Delim). |
getp/2 | Equivalent to getp(Gvn, Subs, Piece, Delim). |
getp/3 | Equivalent to getp(Gvn, Subs, Piece, Delim). |
getp/4 | Get value of specific position in specified node
value delimited by specified delimiter
(MUMPS: $Piece($Get(@Gvn@(Subs)),Delim,Piece) ). |
gorder/0 | Equivalent to gorder([]). |
gorder/1 | A special case of egtm:order () where
we want order not only over subscripts, but
over global names. |
horolog/0 | Return the current time in MUMPS $H-format (MUMPS: $Horolog ). |
iget/1 | Return a value of intrinsic (system) variable. |
iget/2 | Equivalent to iget(VarName). |
job/0 | Return process ID of the GT.M worker job (MUMPS: $Job ). |
kill/1 | Equivalent to kill(Gvn, []). |
kill/2 | Kill specified node including all its
parents (MUMPS: Kill @Gvn@(Subs) ). |
lock/1 | Equivalent to lock(Gvn, []). |
lock/2 | Lock a subtree of global variable (MUMPS: Lock +@Gvn@(Subs) ). |
merge/2 | Equivalent to merge(SrcGvn, [], DstGvn, []). |
merge/4 | Merge/copy one sparse array to another one
(MUMPS: Merge @DstGvn@(DstSubs)=@SrcGvn@(SrcSubs) ). |
order/0 | Equivalent to gorder(). |
order/1 | Equivalent to gorder(Gvn). |
order/2 | Equivalent to order(Gvn, Subs, forward). |
order/3 | Obtain next/previous key from global name Gvn
and subscript index Subs with respect to Direction
(MUMPS: $Order(@Gvn@(Subs),Direction) ). |
perform/2 | Perform EGTM operation. |
set/2 | Equivalent to set(Gvn, Subs, Val). |
set/3 | Set value of specified node (MUMPS Set @Gvn@(Subs)=Val ). |
setp/2 | Equivalent to setp(Gvn, Subs, Piece, Delim, Val). |
setp/3 | Equivalent to setp(Gvn, Subs, Piece, Delim, Val). |
setp/4 | Equivalent to setp(Gvn, Subs, Piece, Delim, Val). |
setp/5 | Set value of specific position in specified node
value delimited by specified delimiter
(MUMPS: Set $Piece($Get(@Gvn@(Subs)),Piece,Delim)=Val ). |
start/0 | Start EGTM application. |
start/2 | application:start callback, do not use directly! |
stop/0 | Stop EGTM application. |
stop/1 | application:stop callback, do not use directly! |
tcommit/0 | Commit the current transaction level and
clear the transaction buffer (MUMPS: TCommit ). |
trollback/0 | Roll back the current transaction level
and clear the transaction buffer (MUMPS: TRollback ). |
tstart/0 | Equivalent to tstart(""). |
tstart/1 | Start a new level of transaction
(MUMPS: TStart @Opt ). |
unlock/1 | Equivalent to unlock(Gvn, []). |
unlock/2 | Unlock a subtree of global variable (MUMPS: Lock -@Gvn@(Subs) ). |
xecute/1 | Evaluate MUMPS code (MUMPS: Xecute Mcode ). |
xecute_fast_order/2 | XXX: Alternative egtm:order () experiment. |
zkill/1 | Equivalent to zkill(Gvn, []). |
zkill/2 | ZKILL/ZWITHDRAW operation kills only specified
node without affecting any of subnodes
(MUMPS: ZKill @Gvn@(Subs) ). |
zversion/0 | Return GT.M version information (MUMPS: $Zversion ). |
call(Pgm) -> any()
Equivalent to call(Gvn, []).
call(Pgm::program_name(), Args::list()) -> string()
Intrinsic call to external routine (MUMPS: $$@Pgm@(Args)
).
call_fast_order(Gvn, Subs) -> any()
XXX: Alternative egtm:order ()
experiment.
data(Gvn) -> any()
data (Gvn, []).
data(Gvn::global_name(), Subs::subscripts()) -> integer()
Check if the subtree of global variable
contains any records (MUMPS: $Data(@Gvn@(Subs))
).
do(Pgm) -> any()
Equivalent to do(Gvn, []).
do(Pgm::program_name(), Args::list()) -> ok
Extrinsic call to external routine (MUMPS: Do @Pgm@(Args)
).
fast_order(Gvn, Subs) -> any()
XXX: Alternative egtm:order ()
experiment.
get(Gvn) -> any()
Equivalent to get(Gvn, []).
get(Gvn::global_name(), Subs::subscripts()) -> string()
Get value of specified node (MUMPS: $Get(@Gvn@(Subs))
).
getp(Gvn) -> any()
Equivalent to getp(Gvn, Subs, Piece, Delim).
getp(Gvn, Piece) -> any()
Equivalent to getp(Gvn, Subs, Piece, Delim).
getp(Gvn, Piece, Delim) -> any()
Equivalent to getp(Gvn, Subs, Piece, Delim).
getp(Gvn::global_name(), Subs::subscripts(), Piece::integer(), Delim::string()) -> string()
Get value of specific position in specified node
value delimited by specified delimiter
(MUMPS: $Piece($Get(@Gvn@(Subs)),Delim,Piece)
).
gorder() -> any()
Equivalent to gorder([]).
gorder(Gvn) -> any()
A special case of egtm:order ()
where
we want order not only over subscripts, but
over global names.
If no Gvn
specified, "^%" is used as it
is the first possible name of any global name.
gorder
is limited only
to few cases, we support only forward
direction.
horolog() -> string()
Return the current time in MUMPS $H-format (MUMPS: $Horolog
).
XXX: what about transforming it from string "X,Y" to Erlang tuple {X,Y}?
iget(VarName::string()) -> string()
Return a value of intrinsic (system) variable.
Example: to get $ZRO[utines]
, just egtm:iget ("ZRO")
.
Note: to set an intrinsic variable, there's no iset
supported, so feel free to use xecute
.
iget(VarName::string(), Subs::subscripts()) -> string()
Equivalent to iget(VarName).
job() -> string()
Return process ID of the GT.M worker job (MUMPS: $Job
).
XXX: what about transforming it from string to integer or long?
kill(Gvn) -> any()
Equivalent to kill(Gvn, []).
kill(Gvn::global_name(), Subs::subscripts()) -> ok
Kill specified node including all its
parents (MUMPS: Kill @Gvn@(Subs)
).
lock(Gvn) -> any()
Equivalent to lock(Gvn, []).
lock(Gvn::global_name(), Subs::subscripts()) -> ok
Lock a subtree of global variable (MUMPS: Lock +@Gvn@(Subs)
).
merge(SrcGvn, DstGvn) -> any()
Equivalent to merge(SrcGvn, [], DstGvn, []).
merge(SrcGvn::global_name(), SrcSubs::subscripts(), DstGvn::global_name(), DstSubs::subscripts()) -> ok
Merge/copy one sparse array to another one
(MUMPS: Merge @DstGvn@(DstSubs)=@SrcGvn@(SrcSubs)
).
order() -> any()
Equivalent to gorder().
order(Gvn) -> any()
Equivalent to gorder(Gvn).
order(Gvn, Subs) -> any()
Equivalent to order(Gvn, Subs, forward).
order(Gvn::global_name(), Subs::subscripts(), Dir::order_direction()) -> subscripts()
Obtain next/previous key from global name Gvn
and subscript index Subs
with respect to Direction
(MUMPS: $Order(@Gvn@(Subs),Direction)
).
^X(0,1)="A",^X(0,2)="B",^X(0,3)="C"
egtm:order ("^X", [0, ""]) = [0,1]
egtm:order ("^X", [0, 1]) = [0,2]
egtm:order ("^X", [0, 2]) = [0,3]
egtm:order ("^X", [0, 3]) = [0,""]
Subs
list is treated XXX
perform(Op, Args) -> any()
Perform EGTM operation. A wrapper for all calls
with integrated decision logic if the operation is
to be performed by local worker, via pool, or via
cluster API.
This function is used as a proxy for all EGTM operations
within egtm
module.
It is not recommended to use it directly from applications
as it calls raw NIF functions without any additional logic.
set(Gvn, Val) -> any()
Equivalent to set(Gvn, Subs, Val).
set(Gvn::global_name(), Subs::subscripts(), Val::string()) -> ok
Set value of specified node (MUMPS Set @Gvn@(Subs)=Val
).
setp(Gvn, Val) -> any()
Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp(Gvn, Piece, Val) -> any()
Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp(Gvn, Piece, Delim, Val) -> any()
Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp(Gvn::global_name(), Subs::subscripts(), Piece::integer(), Delim::string(), Val::string()) -> ok
Set value of specific position in specified node
value delimited by specified delimiter
(MUMPS: Set $Piece($Get(@Gvn@(Subs)),Piece,Delim)=Val
).
start() -> any()
Start EGTM application.
start(Type, Args) -> any()
application:start callback, do not use directly!
stop() -> any()
Stop EGTM application.
stop(State) -> any()
application:stop callback, do not use directly!
tcommit() -> ok
Commit the current transaction level and
clear the transaction buffer (MUMPS: TCommit
).
trollback() -> ok
Roll back the current transaction level
and clear the transaction buffer (MUMPS: TRollback
).
tstart() -> any()
Equivalent to tstart("").
tstart(Opt::tp_options()) -> ok
Start a new level of transaction
(MUMPS: TStart @Opt
).
unlock(Gvn) -> any()
Equivalent to unlock(Gvn, []).
unlock(Gvn::global_name(), Subs::subscripts()) -> ok
Unlock a subtree of global variable (MUMPS: Lock -@Gvn@(Subs)
).
xecute(Mcode::string()) -> ok
Evaluate MUMPS code (MUMPS: Xecute Mcode
).
USE CAREFULLY!
xecute_fast_order(Gvn, Subs) -> any()
XXX: Alternative egtm:order ()
experiment.
XXX: Ensure it to run on the same egtm_worker
zkill(Gvn) -> any()
Equivalent to zkill(Gvn, []).
zkill(Gvn::global_name(), Subs::subscripts()) -> ok
ZKILL/ZWITHDRAW operation kills only specified
node without affecting any of subnodes
(MUMPS: ZKill @Gvn@(Subs)
).
zversion() -> string()
Return GT.M version information (MUMPS: $Zversion
).
Generated by EDoc, Aug 19 2012, 02:27:27.