diff options
Diffstat (limited to 'src/docs/packing.dox')
-rw-r--r-- | src/docs/packing.dox | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/docs/packing.dox b/src/docs/packing.dox new file mode 100644 index 00000000000..7723e21bc79 --- /dev/null +++ b/src/docs/packing.dox @@ -0,0 +1,35 @@ +/*! @page packing Packing and Unpacking Data + +WiredTiger's data packing uses format strings similar to those specified in the +Python struct module: + http://docs.python.org/library/struct + +The first character of the format string can be used to indicate the byte +order, size and alignment of the packed data, according to the following +table: + +<table> +@hrow{Character, Byte order, Size, Alignment} +@row{<tt>.</tt>, big-endian, packed, none} +@row{<tt>></tt>, big-endian, standard, none} +@row{<tt><</tt>, little-endian, standard, none} +@row{<tt>\@</tt>, native, native, native} +</table> + +If the first character is not one of these, '.' (big-endian, packed) is +assumed: it naturally sorts in lexicographic order, and the packed format +uses variable-sized encoding of values to reduce the data size. + +@notyet{format types} <b>Only the default big-endian, packed format is currently supported.</b> + +The remaining characters in the format string specify the type of each field to be packed into or unpacked from a byte array. See @ref schema_types for the list of supported types. + +@todo Describe the variable-length integer packing in sufficient detail that it can be re-implemented in other programming languages or in network clients. + +@section config_examples Code samples + +The code below is taken from the complete example program @ex_ref{ex_pack.c}. It demonstrates how to pack three integer values into a buffer and then unpack them again. + +@snippet ex_pack.c packing + + */ |