Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLinkSystem ¶ added in v0.9.0
func DefaultLinkSystem() linking.LinkSystem
DefaultLinkSystem returns a linking.LinkSystem which uses cidlink.Link for datamodel.Link. During selection of encoders, decoders, and hashers, it examines the multicodec indicator numbers and multihash indicator numbers from the CID, and uses the default global multicodec registry (see the go-ipld-prime/multicodec package) for resolving codec implementations, and the default global multihash registry (see the go-multihash/core package) for resolving multihash implementations.
No storage functions are present in the returned LinkSystem. The caller can assign those themselves as desired.
func LinkSystemUsingMulticodecRegistry ¶ added in v0.10.0
func LinkSystemUsingMulticodecRegistry(mcReg multicodec.Registry) linking.LinkSystem
LinkSystemUsingMulticodecRegistry is similar to DefaultLinkSystem, but accepts a multicodec.Registry as a parameter.
This can help create a LinkSystem which uses different multicodec implementations than the global registry. (Sometimes this can be desired if you want some parts of a program to support a more limited suite of codecs than other parts of the program, or needed to use a different multicodec registry than the global one for synchronization purposes, or etc.)
Types ¶
type Link ¶
Link implements the datamodel.Link interface using a CID. See https://github.com/ipfs/go-cid for more information about CIDs.
When using this value, typically you'll use it as `Link`, and not `*Link`. This includes when handling the value as an `datamodel.Link` interface -- the non-pointer form is typically preferable. This is because the datamodel.Link inteface is often desirable to be able to use as a golang map key, and in that context, pointers would not result in the desired behavior.
func (Link) Prototype ¶ added in v0.9.0
func (lnk Link) Prototype() datamodel.LinkPrototype
type LinkPrototype ¶ added in v0.9.0
type Memory ¶ added in v0.14.0
Memory is a simple in-memory storage for cidlinks. It's the same as `storage.Memory` but uses typical multihash semantics used when reading/writing cidlinks.
Using multihash as the storage key rather than the whole CID will remove the distinction between CIDv0 and their CIDv1 counterpart. It also removes the distinction between CIDs where the multihash is the same but the codec is different, e.g. `dag-cbor` and a `raw` version of the same data.
func (*Memory) OpenWrite ¶ added in v0.14.0
func (store *Memory) OpenWrite(lnkCtx linking.LinkContext) (io.Writer, linking.BlockWriteCommitter, error)