doc: update array data format, add mime type, change style of diagrams

This commit is contained in:
Artemy Egorov 2024-07-27 23:08:24 +03:00
parent a0f68c4a42
commit 90db2e6c73

View file

@ -2,27 +2,30 @@
DaletPack is an binary data format for Dalet, that is used for minimizing the size of transmitted daletl data. DaletPack is designed specifically to transfer as little data as possible, it compresses the declaration of tag types into the smallest possible volume. Nothing unnecessary is transferred. DaletPack is an binary data format for Dalet, that is used for minimizing the size of transmitted daletl data. DaletPack is designed specifically to transfer as little data as possible, it compresses the declaration of tag types into the smallest possible volume. Nothing unnecessary is transferred.
All data must be compressed in [Zstandard](https://datatracker.ietf.org/doc/html/rfc8878) format. All data must be compressed with [zstd](https://datatracker.ietf.org/doc/html/rfc8878).
Root data format is array of tags (see [Daletl specification](./daletl.md)), each element reads sequentially without type and size definition. Root data format is array of tags (see [daletl specification](./daletl.md)), each element reads sequentially. Type definition for root is not needed.
## Types (16) Mime type: `application/dalet-pack`
## Types
- **Null** - **Null**
- **Integer** - **Integer**
- **String** (6) - **String** (5)
- **Array** (5) - **Tag array**
- **Tags** (3) - **Tags** (4)
- **Tag only with id** - **Tag (id)**
- **Tag with id and body** - **Tag (id, body)**
- **Tag with id, body and argument** - **Tag (id, argument)**
- **Tag (id, body, argument)**
## Limitations ## Limitations
- a value of integer (4 bits) must be between 0 and 15 - a value of integer (4 bits) must be between 0 and 15
- maximum byte size of a String object is (2^32)-1 - maximum byte size of a String object is (2^32)
- string must be encoded in UTF-8 - string must be encoded in UTF-8
- maximum number of elements of an Array object is (2^32)-1 - maximum number of elements of a tag array object is (2^32)
## Formats ## Formats
@ -37,11 +40,8 @@ Root data format is array of tags (see [Daletl specification](./daletl.md)), eac
| str 8 | 4 | 0100 | | str 8 | 4 | 0100 |
| str 16 | 5 | 0101 | | str 16 | 5 | 0101 |
| str 32 | 6 | 0110 | | str 32 | 6 | 0110 |
| arr 3 | 7 | 0111 | | tag array | 7 | 0111 |
| arr 4 | 8 | 1000 | | tag array end | no | 10 |
| arr 8 | 9 | 1001 |
| arr 16 | 10 | 1010 |
| arr 32 | 11 | 1011 |
| tag (id) | 12 | 1100 | | tag (id) | 12 | 1100 |
| tag (id, body) | 13 | 1101 | | tag (id, body) | 13 | 1101 |
| tag (id, argument) | 14 | 1110 | | tag (id, argument) | 14 | 1110 |
@ -85,84 +85,64 @@ variable number of objects stored in DaletPack format:
### String format ### String format
```txt ```txt
str 3 (up to 7 bytes): str 3 (up to 8 bytes):
+--------+-----+========+ +--------+-----+=========+
| 0010 | XXX | data | | 0010 | XXX | utf-8 |
+--------+-----+========+ +--------+-----+========+
str 4 (up to 15 bytes): str 4 (up to 16 bytes):
+--------+------+========+ +--------+------+=========+
| 0011 | XXXX | data | | 0011 | XXXX | utf-8 |
+--------+------+========+ +--------+------+=========+
str 8 (up to 255 bytes): str 8 (up to 256 bytes):
+--------+----------+========+ +--------+----------+=========+
| 0100 | XXXXXXXX | data | | 0100 | XXXXXXXX | utf-8 |
+--------+----------+========+ +--------+----------+=========+
str 16 (up to 2^16-1 bytes): str 16 (up to 2^16 bytes):
+--------+----------+----------+========+ +--------+----------+----------+=========+
| 0101 | XXXXXXXX | XXXXXXXX | data | | 0101 | XXXXXXXX | XXXXXXXX | utf-8 |
+--------+----------+----------+========+ +--------+----------+----------+=========+
str 32 (up to 2^32-1 bytes): str 32 (up to 2^32 bytes):
+--------+----------+----------+----------+----------+========+ +--------+----------+----------+----------+----------+=========+
| 0110 | XXXXXXXX | XXXXXXXX | XXXXXXXX | XXXXXXXX | data | | 0110 | XXXXXXXX | XXXXXXXX | XXXXXXXX | XXXXXXXX | utf-8 |
+--------+----------+----------+----------+----------+========+ +--------+----------+----------+----------+----------+=========+
``` ```
### Array format ### Tag array format
```txt ```txt
arr 3 (up to 7 elements): tag array:
+--------+-----+~~~~~~~~+ +--------+~~~~~~~~~~~~+------+
| 0111 | XXX | data | | 0111 | elements | 10 |
+--------+-----+~~~~~~~~+ +--------+~~~~~~~~~~~~+------+
arr 4 (up to 15 elements):
+--------+------+~~~~~~~~+
| 1000 | XXXX | data |
+--------+------+~~~~~~~~+
arr 8 (up to 255 elements):
+--------+----------+~~~~~~~~+
| 1001 | XXXXXXXX | data |
+--------+----------+~~~~~~~~+
arr 16 (up to 2^16-1 elements):
+--------+----------+----------+~~~~~~~~+
| 1010 | XXXXXXXX | XXXXXXXX | data |
+--------+----------+----------+~~~~~~~~+
arr 32 (up to 2^32-1 elements):
+--------+----------+----------+----------+----------+~~~~~~~~+
| 1011 | XXXXXXXX | XXXXXXXX | XXXXXXXX | XXXXXXXX | data |
+--------+----------+----------+----------+----------+~~~~~~~~+
``` ```
### Tag format ### Tag format
```txt ```txt
Y = tag_id = XXXXX (5 bits) (can change before release) id = XXXXX (5 bits) (can change before release)
tag (id): tag (id):
+--------+---+ +--------+----+
| 1100 | Y | | 1100 | id |
+--------+---+ +--------+----+
tag (id, body): tag (id, body):
+--------+---+~~~~~~~~+ +--------+----+~~~~~~~~+
| 1101 | Y | body | | 1101 | id | body |
+--------+---+~~~~~~~~+ +--------+----+~~~~~~~~+
tag (id, argument): tag (id, argument):
+--------+---+~~~~~~~~~~~~+ +--------+----+~~~~~~~~~~~~+
| 1101 | Y | argument | | 1110 | id | argument |
+--------+---+~~~~~~~~~~~~+ +--------+----+~~~~~~~~~~~~+
tag (id, body, argument): tag (id, body, argument):
+--------+---+~~~~~~~~+~~~~~~~~~~~~+ +--------+----+~~~~~~~~+~~~~~~~~~~~~+
| 1111 | Y | data | argument | | 1111 | id | body | argument |
+--------+---+~~~~~~~~+~~~~~~~~~~~~+ +--------+----+~~~~~~~~+~~~~~~~~~~~~+
``` ```