zhida / ubf Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ubf/ubf
Universal Binary Format
Home Page: http://www.sics.se/~joe/ubf/site/home.html
License: MIT License
This project forked from ubf/ubf
Universal Binary Format
Home Page: http://www.sics.se/~joe/ubf/site/home.html
License: MIT License
This is UBF, a framework for Getting Erlang to talk to the outside world. This repository is based on Joe Armstrong's original UBF code with an MIT license file added to the distribution. Since then, a large number of enhancements and improvements have been added. What is UBF? ============ UBF is the "Universal Binary Format", designed and implemented by Joe Armstrong. See http://www.sics.se/~joe/ubf.html for full details. A really short summary: * UBF(A) is a protocol above a stream transport (e.g. TCP/IP), for encoding structured data roughly equivalent to well-formed XML. * UBF(B) is a programming langauge for describing types in UBF(A) and protocols between clients and servers. This layer is typically called the "protocol contract". All data sent by both the client and the server is verified by the contract manager (an Erlang process on the "server" side of the protocol). Any data that violates the contract is UBF(B) is roughly equivalent to to Verified XML, XML-schemas, SOAP and WDSL. * UBF(C) is a meta-level protocol used between a UBF client and a UBF server. To build ======== 1. Get and install an erlang system http://www.erlang.org 2. Change to the src directory and type make $ cd src $ make 3. Run the unit test $ make check 4. To build the Java client and run its encoding/decoding unit test: $ cd priv/java $ make 5. The Python client depends on the "py-interface" library. To clone and build it, use: $ cd /some/place/else $ git clone git://repo.or.cz/py_interface.git $ cd py_interface $ autoconf $ make Then install as a normal Python package or run using "env PYTHONPATH=/path/to/py_interface python your-script.py" Documentation -- Where should I start? ====================================== This README is a good first step. Check out and build using the "To build" instructions above. The documentation is in a state of slow improvement. Contributions from the wider world are welcome. :-) One of the better places to start is to look in the "edoc" directory. See the "Reference Documentation" section for suggestions on where to find greater detail. The unit tests in the "src/Unit-Test-Files" directory provide small examples of how to use all of the public API. In particular, the *client*.erl files contain comments at the top with a list of prerequisites and small examples, recipe-style, for starting each server and using the client. The eunit tests in the "src/Unit-EUnit-Files" directory perform several smoke and error handling uses cases. The original documentation is in the "priv/doc" directory. The #1 most frequently asked question is: "My term X fails contract Y, but I can't figure out why! This X is perfectly OK. What is going on?" See the the EDoc documentation for the contracts:checkType/3 function. What is EBF? ============ EBF is an implementation of UBF(B) but does not use UBF(A) for client<->server communication. Instead, Erlang-style conventions are used instead: * Structured terms are serialized via the Erlang BIFs term_to_binary() and binary_to_term(). * Terms are framed using the 'gen_tcp' {packet, 4} format: a 32-bit unsigned integer (big-endian?) specifies packet length. +-------------------------+-------------------------------+ | Packet length (32 bits) | Packet data (variable length) | +-------------------------+-------------------------------+ The name "EBF" is short for "Erlang Binary Format". What about JSF and JSON-RPC? ============================ See the ubf-jsonrpc open source repository http://github.com/norton/ubf-jsonrpc for details. ubf-jsonrpc is a framework for integrating UBF, JSF, and JSON-RPC. What about TBF and Thrift? ========================== See the ubf-thrift open source repository http://github.com/norton/ubf-thrift for details. ubf-thrift is a framework for integrating UBF, TBF, and Thrift. What about ABNF? ================ See the ubf-abnf open source repository http://github.com/norton/ubf-abnf for details. ubf-abnf is a framework for integrating UBF and ABNF. What about EEP8? ================ See the ubf-eep8 open source repository http://github.com/norton/ubf-eep8 for details. ubf-eep8 is a framework for integrating UBF and EEP8. What's New? in tag v1.13 (08 May 2010) ====================================== The last tag, v1.12, was created on 11 April 2009. Joe's Github repo has had over 130 commits in the 13 months that v1.12 was tagged. The number of differences are ... too large to enumerate, sorry. Gemini Mobile has a custom Webmail system in production now for a production system in Asia that is serving well over 1 million users. UBF contracts are heavily used in all major parts of the system. Most heavily used are the EBF and JSON-RPC transports. See the presentation slides by Scott Lystig Fritchie and Joe Norton at the Erlang Factory San Francisco 2010 conference at: http://www.erlang-factory.com/conference/SFBay2010/speakers/ScottLystigFritchie http://www.erlang-factory.com/upload/presentations/242/ErlangFactorySFBay2010-ScottLystigFritchieandJosephWayneNorton.pdf The Java client has been neglected for years. Recent fixes to the encoder/decoder make it possible to handle "modern" UBF contracts that. No work has been done to optimize the Java client for speed, but it is now able to handle contracts that use Erlang binary() and signed integers that fit into 63 bits. Experimenal support has been added for the Thrift protocol as the transport & session layers. To do (in short term) ===================== - cleanup (or remove) old documentation under priv/doc - document new features + predefined ubf contract (and contract checker) primitives - atom(), binary(), float(), integer(), list(), proplist(), string(), term(), tuple(), void() - atom(ascii), atom(asciiprintable), atom(nonempty), atom(nonundefined), atom(ascii,nonempty), atom(ascii,nonundefined), atom(asciiprintable,nonempty), atom(asciiprintable,nonundefined), atom(ascii,nonempty,nonundefined), atom(asciiprintable,nonempty,nonundefined) - binary(ascii), binary(asciiprintable), binary(nonempty), binary(ascii,nonempty), binary(asciiprintable,nonempty) - list(nonempty) - proplist(nonempty) - string(ascii), string(asciiprintable), string(nonempty), string(ascii,nonempty), string(asciiprintable,nonempty) - term(nonempty), term(nonundefined), term(nonempty,nonundefined) - tuple(nonempty) - ascii: all items in atom name/string/binary are ASCII values - asciiprintable: all items in atom name/string/binary are printable ASCII values - nonempty: not equal to '', [], <<>>, or {} - nonundefined: not equal to 'undefined' - type()? for optional types - type(){0} for undefined types + user-defined ubf contract (and contract checker) primitives - atom(), binary(), float(), integer(), and string() constants - #record syntax, ##extended_record syntax with automatic erlang record defines - integer ranges (min..max, ..max, min..) - erlang-based syntax for integers - [type()]? for optional lists - [type()]+ for mandatory lists - [type()]{N}, [type()]{N,}, [type()]{M,N} for length-constrained lists + ubf contract type imports + ubf server and ubf client + stateless server w/simplified plugin handler callbacks - For protocols that do not require state transitions: a single state called ANYSTATE is used for the contract, and the implementation callback function API is a bit less complex. + async events from client to server - plus misc. changes for existing async events from server to client + transaction logger + network and rpc formats * ebf - Erlang Binary Format * etf - Erlang Term Format * jsf - Java Script Format * tbf - Thrift Binary Format + ??? To do (in medium term) ====================== - add more Thrift (http://incubator.apache.org/thrift/) support * Compact Format - add Avro (http://hadoop.apache.org/avro/) support - add Google's Protocol Buffers (http://code.google.com/apis/protocolbuffers/) support - add Bert-RPC (http://bert-rpc.org/) support * BERT-RPC is UBF/EBF with a specialized contract and plugin handler implementation for BERT-RPC. UBF/EBF already supports all of the BERT data types. * UBF is the text-based wire protocol. EBF is the binary-based wire protocol (based on Erlang's binary serialization format). - ??? To do (in long term) ==================== - support multiple listeners for a single ubf server - open-source ubf contract generators for QuickCheck - n-bidirectional requests/responses over single tcp/ip connection (similiar to smpp) - replace plugin manager and plugin handler with gen_server-based implementation - enable/disable contract checker by configuration - quickcheck tests Credits ======= Many, many thanks to Joe Armstrong, UBF's designer and original implementor. Gemini Mobile Technologies, Inc. has approved the release of its extensions, improvements, etc. under an MIT license. Joe Armstrong has also given his blessing to Gemini's license choice.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.