aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md115
1 files changed, 115 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f5302a8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,115 @@
1# Generalized Agile Transport System (GATS)
2
3GATS is a data encoding format, as well as a set of libraries for reading and
4writing data in that format. It's a structured format reminiscent of a binary
5json, but with some extra cool features.
6
7 * All numbers (integers and floating point) are stored in an arbitrary
8 precision format which takes up the least amount of space it can.
9 * Unlike textual formats (like json, xml, etc.) floating point numbers are
10 stored exactly, the exact number you write in is the exact number you read
11 out.
12 * All formats stored are machine independent, you can read and write them on
13 any architecture, any endianness and they will always be the same. No more
14 encoding worries.
15 * There are a number of data types you can use to make up data structures:
16 * Dictionaries
17 * Lists
18 * Integers
19 * Floats
20 * Strings (binary 8-bit strings, perfect for UTF-8)
21 * Booleans
22 * Nulls
23
24# License
25
26GATS is distributed under a new-BSD type license. This is fairly permissive,
27but if you require other licensing options feel free to contact us.
28
29# Uses
30
31GATS was originally intended for use in internet protocols, and is great for
32that purpose. Used correctly it allows you to create efficient yet highly
33malleable protocols with very little extra effort.
34
35However, you can certainly use it for other purposes such as serializing data
36for storage, and inter-process communication. In fact, with the different
37language bindings available, sometimes GATS may be one of the easier ways to
38allow, say, a PHP web service to communicate with a custom C++ executable or
39python program.
40
41# Languages/Libraries Supported
42
43At the moment we actively maintain libraries for C++, java, php, and python.
44Other languages and libraries are welcomed. Here's a little info on each
45target directory:
46
47 * ''c++-libbu++'' - The original libgats implementation. Works using libbu++
48 data types and streams. You need to have libbu++ and Xagasoft build in
49 order to build this version.
50 * ''c++-qt'' - A version written using Qt data types. This version builds using
51 qmake, so if you're using Qt you already have everything you need. Also
52 features handy signals & slots to make event driven networking even easier!
53 * ''java'' - A library using the Java native interfaces, everything looks and
54 works exactly how you would expect it should. There is a Xagasoft Build
55 script to build a jar file, but it's simple enough that a single javac
56 command can build it all, or just import the code into your project directly.
57 This java version has been used on desktops and android devices.
58 * ''php'' - There are two libraries for working with php, the first defines a
59 set of classes for fine control over the format, sometimes this is necessary
60 as php's types are a little loose. The second simply uses php native types
61 like array() as data transport. The second option is usually the much easier
62 to use, but doesn't always get the encoding correct for all inputs.
63 * ''python'' - These work like other serialization mechanisms in Python like
64 pickle, json, shelve, and marshal. It exposes the functions load, dump,
65 loads, dumps, and also the handy helpers recv and send for working with
66 sockets. The Python implementation returns and transmits native Python
67 data types, which makes life pretty easy. To use this version simply copy
68 gats.py to your project.
69
70# Basic Operation
71
72The way GATS works is dictated by the format, so it works similarly in every
73implementation, although they each have slightly different mechanics. When
74encoding GATS you always encode each object in it's own "GATS packet." A GATS
75packet has a very simple header which includes the size of the packet to make
76parsing fast and efficient.
77
78Each packet can contain a single root object. It can be any type, but for most
79protocols a dictionary is a great choice for the root object.
80
81The format is designed to make it very easy to work with various encoding,
82packing, and encryption systems. The reader, by default, will skip all leading
83zero bytes that come before a valid GATS packet, and will stop processing
84precisely at the end of a valid GATS packet.
85
86Skipping leading zeros makes it easy to work in environments where padding may
87be required. You can use the simplest of all padding schemes (pad with zeros)
88and it will work seamlessly with GATS.
89
90Since the reader always reads exactly the number of bytes it needs, it's very
91easy to embed GATS packets in other streams, or read them sequentially as fast
92as you can from a socket.
93
94## A Note About Strings
95
96All strings in GATS are simply sequences of 8-bit bytes. There is no
97overarching encoding that is dictated by the format. When using GATS it is
98good to specify how you are encoding your text data, we recommend Unicode.
99There is a possibility that a future version of GATS will include a separate
100Unicode String data type, but for now it's important to remember this.
101
102For this reason, we also recommend making the keys in all dictionaries 7-bit
103UTF-8 compatible ASCII/Latin1. This isn't required of course, but it makes
104things a bit easier.
105
106# Speed vs Size
107
108GATS objects are, on average, smaller than storing in other binary formats, and
109can be much smaller than textual formats by virtue of storing only as many
110bytes as necessary for integers and floats. This also means that GATS requires
111more processing than fixed field binary formats, but interestingly not quite as
112much as text formats like json. The processing we do on floats is actually
113roughly comparable in many ways to text processing, although with fewer steps.
114
115