mgo toolset - modrpc/info GitHub Wiki

The MGO toolset (mgo) contains tools which is used to compile ModGo modules into Go packages. Also, it can be used to used to create, update, and delete ModGo nodes. Finally, it allows to start, kill, suspend, resume, and monitor nodes.

ModGo Module Compiler

Transformation of ModGo modules

Usage:

mgo transform [arguments]

This command will compile ModGo (.mgo) programs into an instrumented Go program (.go). The argument can be ModGo files or directories that contain ModGo files. The package declaration will be maintained as it is. After this command generates legal Go programs, it is user's responsibility to compile and install the Go package. Also, the package can be uploaded to a code repository (such as github.com) and then downloaded to devices.

ModGo Module Management

Each device maintains module installations. A Go package, which was generated from a ModGo module, is eligible to be installed into a device. By installation, we mean that the Go package (in a local $GOPATH package directory or a remote repository) can be registered as a ModGo module in a module repository.

Installation of ModGo Module

A ModGo system maintains a code repository for building nodes. Each node, say node0 has a separate directory (say, $MGOROOT/smurfs/node0), which contains a set of ModGo modules, driver programs, and meta-information files. This code is enough to build executable for the given node.

mgo get modpath

List all ModGo modules installed.

mgo listmod 

Removing ModGo modules

mgo remove modname

ModGo Node Management

A ModGo node consists of ModGo modules. When a node is created, modules can be added/removed.

Listing all ModGo nodes

To list all the nodes created on this host, use the following comment.

mgo ls

Show details of ModGo node

To see details of the specific node use the following command. It lists all modules included in the given module, parameter values, etc.

mgo view node

Creating a ModGo Node

When a new node is created, it will contain no modules inside -- hence no resources.

mgo new nodename

Adding/Removing modules

One can add or remove modules in a node.

mgo add nodename modname [instname]
mgo rm nodename modname

Node Deployment

Deploy a node to a device

mgo deploy nodename device

Sometimes, a device may not be capable enough to contain all the modules, go system, or ModGo toolset. In such cases, one can develop a node in another device and deploy just the node (which is an executable) to the target device. For now, we assume both the development device and target device has the same platform.

Run-time Node Management

List running nodes

mgo stat nodename

Run the specified node.

mgo run nodename [options]

There are several options.

  • -parent parentnode: This node will attach itself as a child node of parentnode. Other nodes can access the resource of the node also through its parent node. This effectively can be used to dynamically extend the capability (resources) of the parent node. When there is a name conflict between the resources in the parent and the child, such child resource will not be able to be accessed through its parent. All child nodes can be accessed using the original name.
  • -port portnum: The node will use the given port as the RPC address.
  • -unix path: The node will use the given UNIX path as RPC address.
  • -prefix prefix: Rename the all resources using the given prefix. This option is useful in avoiding resource name conflicts -- e.g. between different nodes, in particular, when a node is attached to a parent.
  • -param modname.paramname=value: sets the parameter value of the specified module

Restart node.

mgo restart <nodename>

Save node

mgo save nodename [savename]

Save the current values of properties, etc. of the given node. When savename is given, this name can be used as an handle to the saved snapshot and be used to restore it later.

Restore node

mgo restore nodename [savename]

Restore the values of properties, etc. (using the given savename).

  • Kill node
mgo kill <nodename>

All attached nodes will get killed.

⚠️ **GitHub.com Fallback** ⚠️