MsgProcessing

Usage

use MsgProcessing;

or

import MsgProcessing;
const mpLogger = new Logger(logLevel, logChannel)
proc createMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws

Parse, execute, and respond to a create message

:arg : payload :type string: containing (dtype,size)

Arguments

st : borrowed SymTab – SymTab to act on

Returns

(MsgTuple) response message

proc createMsg0D(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws
proc deleteMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

Parse, execute, and respond to a delete message

Arguments
  • reqMsg : string – request containing (cmd,name)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc clearMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

Clear all unregistered symbols and associated data from sym table

Arguments
  • reqMsg : string – request containing (cmd)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc infoMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

Takes the name of data referenced in a msg and searches for the name in the provided sym table. Returns a string of info for the sym entry that is mapped to the provided name.

Arguments
  • reqMsg : string – request containing (cmd,name)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc getconfigMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

query server configuration…

Arguments
  • reqMsg : string – request containing (cmd)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc getmemusedMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

query server total memory allocated or symbol table data memory

Arguments
  • reqMsg : string – request containing (cmd)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc getmemavailMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

query server total memory availble

Arguments
  • reqMsg : string – request containing (cmd)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc getCommandMapMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab) throws
  • Generate the mapping of server command to function as JSON

  • encoded string.

  • The args are IGNORED. They are only here to match the CommandMap

  • standard function signature, similar to other procs.

  • arg cmd

    Ignored

  • type cmd

    string

  • arg payload

    Ignored

  • type payload

    string

  • arg st

    Ignored

  • type st

    borrowed SymTab

  • returns

    MsgTuple containing JSON formatted string of cmd -> function mapping

proc strMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

Response to __str__ method in python str convert array data to string

Arguments
  • reqMsg : string – request containing (cmd,name)

  • st : borrowed SymTab – SymTab to act on

Returns

(string,MsgType)

proc reprMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws

Response to __repr__ method in python. Repr convert array data to string

Arguments
  • reqMsg : string – request containing (cmd,name)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

proc setMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd = 1): MsgTuple throws

Sets all elements in array to a value (broadcast)

Arguments
  • reqMsg : string – request containing (cmd,name,dtype,value)

  • st : borrowed SymTab – SymTab to act on

Returns

MsgTuple

Throws

UndefinedSymbolError(name)