cidlink

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2021 License: MIT Imports: 7 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLinkSystem

func DefaultLinkSystem() ld.LinkSystem

DefaultLinkSystem returns an ld.LinkSystem which uses cidlink.Link for ld.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-ld-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

func LinkSystemUsingMulticodecRegistry(mcReg multicodec.Registry) ld.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 struct {
	cid.Cid
}

Link implements the ld.Link interface using a CID. See https://gitlab.dms3.io/dms3/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 `ld.Link` interface -- the non-pointer form is typically preferable. This is because the ld.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

func (lnk Link) Prototype() ld.LinkPrototype

func (Link) String

func (lnk Link) String() string

type LinkPrototype

type LinkPrototype struct {
	cid.Prefix
}
func (lp LinkPrototype) BuildLink(hashsum []byte) ld.Link

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL