cmdenv

package
v0.0.0-...-9fdd194 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBufSize = 1048576

DefaultBufSize is the buffer size for gets. for now, 1MB, which is ~4 blocks. TODO: does this need to be configurable?

View Source
var ErrInvalidCompressionLevel = errors.New("compression level must be between 1 and 9")
View Source
var OptionCidBase = cmds.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
View Source
var OptionUpgradeCidV0InOutput = cmds.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.")

Functions

func CidBaseDefined

func CidBaseDefined(req *cmds.Request) bool

CidBaseDefined returns true if the `cid-base` option is specified on the command line

func CidEncoderFromPath

func CidEncoderFromPath(p string) (cidenc.Encoder, error)

CidEncoderFromPath creates a new encoder that is influenced from the encoded Cid in a Path. For CidV0 the multibase from the base encoder is used and automatic upgrades are disabled. For CidV1 the multibase from the CID is used and upgrades are enabled.

This logic is intentionally fuzzy and will match anything of the form `CidLike`, `CidLike/...`, or `/namespace/CidLike/...`.

For example:

* Qm... * Qm.../... * /ipfs/Qm... * /ipns/bafybeiahnxfi7fpmr5wtxs2imx4abnyn7fdxeiox7xxjem6zuiioqkh6zi/... * /bzz/bafybeiahnxfi7fpmr5wtxs2imx4abnyn7fdxeiox7xxjem6zuiioqkh6zi/...

func DownloadAndRebuildFile

func DownloadAndRebuildFile(req *cmds.Request, res cmds.ResponseEmitter, api coreiface.CoreAPI, fileHash string, lostShards string) error

func GetApi

func GetApi(env cmds.Environment, req *cmds.Request, opts ...options.ApiOption) (coreiface.CoreAPI, error)

GetApi extracts CoreAPI instance from the environment.

func GetCidEncoder

func GetCidEncoder(req *cmds.Request) (cidenc.Encoder, error)

GetCidEncoder processes the `cid-base` and `output-cidv1` options and returns a encoder to use based on those parameters.

func GetCompressLevel

func GetCompressLevel(cmprs bool, cmplvl int) (int, error)

func GetConfig

func GetConfig(env cmds.Environment) (*config.Config, error)

GetConfig extracts the config from the environment.

func GetConfigRoot

func GetConfigRoot(env cmds.Environment) (string, error)

GetConfigRoot extracts the config root from the environment

func GetFile

func GetFile(req *cmds.Request, res cmds.ResponseEmitter, api coreiface.CoreAPI, btfsPath string, decrypt bool,
	privateKey string, meta bool, repairShards string, quiet bool, archive bool, cmprs bool, cmplvl int) (io.Reader, error)

func GetFileArg

func GetFileArg(it files.DirIterator) (files.File, error)

GetFileArg returns the next file from the directory or an error

func GetLowLevelCidEncoder

func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error)

GetLowLevelCidEncoder is like GetCidEncoder but meant to be used by lower level commands. It differs from GetCidEncoder in that CIDv0 are not, by default, auto-upgraded to CIDv1.

func GetNode

func GetNode(env interface{}) (*core.IpfsNode, error)

GetNode extracts the node from the environment.

func RmPin

func RmPin(req *cmds.Request, res cmds.ResponseEmitter, n *core.IpfsNode, api coreiface.CoreAPI, cfg *config.Config, arguments []string, recursive bool, force bool) error

Types

type PinOutput

type PinOutput struct {
	Pins []string
}

Jump to

Keyboard shortcuts

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