bin

package
v0.0.0-...-508b737 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractKuboBinary

func ExtractKuboBinary(r io.Reader, checksum []byte) io.ReadCloser

ExtractKuboBinary extracts the kubo binary from a dist archive, also checking the given archive checksum in the process.

Types

type DistFetcher

type DistFetcher struct {
	CacheLocally bool
	Vers         string
}

DistFetcher fetches the given Kubo version binary from dist.ipfs.io, optionally caching it on the local disk. Caching is useful to avoid downloading the binary for every test run.

func (*DistFetcher) Fetch

func (r *DistFetcher) Fetch(ctx context.Context) (io.ReadCloser, error)

func (*DistFetcher) Version

func (r *DistFetcher) Version(ctx context.Context) (string, error)

type DockerImageFetcher

type DockerImageFetcher struct {
	Image string
}

DockerImageFetcher fetches a Kubo binary by extracting it from a Docker image.

func (*DockerImageFetcher) Fetch

type Fetcher

type Fetcher interface {
	// Fetch fetches a Kubo binary. If this returns no error, then the caller should close the reader to prevent leaks.
	Fetch(context.Context) (io.ReadCloser, error)
	Version(context.Context) (string, error)
}

Fetcher fetches a Kubo binary and provides a reader for the binary data.

type FetchingLoader

type FetchingLoader struct {
	Vers    string
	Fetcher cluster.Fetcher
	Node    node
}

FetchingLoader loads a Kubo archive by having each node download the specified version from dist.ipfs.io. For remote clusters, this is much faster than sending the archive to each one from the test runner.

func (*FetchingLoader) Load

func (c *FetchingLoader) Load(ctx context.Context, destFile string) error

func (*FetchingLoader) Version

func (c *FetchingLoader) Version(ctx context.Context) (string, error)

type Loader

type Loader interface {
	Load(ctx context.Context, destFile string) error
	Version(context.Context) (string, error)
}

Loader loads a Kubo bin into the given file on a node.

type LocalFetcher

type LocalFetcher struct {
	BinPath string
}

LocalFetcher fetches a Kubo archive from a local file. This is useful if you are testing against some unreleased Kubo binary.

func (*LocalFetcher) Fetch

func (l *LocalFetcher) Fetch(ctx context.Context) (io.ReadCloser, error)

func (*LocalFetcher) Version

func (l *LocalFetcher) Version(_ context.Context) (string, error)

type RemoteFetcher

type RemoteFetcher struct {
}

RemoteFetcher fetches a Kubo binary from one of multiple remote sources. The source used depends on the version passed, which can be of the following schemes:

- dist:<semver> the binary is loaded from dist.ipfs.io according to the semver, such as v0.18.0 or v0.18.0-rc1 - dist:latest the latest semver will be loaded from dist.ipfs.io (including RCs) - dist:latest-release the latest release will be loaded from dist.ipfs.io - docker:latest the binary is loaded from the latest Docker image - docker:<commit hash> the binary is loaded from the first Docker image that matches the hash

type SendingLoader

type SendingLoader struct {
	Node    node
	Fetcher Fetcher
}

SendingLoader loads a Kubo binary by sending it to the node from the test runner. This can be slower but sometimes is necessary if e.g. testing an unreleased binary when developing.

func (*SendingLoader) Load

func (b *SendingLoader) Load(ctx context.Context, destFile string) error

func (*SendingLoader) Version

func (b *SendingLoader) Version(ctx context.Context) (string, error)

type VersionInfo

type VersionInfo struct {
	Version string
	URL     string
	CID     string
	SHA512  []byte
}

type Versions

type Versions struct {
	// contains filtered or unexported fields
}

func LoadVersions

func LoadVersions(ctx context.Context) (*Versions, error)

LoadVersions fetches and caches version metadata from dist.ipfs.io about all Kubo release versions. Subsequent calls use the in-memory cached metadata.

func (Versions) FetchVersion

func (v Versions) FetchVersion(ctx context.Context, version string) (io.ReadCloser, error)

func (Versions) FetchVersionWithCaching

func (v Versions) FetchVersionWithCaching(ctx context.Context, version string) (io.ReadCloser, error)

func (Versions) URL

func (v Versions) URL(version string) (string, error)

Jump to

Keyboard shortcuts

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