Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoCodec = fmt.Errorf("no suitable codec")
)
View Source
var Header []byte
Functions ¶
func CodecWithHeader ¶
func CodecWithHeader(hdr []byte, codecs []mc.Multicodec) mc.Multicodec
func SelectFirst ¶
func SelectFirst(v interface{}, codecs []mc.Multicodec) mc.Multicodec
SelectFirst is the default SelectCodec function. selects the first codec given.
Types ¶
type Multicodec ¶
type Multicodec struct { Codecs []mc.Multicodec // subcodecs to use Select SelectCodec // pick a subcodec for encoding Wrap bool // whether to wrap with own header Last mc.Multicodec // the last subcodec used }
func MuxMulticodec ¶
func MuxMulticodec(codecs []mc.Multicodec, sel SelectCodec) *Multicodec
MuxMulticodec returns a multicodec that muxes between given codecs. It uses the given SelectCodec function when marshaling, to select the best codec to use.
func StandardMux ¶
func StandardMux() *Multicodec
func (*Multicodec) Header ¶
func (c *Multicodec) Header() []byte
type SelectCodec ¶
type SelectCodec func(v interface{}, codecs []mc.Multicodec) mc.Multicodec
SelectCodec is a function that selects which codecs are able to marshal a given datastructure, and orders them (to be tried first).
Click to show internal directories.
Click to hide internal directories.