provider

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: Apache-2.0 Imports: 1 Imported by: 2

README

go-ipfs-provider

Tag License GoDoc Travis CI codecov.io Go Report Card

Go interface for IPFS providers.

Table of Contents

Install

go-ipfs-provider is a standard Go module which can be installed with:

go get github.com/wealdtech/go-ipfs-provider

Usage

The provider's interface is followed by IPFS providers; see the details of each provider for usage details.

Providers are availble for:

Example

See providers above for examples.

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2019 Weald Technology Trading Ltd

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentOpts added in v1.1.0

type ContentOpts struct {
	// StoreInDirectory will store the content in a directory if true
	StoreInDirectory bool
}

ContentOpts are options for storing content

type ItemStatistics

type ItemStatistics struct {
	// Name is the name of the item.
	Name string
	// Hash is the IPFS hash of the item.
	Hash string
	// Size is the size of the item in bytes.
	Size uint64
}

ItemStatistics is a structure for a piece of IPFS content.

type Provider

type Provider interface {
	// Ping pings the provider to ensure it is alive.
	Ping() (bool, error)

	// List lists the files pinned on the provider.
	List() ([]*ItemStatistics, error)

	// ItemStats provides statistics for the pinned item.
	ItemStats(string) (*ItemStatistics, error)

	// ServiceStats obtains statistics for this provider.
	ServiceStats() (*SiteStatistics, error)

	// PinContent pins a provided file to this provider.
	PinContent(string, io.Reader, *ContentOpts) (string, error)

	// Pin pins an existing IPFS hash to this provider.
	Pin(string) error

	// Unpin unpins an existing IPFS hash from this provider.
	Unpin(string) error

	// GatewayURL returns a gateway URL for an IPFS hash.
	GatewayURL(string) (string, error)
}

Provider is the interface an IPFS provider service must support.

type SiteStatistics

type SiteStatistics struct {
	// Items is the total number of items pinned.
	Items uint64
	// Size is the total size of items pinned.
	Size uint64
}

SiteStatistics is a structure for a provider service.

Jump to

Keyboard shortcuts

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