dshelp

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 17

Documentation

Overview

Package dshelp provides utilities for parsing and creating datastore keys used by go-ipfs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryFromDsKey

func BinaryFromDsKey(k datastore.Key) ([]byte, error)

BinaryFromDsKey returns the byte slice corresponding to the given Key.

func DsKeyToCidV1

func DsKeyToCidV1(dsKey datastore.Key, codecType uint64) (cid.Cid, error)

DsKeyToCidV1Raw converts the given Key (which should be a raw multihash key) to a Cid V1 of the given type (see https://godoc.org/github.com/ipfs/go-cid#pkg-constants).

func DsKeyToMultihash

func DsKeyToMultihash(dsKey datastore.Key) (mh.Multihash, error)

DsKeyToMultihash converts a dsKey to the corresponding Multihash.

func MultihashToDsKey

func MultihashToDsKey(k mh.Multihash) datastore.Key

MultihashToDsKey creates a Key from the given Multihash. If working with Cids, you can call cid.Hash() to obtain the multihash. Note that different CIDs might represent the same multihash.

func NewKeyFromBinary

func NewKeyFromBinary(rawKey []byte) datastore.Key

NewKeyFromBinary creates a new key from a byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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