]> Cypherpunks.ru repositories - nncp.git/blob - doc/chunked.texi
Add various documentation indices
[nncp.git] / doc / chunked.texi
1 @node Chunked
2 @cindex chunked
3 @unnumbered Chunked files
4
5 There is ability to transfer huge files with dividing them into smaller
6 chunks. Each chunk is treated like a separate file, producing separate
7 outbound packet unrelated with other ones.
8
9 This is useful when your removable storage device has smaller capacity
10 than huge file's size. You can transfer those chunks on different
11 storage devices, and/or at different time, reassembling the whole packet
12 on the destination node.
13
14 Splitting is done with @ref{nncp-file, nncp-file -chunked} command and
15 reassembling with @ref{nncp-reass} command.
16
17 @vindex .nncp.meta
18 @vindex .nncp.chunk
19 Chunked @file{FILE} produces @file{FILE.nncp.meta},
20 @file{FILE.nncp.chunk0}, @file{FILE.nncp.chunk1}, @dots{} files. All
21 @file{.nncp.chunkXXX} can be concatenated together to produce original
22 @file{FILE}.
23
24 @file{.nncp.meta} contains information about file/chunk
25 size and their hash checksums. This is
26 @url{https://tools.ietf.org/html/rfc4506, XDR}-encoded structure:
27
28 @verbatim
29 +------------------------------+---------------------+
30 | MAGIC | FILESIZE | CHUNKSIZE | HASH0 | HASH1 | ... |
31 +------------------------------+---------------------+
32 @end verbatim
33
34 @multitable @columnfractions 0.2 0.3 0.5
35 @headitem @tab XDR type @tab Value
36 @item Magic number @tab
37     8-byte, fixed length opaque data @tab
38     @verb{|N N C P M 0x00 0x00 0x02|}
39 @item File size @tab
40     unsigned hyper integer @tab
41     Whole reassembled file's size
42 @item Chunk size @tab
43     unsigned hyper integer @tab
44     Size of each chunk (except for the last one, that could be smaller)
45 @item Checksums @tab
46     variable length array of 32 byte fixed length opaque data @tab
47     @ref{MTH} checksum of each chunk
48 @end multitable
49
50 @cindex ZFS recordsize
51 @anchor{ChunkedZFS}
52 It is strongly advisable to reassemble incoming chunked files on
53 @url{https://en.wikipedia.org/wiki/ZFS, ZFS} dataset with deduplication
54 feature enabled. It could be more CPU and memory hungry, but will save
55 your disk's IO and free space from pollution (although temporary). But
56 pay attention that you chunks must be either equal to, or divisible by
57 dataset's @option{recordsize} value for deduplication workability.
58 Default ZFS's @option{recordsize} is 128 KiBs, so it is advisable to
59 chunk your files on 128, 256, 384, 512, etc KiB blocks.