GithubHelp home page GithubHelp logo

tempbottle / nanoconfig Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nanomsg/nanoconfig

0.0 2.0 0.0 264 KB

The configuration service for nanomsg, eventually to be included into mainline

License: MIT License

CMake 0.81% C 93.70% C++ 5.50%

nanoconfig's Introduction

Welcome to nanoconfig

nanoconfig is a small wrapper on top of nanomsg that lets admins configure nanomsg sockets without programmers intervention.

The goal for nanoconfig is to be enventually included into nanomsg itself.

API

Any nanomsg socket can be configured with nanoconfig. To do this, instead of calling nn_bind() and nn_connect() and setting various socket options do single nc_configure() call. For example:

#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
#include <nanomsg/nanoconfig.h>

s = nn_socket (AF_SP, AF_SP_RAW)
assert (s >= 0)
rc = nc_configure(s, "nanoconfig://topology1")
assert (rc >= 0)
...
nc_close (s);

Note: instead of raw nn_close from nanomsg you must call nc_close from nanoconfig, so that nanoconfig can free it's own resources.

Environment

You should set the address of configuration service using environment variable. For example, if you have your_app binary application:

NN_CONFIG_SERVICE=ipc:///var/run/name_service.sock your_app

To have system-wide configuration service you might want to add /etc/profile.d/nanoconfig.sh with the following contents:

NN_CONFIG_SERVICE=ipc:///var/run/name_service.sock
export NN_CONFIG_SERVICE

Command-Line

There are two command-line programs, that are useful for debugging and experimentation with nanoconfig:

  • nccat is just same utility the nanocat is but instead of --bind and --connect options it has --topology option
  • ncdev is a thin wrapper around nn_device that should transparently join the topology

Configuration Services

There is a very dumb configuration service in examples directory. You can run it with:

cd examples
python2 ns.py

See examples/README.rst for list of dependencies.

More configuration service implementation will be listed later.

See Also

nanomsg website: http://nanomsg.org

nanoconfig's People

Contributors

djc avatar tailhook avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.