blob: 51ab30dd7d9b62e4ab58fa44dc1e9fc970a2f5e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# meta.dat
Dat uses a simple metadata file called `meta.dat`. The purpose of this file is to store the fingerprints of the files in a Dat repository. If you create a `meta.dat` file for a set of files, you can host it on a static HTTP server along with the files and Dat clients will be able to download and verify your files, even if you aren't running a Dat server!
# File format
```
<Header><Entries...>
```
The format is a header followed by many entries. Entry order is based on the indexing determined by the [Flat In-Order Tree](hyperdrive.md#flat-in-order-trees) algorithm we use in Dat.
For example, given a tree like this you might want to look up in a `meta.dat` file the metadata for a specific node:
```
0─┐
1─┐
2─┘ │
3
4─┐ │
5─┘
6─┘
```
If you wanted to look up the metadata for 3, you could read the third (or any!) entry from meta.dat with the following formula (assuming you've already decoded the header and hash lengths from the beginning of the file):
```
header-length + entry-number * (8 + hash-length)
```
### Header format
```
<varint header-length><header protobuf>
```
The header protobuf has this schema:
``` proto
message Header {
required bytes datLink = 1;
optional bool isSigned = 2;
optional string hashType = 3 [default = "sha256"];
optional uint32 hashLength = 4 [default = 32];
}
```
### Entry format
For non-signed entries:
```
<8-byte-chunk-offset><chunk-hash>
```
For signed entries (in live feeds):
```
<8-byte-chunk-offset><64-byte-signature><chunk-hash>
```
|