{ "info": { "author": "Dan Brooks", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries" ], "description": "# MiniBus\n\nMiniBus is an interprocess communication library for rapid prototyping complex software built using a service-oriented architecture design. \nSimilar functionality can be found in tools such as [ICE](www.zeroc.com/ice.html), [LCM](https://lcm-proj.github.io/), and [ROS](www.ros.org).\nMiniBus has been optimized to have a\n* highly flexible protocol \n* simple client API\n* minimal dependencies\n* easy to embed in existing projects\n\nMinibus is currently only available in Python, however its simple design should allow it to be easily ported into other languages.\n\n## Overview\nConceptually, a MiniBus network consists of a group of independent and loosely associated processes called *Clients* that can communicate with each other by passing messages (even between different machines). \nSuch messages are broadcast over named channels called *Topics*.\nWhen one Client *Publishes* (sends) a message over a Topic, any other Clients *Subscribing* (listening) to that Topic will receive the message.\nThis is called a Publish/Subscribe model, in which information must pushed from the sender to the receiver.\n\nMiniBus also defines a remote procedure call (RPC) interface known as *Services* which allows MiniBus Clients known as *Service Clients* to call functions running on other MiniBus Clients known as *Service Servers*.\n*Service Servers* advertise their functions by assigning them names which can be used by *Service Clients* to map local functions to the remote ones.\nThis is called a Request/Reply model, in which information from the server is polled by the client. \n*Services* are implemented using *Topics*.\n\n### Topics\nWhen a *client* publishes a message on MiniBus, it must specify a name for the topic it will be published on.\nWhen a different *client* wishes to receive that same message, it must specify that it wants to listen to the topic of the same name.\n\n#### Message Schema (Types)\nAny data structure which can be serialized into JSON can be sent over Minibus. \nMiniBus topics do not have any particular message type associated with them.\nInstead, each client that connects to a topic as a publisher or subscriber can specifies a message schema (or data format) they expect messages to be in.\nMessage schema are in the form of JSON Schema, and can be as generic or specific as you wish.\nFor example, the schema ``{ }`` will accept all messages while the schema ``{\"type\": \"string\"}`` accepts only strings.\nFor more information on writing schema, check out [json-schema.org](www.json-schema.org).\n\n#### Topic Names and Namespaces\nTopic names are formatted using namespaces.\nA namespace is similar to a unix file system directory.\nAll topics must begin with a forward slash ``/`` followed by some name. \nThese names would make up the *root namespace*.\nAdding additional forward slashes ``/`` adds a sub namespace.\n\nNamespaces are purely for organizational purposes and do not have any other special function inside MiniBus.\nHowever, *subscribers* can use regular expressions to listen to multiple topics at the same time, and namespaces make it easy to leverage this feature.\n\nSome topic names can have special meanings. \nFor example, names that start and end with a double underscore are not displayed by the ``mbtt`` tool (e.g. ``__hidden_topic__``).\nThis convention does not hide topics from other client, rather it is mostly used to mask internal components of the minibus system. \n\n### Services\nServices use the same naming conventions and message schema concepts as topics, and make use of topic namespaces.\nA service is specified by a name and two schemas - one defining parameters (arguments) being passed to the service and one defining the return value.\nService requests are tied directly to reply messages, so when multiple clients are connected to a single *service server* only the calling client will receive the corresponding reply message.\n\n#### Services Over Topics\nServices are implemented using MiniBus topics.\nThe service name is used to specify a topic namespace under which three well-known topics are automatically created.\nOne topic (``__request__``) is used for *calling* the service and sending parameters to be used for execution.\nIf the service finishes executing normally and returns a value, this is passed back to the calling client on the ``__reply__`` topic.\nOtherwise, if an exception occurs while executing the service, the error message is returned to the calling client on the ``__error__`` topic.\nThis implementation is abstracted by the client interface.\n\n## Python API\n\nThere are currently two Python implementations of the MiniBusClientAPI - a threaded socket version and a Twisted version.\n\n```\nclass MiniBusClientAPI(object):\n \"\"\" Defines the public API for interacting with the minibus \"\"\"\n def __init__(self, name, cryptokey=None):\n\n def publisher(self, topic_name, data_format):\n\n def subscribe(self, name_pattern, data_format, callback, headers=False):\n\n def unsubscribe(self, name_pattern, callback):\n\n def service_client(self, name, reqst_schema, reply_schema, reply_cb, err_cb):\n\n def service_func_client(self, name, reqst_schema, reply_schema):\n \"\"\" Returns a function that behaves like a local function.\n retval = proxyfunc(params)\n \"\"\"\n\n def service_func_server(self, name, reqst_schema, reply_schema, func):\n \"\"\" Provides a named network service linked to a local function.\n my_func(params...)\n Client receives the value returned by the function.\n This is a convenience function that wraps the functionality of service_server()\n around a single function which returns a value to be sent back to the client.\n \"\"\"\n\n def service_server(self, name, reqst_schema, reply_schema, func):\n \"\"\" Provides a named network service. Service work is received by the\n func parameter, including an srvid value and received parameters.\n The srvid value is used to identify the client's \"work order\" information\n and must be passed to one of the two reply functions.\n Service returns value to client when a value is passed to either\n service_server_return() or service_server_error().\n \"\"\"\n\n def service_server_return(self, srvid, value):\n \"\"\" Used by a service server to send a return value to a service client \"\"\"\n\n def service_server_error(self, srvid, value):\n \"\"\" Used by a service server to send an error value to a service client \"\"\"\n```\n\n## Bus Protocol\nThe current version of MiniBus sends all messages over Multicast UDP at address ``228.0.0.5:8005``.\nFuture versions of the protocol are planned to use a combination of Multicast UDP, TCP, and IPC. \n\n### Message format\nMessages are passed between clients formatted in serialized JSON *packets* defined by a *bus schema*.\nThe bus schema defines a *packet* to contain a *header* object and a *data* field. \nThe *header* is a JSON object consisting of the topic name as a string.\nThe *data* field contains a string with the message as a serialized JSON object inside it. \n\n## Dependencies\nThese python dependencies are all available in pip, apt, and macports repositories (although they may be under different names)\n\n* ``python 2.7``\n* ``jsonschema``\n* ``netifaces``\n* ``Twisted`` (optional: for Twisted client)\n* ``gnupg`` (optional: for encryption)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mrdanbrooks/minibus", "keywords": "minibus,publish/subscribe,ipc,development", "license": "Apache v2.0", "maintainer": null, "maintainer_email": null, "name": "minibus", "package_url": "https://pypi.org/project/minibus/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/minibus/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mrdanbrooks/minibus" }, "release_url": "https://pypi.org/project/minibus/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "MiniBus IPC Library", "version": "0.3.0" }, "last_serial": 1740206, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "4ae64ca7cffd9e155eaf785ea2baaf49", "sha256": "e1098a79bc24142f7f6e0364bf745fed8494596623716ecb4ec8293d8c014e70" }, "downloads": -1, "filename": "minibus-0.3.0.tar.gz", "has_sig": false, "md5_digest": "4ae64ca7cffd9e155eaf785ea2baaf49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33559, "upload_time": "2015-09-26T23:45:14", "url": "https://files.pythonhosted.org/packages/a0/02/a5b54cf5b449a3d9f41ac53e3a381968d442b22de222c82ba91764142f7f/minibus-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ae64ca7cffd9e155eaf785ea2baaf49", "sha256": "e1098a79bc24142f7f6e0364bf745fed8494596623716ecb4ec8293d8c014e70" }, "downloads": -1, "filename": "minibus-0.3.0.tar.gz", "has_sig": false, "md5_digest": "4ae64ca7cffd9e155eaf785ea2baaf49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33559, "upload_time": "2015-09-26T23:45:14", "url": "https://files.pythonhosted.org/packages/a0/02/a5b54cf5b449a3d9f41ac53e3a381968d442b22de222c82ba91764142f7f/minibus-0.3.0.tar.gz" } ] }