aboutsummaryrefslogtreecommitdiffstats
path: root/notes/sleep.md
blob: d13a489edf469b33f1f8804b70974e380bde206e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

### Binary Header 

Fixed 32-bytes

    -----------------------------------------------------------------
    |                             MAGIC                             |
    -----------------------------------------------------------------
    |  VERSION (0)  |      ENTRY SIZE (uint16BE)    | ALGO NAME LEN |
    -----------------------------------------------------------------
    |                                                               |
    |                                                               |
    |                                                               |
    |                 ALGORITHM NAME (lower-case string)            |
    |                                                               |
    |                                                               |
    -----------------------------------------------------------------


    PREFIX LEN is max 24 (bytes)

    offset: 32 + entrySize * entryIndex
    count: (fileSize - 32) / entrySize


### SLEEP API

    SleepStorage trait
    SleepFile struct/impl

    get_magic() -> u32
    get_algorithm() -> &str
    read(index) -> &bytes[]
    write(index, &bytes[])
    length() -> u64

    First time around just do regular file seek() stuff