]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - docs/specifications/URI-extension.rst
6d40652ebb7f30a63a9fae34cdcfb3ec42117001
[tahoe-lafs/tahoe-lafs.git] / docs / specifications / URI-extension.rst
1 ===================
2 URI Extension Block
3 ===================
4
5 This block is a serialized dictionary with string keys and string values
6 (some of which represent numbers, some of which are SHA-256 hashes). All
7 buckets hold an identical copy. The hash of the serialized data is kept in
8 the URI.
9
10 The download process must obtain a valid copy of this data before any
11 decoding can take place. The download process must also obtain other data
12 before incremental validation can be performed. Full-file validation (for
13 clients who do not wish to do incremental validation) can be performed solely
14 with the data from this block.
15
16 At the moment, this data block contains the following keys (and an estimate
17 on their sizes)::
18
19  size                5
20  segment_size        7
21  num_segments        2
22  needed_shares       2
23  total_shares        3
24
25  codec_name          3
26  codec_params        5+1+2+1+3=12
27  tail_codec_params   12
28
29  share_root_hash     32 (binary) or 52 (base32-encoded) each
30  plaintext_hash
31  plaintext_root_hash
32  crypttext_hash
33  crypttext_root_hash
34
35 Some pieces are needed elsewhere (size should be visible without pulling the
36 block, the Tahoe3 algorithm needs total_shares to find the right peers, all
37 peer selection algorithms need needed_shares to ask a minimal set of peers).
38 Some pieces are arguably redundant but are convenient to have present
39 (test_encode.py makes use of num_segments).
40
41 The rule for this data block is that it should be a constant size for all
42 files, regardless of file size. Therefore hash trees (which have a size that
43 depends linearly upon the number of segments) are stored elsewhere in the
44 bucket, with only the hash tree root stored in this data block.
45
46 This block will be serialized as follows::
47
48  assert that all keys match ^[a-zA-z_\-]+$
49  sort all the keys lexicographically
50  for k in keys:
51   write("%s:" % k)
52   write(netstring(data[k]))
53
54
55 Serialized size::
56
57  dense binary (but decimal) packing: 160+46=206
58  including 'key:' (185) and netstring (6*3+7*4=46) on values: 231
59  including 'key:%d\n' (185+13=198) and printable values (46+5*52=306)=504
60
61 We'll go with the 231-sized block, and provide a tool to dump it as text if
62 we really want one.