go-cidutil: github.com/ipfs/go-cidutil Index | Files | Directories

package cidutil

import "github.com/ipfs/go-cidutil"

Index

Package Files

format.go inline.go set.go slice.go

Constants

const FormatRef = "" /* 708 byte string literal not displayed */

FormatRef is a string documenting the format string for the Format function

func Format Uses

func Format(fmtStr string, base mb.Encoding, cid c.Cid) (string, error)

Format formats a cid according to the format specificer as documented in the FormatRef constant

func ScanForCid Uses

func ScanForCid(buf []byte) (i, j int, cid c.Cid, cidStr string)

ScanForCid scans bytes for anything resembling a CID. If one is found `i` will point to the begging of the cid and `j` to to the end and the cid will be returned, otherwise `i` and `j` will point the end of the buffer and the cid will be `Undef`.

func Sort Uses

func Sort(s []cid.Cid)

Sort sorts a slice of CIDs

type FormatStringError Uses

type FormatStringError struct {
    Message   string
    Specifier string
}

FormatStringError is the error return from Format when the format string is ill formed

func (FormatStringError) Error Uses

func (e FormatStringError) Error() string

type InlineBuilder Uses

type InlineBuilder struct {
    cid.Builder     // Parent Builder
    Limit       int // Limit (inclusive)
}

InlineBuilder is a cid.Builder that will use the id multihash when the size of the content is no more than limit

func (InlineBuilder) Sum Uses

func (p InlineBuilder) Sum(data []byte) (cid.Cid, error)

Sum implements the cid.Builder interface

func (InlineBuilder) WithCodec Uses

func (p InlineBuilder) WithCodec(c uint64) cid.Builder

WithCodec implements the cid.Builder interface

type Set Uses

type Set = c.Set

func NewSet Uses

func NewSet() *Set

type Slice Uses

type Slice []cid.Cid

Slice is a convenience type for sorting CIDs

func (Slice) Len Uses

func (s Slice) Len() int

func (Slice) Less Uses

func (s Slice) Less(i, j int) bool

func (Slice) Sort Uses

func (s Slice) Sort()

func (Slice) Swap Uses

func (s Slice) Swap(i, j int)

type StreamingSet Uses

type StreamingSet struct {
    Set *Set
    New chan c.Cid
}

StreamingSet is an extension of Set which allows to implement back-pressure for the Visit function

func NewStreamingSet Uses

func NewStreamingSet() *StreamingSet

NewStreamingSet initializes and returns new Set.

func (*StreamingSet) Visitor Uses

func (s *StreamingSet) Visitor(ctx context.Context) func(c c.Cid) bool

Visitor creates new visitor which adds a Cids to the set and emits them to the set.New channel

Directories

PathSynopsis
cidenc
cid-fmt

Package cidutil imports 7 packages (graph) and is imported by 22 packages. Updated 2020-08-06. Refresh now. Tools for package owners.