Module egtm

Erlang binding for GT.M database.

Behaviours: application.

Description

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>

Function Index

call/1Equivalent to call(Gvn, []).
call/2Intrinsic call to external routine (MUMPS: $$@Pgm@(Args)).
call_fast_order/2XXX: Alternative egtm:order () experiment.
data/1data (Gvn, []).
data/2Check if the subtree of global variable contains any records (MUMPS: $Data(@Gvn@(Subs))).
do/1Equivalent to do(Gvn, []).
do/2Extrinsic call to external routine (MUMPS: Do @Pgm@(Args)).
fast_order/2XXX: Alternative egtm:order () experiment.
get/1Equivalent to get(Gvn, []).
get/2Get value of specified node (MUMPS: $Get(@Gvn@(Subs))).
getp/1Equivalent to getp(Gvn, Subs, Piece, Delim).
getp/2Equivalent to getp(Gvn, Subs, Piece, Delim).
getp/3Equivalent to getp(Gvn, Subs, Piece, Delim).
getp/4Get value of specific position in specified node value delimited by specified delimiter (MUMPS: $Piece($Get(@Gvn@(Subs)),Delim,Piece)).
gorder/0Equivalent to gorder([]).
gorder/1A special case of egtm:order () where we want order not only over subscripts, but over global names.
horolog/0Return the current time in MUMPS $H-format (MUMPS: $Horolog).
iget/1Return a value of intrinsic (system) variable.
iget/2Equivalent to iget(VarName).
job/0Return process ID of the GT.M worker job (MUMPS: $Job).
kill/1Equivalent to kill(Gvn, []).
kill/2Kill specified node including all its parents (MUMPS: Kill @Gvn@(Subs)).
lock/1Equivalent to lock(Gvn, []).
lock/2Lock a subtree of global variable (MUMPS: Lock +@Gvn@(Subs)).
merge/2Equivalent to merge(SrcGvn, [], DstGvn, []).
merge/4Merge/copy one sparse array to another one (MUMPS: Merge @DstGvn@(DstSubs)=@SrcGvn@(SrcSubs)).
order/0Equivalent to gorder().
order/1Equivalent to gorder(Gvn).
order/2Equivalent to order(Gvn, Subs, forward).
order/3Obtain next/previous key from global name Gvn and subscript index Subs with respect to Direction (MUMPS: $Order(@Gvn@(Subs),Direction)).
perform/2Perform EGTM operation.
set/2Equivalent to set(Gvn, Subs, Val).
set/3Set value of specified node (MUMPS Set @Gvn@(Subs)=Val).
setp/2Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp/3Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp/4Equivalent to setp(Gvn, Subs, Piece, Delim, Val).
setp/5Set value of specific position in specified node value delimited by specified delimiter (MUMPS: Set $Piece($Get(@Gvn@(Subs)),Piece,Delim)=Val).
start/0Start EGTM application.
start/2application:start callback, do not use directly!
stop/0Stop EGTM application.
stop/1application:stop callback, do not use directly!
tcommit/0Commit the current transaction level and clear the transaction buffer (MUMPS: TCommit).
trollback/0Roll back the current transaction level and clear the transaction buffer (MUMPS: TRollback).
tstart/0Equivalent to tstart("").
tstart/1Start a new level of transaction (MUMPS: TStart @Opt).
unlock/1Equivalent to unlock(Gvn, []).
unlock/2Unlock a subtree of global variable (MUMPS: Lock -@Gvn@(Subs)).
xecute/1Evaluate MUMPS code (MUMPS: Xecute Mcode).
xecute_fast_order/2XXX: Alternative egtm:order () experiment.
zkill/1Equivalent to zkill(Gvn, []).
zkill/2ZKILL/ZWITHDRAW operation kills only specified node without affecting any of subnodes (MUMPS: ZKill @Gvn@(Subs)).
zversion/0Return GT.M version information (MUMPS: $Zversion).

Function Details

call/1

call(Pgm) -> any()

Equivalent to call(Gvn, []).

call/2

call(Pgm::program_name(), Args::list()) -> string()

Intrinsic call to external routine (MUMPS: $$@Pgm@(Args)).

call_fast_order/2

call_fast_order(Gvn, Subs) -> any()

XXX: Alternative egtm:order () experiment.

data/1

data(Gvn) -> any()

data (Gvn, []).

data/2

data(Gvn::global_name(), Subs::subscripts()) -> integer()

Check if the subtree of global variable contains any records (MUMPS: $Data(@Gvn@(Subs))).

do/1

do(Pgm) -> any()

Equivalent to do(Gvn, []).

do/2

do(Pgm::program_name(), Args::list()) -> ok

