aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--notes/register.md38
-rw-r--r--notes/sleep.md2
2 files changed, 31 insertions, 9 deletions
diff --git a/notes/register.md b/notes/register.md
index f036543..1bc7055 100644
--- a/notes/register.md
+++ b/notes/register.md
@@ -1,22 +1,44 @@
-### SLEEP File Types
+### Register File Types
- key
- no header, raw bytes
- tree
+ tree: SLEEP merkel tree
magic: 0x05025702
entry-size: 40 bytes
algorithm name: 'BLAKE2b' (len=7)
entry: 32-byte BLAKE2b node hash + 8-byte Uint64BE length
- data
- no header, raw bytes
- signatures
+ signatures: SLEEP array
magic: 0x05025701
entry-size: 65
algorithm name: 'Ed25519' (len=7)
entry: 64-byte Ed25519 signature
- bitfield
+ bitfield: SLEEP array of bitfields
magic: 0x05025700
entry-size: 3328
algorithm name: '' (len=0)
entry: 1024 bytes data, 2048 bytes tree, 256 bitfield
+ key: public key
+ no header, raw bytes
+ data
+ no header, raw bytes, concatonated
+
+### Register API
+
+ SleepDirectoryRegister struct
+ open(directory, prefix)
+ create(directory, prefix, options)
+
+ file handles for tree, sig, bitfield, data; key is write-once
+
+ has(index) -> bool
+ has_all() -> bool
+ has_range(start, end) -> bool
+ get(index) -> data (arbitrary length)
+ append(entry) -> index written
+ len() -> u64
+ len_bytes() -> u64
+ verify() -> bool (verifies merkel tree against data, and signatures)
+ check() -> bool (quick consistency check of lengths, etc)
+ writable() -> bool
+
+ read_block(start, end) -> read api implementer
+
diff --git a/notes/sleep.md b/notes/sleep.md
index 5fe5d10..600b5c7 100644
--- a/notes/sleep.md
+++ b/notes/sleep.md
@@ -36,6 +36,6 @@ Fixed 32-bytes
get_algorithm() -> &str
read(index) -> &bytes[]
write(index, &bytes[])
- length() -> u64
+ len() -> u64
First time around just do regular file seek() stuff