ipfs

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(hosts []string, timeout time.Duration) (storage.BasicStorage, error)

New creates Storage with ipfs hosts and timeout(in milliseconds) returns error if any mistake occured

Types

type Gateway

type Gateway interface {
	// Add performs `ipfs add`
	Add(key string, r io.Reader) (cid string, err error)
	// Cat performs `ipfs cat` to show file data
	Cat(key string, cid string) (closer io.ReadCloser, err error)
	// Unpin performs `ipfs pin rm -r`
	Unpin(key string, cid string) (err error)
	// PinLs performs `ipfs pin ls`
	PinLs(key string, cid string) (pinInfo map[string]shell.PinInfo, err error)
}

func NewGateway

func NewGateway(hosts []string, timeout time.Duration) (Gateway, error)

NewGateway returns gateway instance or error if mistakes occur timeout specifies a time limit for requests, a Timeout of zero means no timeout.

type Storage

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

Storage is implemented with IPFS cluster.

func (*Storage) Delete

func (s *Storage) Delete(key string, index string) error

Delete deletes a piece of `Data` key is the identification of a piece of `Data`, and it's decided by end-users index is the index of stored data(cid in IPFS) It takes a while for the data to really be wiped

func (*Storage) Exist

func (s *Storage) Exist(key string, index string) (bool, error)

Exist checks existence of a piece of `Data` key is the identification of a piece of `Data`, and it's decided by end-users index is the index of stored data(cid in IPFS)

func (*Storage) Load

func (s *Storage) Load(key string, index string) (io.ReadCloser, error)

Load loads a piece of `Data` key is the identification of a piece of `Data`, and it's decided by end-users index is the index of stored data(cid in IPFS)

func (*Storage) Save

func (s *Storage) Save(key string, value io.Reader) (string, error)

Save saves a piece of `Data` key is the identification of a piece of `Data`, and it's decided by end-users value contains content of a piece of `Data` returns index, which is the index of stored data(cid in IPFS)

func (*Storage) Update

func (s *Storage) Update(key string, index string, value io.Reader) (string, error)

Update updates a piece of `Data` key is the identification of a piece of `Data`, and it's decided by end-users index is the index of stored data(cid in IPFS) returns new index

Jump to

Keyboard shortcuts

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