mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Build / docker-build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
https://github.com/ipfs/kubo/pull/10883 https://github.com/ipshipyard/config.ipfs-mainnet.org/issues/3 --------- Co-authored-by: gammazero <gammazero@users.noreply.github.com>
31 lines
1.1 KiB
Plaintext
Generated
31 lines
1.1 KiB
Plaintext
Generated
This is a repository of IPLD objects. Each IPLD object is in a single file,
|
|
named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
|
|
"base32" encoding of the CID (as specified in
|
|
https://github.com/multiformats/multibase) without the 'B' prefix.
|
|
All the object files are placed in a tree of directories, based on a
|
|
function of the CID. This is a form of sharding similar to
|
|
the objects directory in git repositories. Previously, we used
|
|
prefixes, we now use the next-to-last two characters.
|
|
|
|
func NextToLast(base32cid string) {
|
|
nextToLastLen := 2
|
|
offset := len(base32cid) - nextToLastLen - 1
|
|
return str[offset : offset+nextToLastLen]
|
|
}
|
|
|
|
For example, an object with a base58 CIDv1 of
|
|
|
|
zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
|
|
|
|
has a base32 CIDv1 of
|
|
|
|
BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
|
|
|
|
and will be placed at
|
|
|
|
SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
|
|
|
|
with 'SC' being the last-to-next two characters and the 'B' at the
|
|
beginning of the CIDv1 string is the multibase prefix that is not
|
|
stored in the filename.
|