master
text 30 lines 1.1 KB
Raw
1 This is a repository of IPLD objects. Each IPLD object is in a single file,
2 named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
3 "base32" encoding of the CID (as specified in
4 https://github.com/multiformats/multibase) without the 'B' prefix.
5 All the object files are placed in a tree of directories, based on a
6 function of the CID. This is a form of sharding similar to
7 the objects directory in git repositories. Previously, we used
8 prefixes, we now use the next-to-last two characters.
9
10 func NextToLast(base32cid string) {
11 nextToLastLen := 2
12 offset := len(base32cid) - nextToLastLen - 1
13 return str[offset : offset+nextToLastLen]
14 }
15
16 For example, an object with a base58 CIDv1 of
17
18 zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
19
20 has a base32 CIDv1 of
21
22 BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
23
24 and will be placed at
25
26 SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
27
28 with 'SC' being the last-to-next two characters and the 'B' at the
29 beginning of the CIDv1 string is the multibase prefix that is not
30 stored in the filename.