Page tree

Marvin Live storage plugins automatically save snapshots to databases added in version 16.9.26. These plugins are NodeJS modules, stored in a folder set by Marvin Live's configuration file.

Prerequisites

  • an instance of Marvin Live available for development purposes, i.e.: the ability to stop and start it, to try different configuration options

  • familiarity with JavaScript, NodeJS and its module system

Storage plugins

This plugin type is intended to save important information from a discussion room, to a shared idea database.

Life-cycle

Marvin Live scans the services directory to find all storage plugins and loads them on start. There is 1 instance of a plugin per room.

Specification

Export plugins are NodeJS modules , denoted by their filename: *.storage.js and the location in the services directory as configured during installation.

An export plugin exports the following required properties:

 

 

Name

Type

Description

namestringUnique identifier of the plugin, used by Marvin Live for identification and internal communication. If multiple plugins use the same identifier, the last one to be loaded overrides the others.

insertSnapshot

function

The main function of the plugin, called when chemists save a snapshot, once for each snapshot. The function should have a void return type.

Arguments:

  • snapshot (Object) data structure containing chemical structure and metadata. See specification below.

  • this includes domain, roomName and URL for this room

Required: yes

updateSnapshot

function

Called when chemists change the metadata of a snapshot, once for each change. The function should have a void return type.

Arguments:

  • snapshot (Object) data structure containing structures and comments. See specification below.

  • this includes domain, roomName and URL for this room

Required: no

domains

array of strings

List of domains where this plugin may be used, when authentication is enabled in Marvin Live. Use * to allow any domain. If no authentication is setup, this option has no effect. To query the configured domains, send a GET request to /domains or open /domains in your browser.

enablePrivateDataStorage

boolean

Configures the application to enable this plugin in rooms that are set to private. Private rooms are visible only to their owner and those invited.

Required: no

Default: false

Snapshot data specification

Below is an example of a snapshot object, with inline description of the individual attributes.  

{
    //String, mrv source of the chemical structure
    "structure": "<cml><MDocument>...</MDocument></cml>",
    //String, base64 encoded PNG image at 500x400
    "image": "data:image/png;base64,iVBORw0KG...5CYII=",
    //String, display name of the author of this structure
    "author": "Susan",
    //Number, millisecond resolution UNIX timestamp of the authoring
    //of this structure
    "timestamp": 1436786661609,
    //String, uploaded or drawn, indicates the source of this item
    "type": "drawn",
    //String, action item given when making this snapshot
    "task": "check IP by Friday",
    //Object, key-value data returned by real time plugins for "reports"
    "data": {
        //key: String, label of real time plugin
        //value: Object, key-value pairs of data returned
        "Calculated Properties": {
         "Mass": 344.43,
         "cLogP": 1.74
        }
    }
}

 

Examples

You can find a brief selection of plugins in our Github repository for: Oracle, JChem Oracle Cartridge, Postgres, JChem Postgres Cartridge and MySQL.