Skip to content

Commit 654285f

Browse files
committed
docs: Define JSTable on-disk format
1 parent 6d4fa61 commit 654285f

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This stage will implement logging of all operations in ArgusDB to allow for faul
2727

2828
This stage will allow the data stored in memory to be dumped to disk to allow storage of large data sets, resulting in a two-level LSM tree.
2929

30-
- [] Define an on-disk format for JSTables in specs/storage.md including both the schema and the data
30+
- [x] Define an on-disk format for JSTables in specs/storage.md including both the schema and the data
3131
- [] When documents are inserted past the in-memory threshold, write a new JSTable to disk and start a new in-memory structure
3232

3333
# Stage 5 - LSM compaction

specs/storage.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@ A JSTable is like an SSTable, but stores semi-structured JSON data with an assoc
55

66
Each JSTable is stored in a single file.
77
This file must contain a JSON Schema as well as all the associated documents.
8-
Documents are compressed according to the schema.
9-
For example, if a field must be an integer, the type information need not be stored with each document.
10-
If a field can have multiple possible types, then the type information must be stored with each document.
8+
9+
The format is as follows:
10+
1. The schema, serialized as JSON, followed by a newline.
11+
2. A sequence of records, one per line. Each record is a JSON array `[id, document]`.
12+
13+
Example:
14+
```
15+
{"type":"object","properties":{"a":{"type":["integer"]}}}
16+
["01H4J3J4J3J4J3J4J3J4J3J4J3", {"a": 1}]
17+
["01H4J3J4J3J4J3J4J3J4J3J4J4", {"a": 2}]
18+
```
19+
20+
## Compression
21+
22+
Documents are stored as full JSON objects. This means that no compression is currently applied.
23+
Future versions of the format might include schema-based compression. For example, if a field must be an integer, the type information need not be stored with each document. If a field can have multiple possible types, then the type information must be stored with each document.
24+
1125

1226
# Compaction

0 commit comments

Comments
 (0)