Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disco ¶
type Disco struct {
// contains filtered or unexported fields
}
Disco service allows us to do Disco things on top of the Distribution server.
func (*Disco) CloneGlobalRepo ¶
CloneGlobalRepo clones the repo from IPFS network to the IPFS node. Steps in here are executed before Distribution server tries to locate a repository:
- Check if the repo name is base32 CID v1. If not, leave the rest to the Distribution server.
- Copy the repo files from IPFS network to the IPFS node's MFS.
- Use disco.json inside the repo files to copy the blobs over the network.
The end result in the IPFS node's MFS should look like the one from MakeGlobalRepo and all CIDs should match.
func (*Disco) IsOnlyPullable ¶
IsOnlyPullable tells if the repo is name of a pullable-only repo name.
func (*Disco) MakeGlobalRepo ¶
MakeGlobalRepo makes the repo a globally addressable one. We achieve this by benefiting from the content addressing and data deduplication properties of IPFS.
This makes Disco a huge bucket of repositories which are identifiable only by hashes and each repository only has the version "latest".
Steps in here are executed after Distribution server creates a repository:
- Add disco.json to the repo dir so the blobs can be copied from the network at the time of "pull".
- Duplicate the repo by using the base32-encoded IPFS CID of repo dir as the repo name so it becomes very easy to address the repo.
- Duplicate the repo by using the manifest digest as the repo name so we make <digest>:latest possible.
- Tag the repo in step 3 with the name in step 2 like <digest>:<CID> so it becomes easy to discover the CID from the digest.
- Remove the repo which was created before step 1 so we allow no special names for repositories.
The images should be accessible from any Disco which speaks to an IPFS node connected to the network. Duplicating repositories in IPFS MFS with different names shouldn't cause IPFS to duplicate the actual files.
After pushing <disco_host>:1970/myrepo, it transforms the storage from:
/myrepo - QmWhatever1 .. /tags /latest
to:
/<cidv1(QmWhatever2)> - QmWhatever2 disco.json .. /tags /latest /<digest> - QmWhatever3 disco.json .. /tags /latest /<cidv1(QmWhatever2)>