Continued with rewrites:
[core.git] / contrib / file_stack / format.txt
1 A file-based stack:
2 ===================
3
4 This is the format for a file-based stack which works as any other Stackable
5 class.
6
7 General made up:
8
9 Purpose: | "magic"   | separator | count    | separator | position | separator |
10 ---------+-----------+-----------+----------+-----------+------0---+-----------+
11 Bytes:   | 9         | 1         | 20 (hex) | 1         | 20 (hex) | 1         |
12 ---------+-----------+-----------+----------+-----------+----------+-----------+
13 Example: | STACKv1.0 | 01        | 00...ff  | 01        | 00...ff  | 02        |
14
15 Continued:
16
17 Purpose: | hash 0 | separator | name 0 | entry 0    | hash n | separator | name n | entry n    | EOF |
18 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
19 Bytes:   |  64    | 1         | 10     | 1-n (pack) |  64    | 1         | 10     | 1-n (pack) | 1   |
20 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
21 Example: | abc    |    03     | foo    |    ...     | abc    |    03     | bar    |     ...    | EOF |
22
23 Explanations:
24 -------------
25  magic        - Identifies the file and version of format
26  separator    - Serves to detect end of strings with unknown/flexible length
27  count        - Total amount of entries (not deleted) encoded in hexa-decimal
28  position     - Seek position of current entry (which current() will give)
29  hash X       - Hash sum of entry X (SHA 256)
30  name X       - Name of stack the entries belongs in
31  entry X      - The actual data, compressed with pack()
32  EOF          - End-of-file character
33  ...          - Data
34  ???          - Must be still found out which character/hashing algorthym fits best