Extrinsic call to external routine (MUMPS: Do @Pgm@(Args)).

fast_order/2

fast_order(Gvn, Subs) -> any()

XXX: Alternative egtm:order () experiment.

get/1

get(Gvn) -> any()

Equivalent to get(Gvn, []).

get/2

get(Gvn::global_name(), Subs::subscripts()) -> string()

Get value of specified node (MUMPS: $Get(@Gvn@(Subs))).

getp/1

getp(Gvn) -> any()

Equivalent to getp(Gvn, Subs, Piece, Delim).

getp/2

getp(Gvn, Piece) -> any()

Equivalent to getp(Gvn, Subs, Piece, Delim).

getp/3

getp(Gvn, Piece, Delim) -> any()

Equivalent to getp(Gvn, Subs, Piece, Delim).

getp/4

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/0

gorder() -> any()

Equivalent to gorder([]).

gorder/1

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.

Since the use of gorder is limited only to few cases, we support only forward direction.

horolog/0

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/1

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/2

iget(VarName::string(), Subs::subscripts()) -> string()

Equivalent to iget(VarName).

job/0

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/1

kill(Gvn) -> any()

Equivalent to kill(Gvn, []).

kill/2

kill(Gvn::global_name(), Subs::subscripts()) -> ok

Kill specified node including all its parents (MUMPS: Kill @Gvn@(Subs)).

lock/1

lock(Gvn) -> any()

Equivalent to lock(Gvn, []).

lock/2

lock(Gvn::global_name(), Subs::subscripts()) -> ok

Lock a subtree of global variable (MUMPS: Lock +@Gvn@(Subs)).

merge/2

merge(SrcGvn, DstGvn) -> any()

Equivalent to merge(SrcGvn, [], DstGvn, []).

merge/4

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/0

order() -> any()

Equivalent to gorder().

order/1

order(Gvn) -> any()

Equivalent to gorder(Gvn).

order/2

order(Gvn, Subs) -> any()

Equivalent to order(Gvn, Subs, forward).

order/3

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)).

Returns a next (full) subscript to use, example: Note that empty Subs list is treated XXX

perform/2

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/2

set(Gvn, Val) -> any()

Equivalent to set(Gvn, Subs, Val).

set/3

set(Gvn::global_name(), Subs::subscripts(), Val::string()) -> ok

Set value of specified node (MUMPS Set @Gvn@(Subs)=Val).

setp/2

setp(Gvn, Val) -> any()

Equivalent to setp(Gvn, Subs, Piece, Delim, Val).

setp/3

setp(Gvn, Piece, Val) -> any()

Equivalent to setp(Gvn, Subs, Piece, Delim, Val).

setp/4

setp(Gvn, Piece, Delim, Val) -> any()

Equivalent to setp(Gvn, Subs, Piece, Delim, Val).

setp/5

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/0

start() -> any()

Start EGTM application.

start/2

start(Type, Args) -> any()

application:start callback, do not use directly!

stop/0

stop() -> any()

Stop EGTM application.

stop/1

stop(State) -> any()

application:stop callback, do not use directly!

tcommit/0

tcommit() -> ok

Commit the current transaction level and clear the transaction buffer (MUMPS: TCommit).

trollback/0

trollback() -> ok

Roll back the current transaction level and clear the transaction buffer (MUMPS: TRollback).

tstart/0

tstart() -> any()

Equivalent to tstart("").

tstart/1

tstart(Opt::tp_options()) -> ok

Start a new level of transaction (MUMPS: TStart @Opt).

unlock/1

unlock(Gvn) -> any()

Equivalent to unlock(Gvn, []).

unlock/2

unlock(Gvn::global_name(), Subs::subscripts()) -> ok

Unlock a subtree of global variable (MUMPS: Lock -@Gvn@(Subs)).

xecute/1

xecute(Mcode::string()) -> ok

Evaluate MUMPS code (MUMPS: Xecute Mcode). USE CAREFULLY!

xecute_fast_order/2

xecute_fast_order(Gvn, Subs) -> any()

XXX: Alternative egtm:order () experiment. XXX: Ensure it to run on the same egtm_worker

zkill/1

zkill(Gvn) -> any()

Equivalent to zkill(Gvn, []).

zkill/2

zkill(Gvn::global_name(), Subs::subscripts()) -> ok

ZKILL/ZWITHDRAW operation kills only specified node without affecting any of subnodes (MUMPS: ZKill @Gvn@(Subs)).

zversion/0

zversion() -> string()

Return GT.M version information (MUMPS: $Zversion).


Generated by EDoc, Aug 19 2012, 02:27:27.