Skip to content

Instantly share code, notes, and snippets.

@jimpick
Created September 6, 2018 18:04
Show Gist options
  • Save jimpick/54adc72f11f38f1fe4bc1d45d3981708 to your computer and use it in GitHub Desktop.
Save jimpick/54adc72f11f38f1fe4bc1d45d3981708 to your computer and use it in GitHub Desktop.
Roots for record 0 (stored at leaf 0): [ 0 ]
0: 0
Roots for record 1 (stored at leaf 2): [ 1 ]
0: 0─┐
1
1: 2─┘
Roots for record 2 (stored at leaf 4): [ 1, 4 ]
0: 0─┐
1
1: 2─┘
2: 4
Roots for record 3 (stored at leaf 6): [ 3 ]
0: 0─┐
1─┐
1: 2─┘ │
3
2: 4─┐ │
5─┘
3: 6─┘
Roots for record 4 (stored at leaf 8): [ 3, 8 ]
0: 0─┐
1─┐
1: 2─┘ │
3
2: 4─┐ │
5─┘
3: 6─┘
4: 8
Roots for record 5 (stored at leaf 10): [ 3, 9 ]
0: 0──┐
1──┐
1: 2──┘ │
3
2: 4──┐ │
5──┘
3: 6──┘
4: 8──┐
9
5: 10──┘
Roots for record 6 (stored at leaf 12): [ 3, 9, 12 ]
0: 0──┐
1──┐
1: 2──┘ │
3
2: 4──┐ │
5──┘
3: 6──┘
4: 8──┐
9
5: 10──┘
6: 12
Roots for record 7 (stored at leaf 14): [ 7 ]
0: 0──┐
1──┐
1: 2──┘ │
3──┐
2: 4──┐ │ │
5──┘ │
3: 6──┘ │
7
4: 8──┐ │
9──┐ │
5: 10──┘ │ │
11──┘
6: 12──┐ │
13──┘
7: 14──┘
Roots for record 8 (stored at leaf 16): [ 7, 16 ]
0: 0──┐
1──┐
1: 2──┘ │
3──┐
2: 4──┐ │ │
5──┘ │
3: 6──┘ │
7
4: 8──┐ │
9──┐ │
5: 10──┘ │ │
11──┘
6: 12──┐ │
13──┘
7: 14──┘
8: 16
Roots for record 9 (stored at leaf 18): [ 7, 17 ]
0: 0──┐
1──┐
1: 2──┘ │
3──┐
2: 4──┐ │ │
5──┘ │
3: 6──┘ │
7
4: 8──┐ │
9──┐ │
5: 10──┘ │ │
11──┘
6: 12──┐ │
13──┘
7: 14──┘
8: 16──┐
17
9: 18──┘
Roots for record 10 (stored at leaf 20): [ 7, 17, 20 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7
4 : 8──┐ │
9──┐ │
5 : 10──┘ │ │
11──┘
6 : 12──┐ │
13──┘
7 : 14──┘
8 : 16──┐
17
9 : 18──┘
10: 20
Roots for record 11 (stored at leaf 22): [ 7, 19 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7
4 : 8──┐ │
9──┐ │
5 : 10──┘ │ │
11──┘
6 : 12──┐ │
13──┘
7 : 14──┘
8 : 16──┐
17──┐
9 : 18──┘ │
19
10: 20──┐ │
21──┘
11: 22──┘
Roots for record 12 (stored at leaf 24): [ 7, 19, 24 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7
4 : 8──┐ │
9──┐ │
5 : 10──┘ │ │
11──┘
6 : 12──┐ │
13──┘
7 : 14──┘
8 : 16──┐
17──┐
9 : 18──┘ │
19
10: 20──┐ │
21──┘
11: 22──┘
12: 24
Roots for record 13 (stored at leaf 26): [ 7, 19, 25 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7
4 : 8──┐ │
9──┐ │
5 : 10──┘ │ │
11──┘
6 : 12──┐ │
13──┘
7 : 14──┘
8 : 16──┐
17──┐
9 : 18──┘ │
19
10: 20──┐ │
21──┘
11: 22──┘
12: 24──┐
25
13: 26──┘
Roots for record 14 (stored at leaf 28): [ 7, 19, 25, 28 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7
4 : 8──┐ │
9──┐ │
5 : 10──┘ │ │
11──┘
6 : 12──┐ │
13──┘
7 : 14──┘
8 : 16──┐
17──┐
9 : 18──┘ │
19
10: 20──┐ │
21──┘
11: 22──┘
12: 24──┐
25
13: 26──┘
14: 28
Roots for record 15 (stored at leaf 30): [ 15 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7──┐
4 : 8──┐ │ │
9──┐ │ │
5 : 10──┘ │ │ │
11──┘ │
6 : 12──┐ │ │
13──┘ │
7 : 14──┘ │
15
8 : 16──┐ │
17──┐ │
9 : 18──┘ │ │
19──┐ │
10: 20──┐ │ │ │
21──┘ │ │
11: 22──┘ │ │
23──┘
12: 24──┐ │
25──┐ │
13: 26──┘ │ │
27──┘
14: 28──┐ │
29──┘
15: 30──┘
Roots for record 16 (stored at leaf 32): [ 15, 32 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7──┐
4 : 8──┐ │ │
9──┐ │ │
5 : 10──┘ │ │ │
11──┘ │
6 : 12──┐ │ │
13──┘ │
7 : 14──┘ │
15
8 : 16──┐ │
17──┐ │
9 : 18──┘ │ │
19──┐ │
10: 20──┐ │ │ │
21──┘ │ │
11: 22──┘ │ │
23──┘
12: 24──┐ │
25──┐ │
13: 26──┘ │ │
27──┘
14: 28──┐ │
29──┘
15: 30──┘
16: 32
Roots for record 17 (stored at leaf 34): [ 15, 33 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7──┐
4 : 8──┐ │ │
9──┐ │ │
5 : 10──┘ │ │ │
11──┘ │
6 : 12──┐ │ │
13──┘ │
7 : 14──┘ │
15
8 : 16──┐ │
17──┐ │
9 : 18──┘ │ │
19──┐ │
10: 20──┐ │ │ │
21──┘ │ │
11: 22──┘ │ │
23──┘
12: 24──┐ │
25──┐ │
13: 26──┘ │ │
27──┘
14: 28──┐ │
29──┘
15: 30──┘
16: 32──┐
33
17: 34──┘
Roots for record 18 (stored at leaf 36): [ 15, 33, 36 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7──┐
4 : 8──┐ │ │
9──┐ │ │
5 : 10──┘ │ │ │
11──┘ │
6 : 12──┐ │ │
13──┘ │
7 : 14──┘ │
15
8 : 16──┐ │
17──┐ │
9 : 18──┘ │ │
19──┐ │
10: 20──┐ │ │ │
21──┘ │ │
11: 22──┘ │ │
23──┘
12: 24──┐ │
25──┐ │
13: 26──┘ │ │
27──┘
14: 28──┐ │
29──┘
15: 30──┘
16: 32──┐
33
17: 34──┘
18: 36
Roots for record 19 (stored at leaf 38): [ 15, 35 ]
0 : 0──┐
1──┐
1 : 2──┘ │
3──┐
2 : 4──┐ │ │
5──┘ │
3 : 6──┘ │
7──┐
4 : 8──┐ │ │
9──┐ │ │
5 : 10──┘ │ │ │
11──┘ │
6 : 12──┐ │ │
13──┘ │
7 : 14──┘ │
15
8 : 16──┐ │
17──┐ │
9 : 18──┘ │ │
19──┐ │
10: 20──┐ │ │ │
21──┘ │ │
11: 22──┘ │ │
23──┘
12: 24──┐ │
25──┐ │
13: 26──┘ │ │
27──┘
14: 28──┐ │
29──┘
15: 30──┘
16: 32──┐
33──┐
17: 34──┘ │
35
18: 36──┐ │
37──┘
19: 38──┘
@jimpick
Copy link
Author

jimpick commented Sep 6, 2018

@jimpick
Copy link
Author

jimpick commented Sep 6, 2018

@jimpick
Copy link
Author

jimpick commented Sep 6, 2018

@jimpick
Copy link
Author

jimpick commented Oct 12, 2018

(Note from @mikeal)

  1. dat codec
    1.1 dat de-serializer. takes binary blob of intermediary node and de-serializes it.
    1.2 give all links in node
    1.3 register dat codec
  2. dat need to give us all "blocks" (raw leaf node binary blobs and all intermediary node blobs) and the last block needs to always be the new root node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment