sugo-module-noop
NOOP module for SUGOS
Last updated 9 months ago by realglobe .
Apache-2.0 · Repository · Bugs · Original npm · Tarball
$ cnpm install sugo-module-noop 
SYNC missed versions from official npm registry.

sugo-module-noop

Build Status npm Version JS Standard

NOOP module for SUGOS

This is a stub module for testing purpose. ("noop" stands for "No-Operation")

It has only few basic methods.

Installation

$ npm install sugo-module-noop --save

Usage

Register a module to actor.

#!/usr/bin/env node

/**
 * Example usage to register module on actor
 * @see https://github.com/realglobe-Inc/sugo-actor
 */
'use strict'

const sugoModuleNoop = require('sugo-moduel-noop')
const sugoActor = require('sugo-actor')
const co = require('co')

co(function * () {
  let actor = sugoActor('http://my-sugo-cloud.example.com/actors', {
    key: 'my-actor-01',
    modules: {
      // Register the module
      noop: sugoModuleNoop({})
    }
  })
  yield actor.connect()
}).catch((err) => console.error(err))

Then, call the module from a remote caller.

#!/usr/bin/env node

/**
 * Example to call from caller
 * @see https://github.com/realglobe-Inc/sugo-caller
 */
'use strict'

const co = require('co')
const assert = require('assert')
const sugoCaller = require('sugo-caller')

co(function * () {
  let caller = sugoCaller('http://my-sugo-cloud.example.com/callers', {})
  let actor = caller.connect('my-actor-01')

  // Access to the interface
  let noop = actor.noop()

  // Send ping
  let pong = yield noop.ping()
  assert.ok(pong)

// Just ping-pong, nothing more
}).catch((err) => console.error(err))

Methods

The following methods are available from remote terminals for the interface.

.ping(pong) -> string

Test the reachability of a module.

Param Type Description
pong string Pong message to return

.assert() -> boolean

Test if the spot fulfills system requirements

License

This software is released under the Apache-2.0 License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |