ipfs

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCIDFromString

func DecodeCIDFromString(s string) (cid.Cid, error)

DecodeCIDFromString decodes a CID string to a CID.

Types

type IPFSProtocol

type IPFSProtocol struct {
	*ipfslite.Peer
	// contains filtered or unexported fields
}

IPFSProtocol leverages the IPFSLite library to provide simple file operations.

func New

func New(ctx context.Context, host host.HostImpl) (*IPFSProtocol, error)

New creates a new IPFSProtocol instance with Host Implementation

func (*IPFSProtocol) GetData

func (i *IPFSProtocol) GetData(cid string) ([]byte, error)

GetData returns a file from IPFS.

func (*IPFSProtocol) GetObjectSchema

func (i *IPFSProtocol) GetObjectSchema(cid *cid.Cid) (datamodel.Node, error)

GetObjectSchema returns an object schema from IPFS.

func (*IPFSProtocol) PutData

func (i *IPFSProtocol) PutData(data []byte) (*cid.Cid, error)

PutData puts a file to IPFS and returns the CID.

func (*IPFSProtocol) PutObjectSchema

func (i *IPFSProtocol) PutObjectSchema(doc *ot.ObjectDoc) (*cid.Cid, error)

PutObjectSchema puts an object schema to IPFS and returns the CID.

func (*IPFSProtocol) RemoveFile

func (i *IPFSProtocol) RemoveFile(cidstr string) error

RemoveFile removes a file from IPFS.

type MemoryStore

type MemoryStore struct {
	storage.WritableStorage
	// contains filtered or unexported fields
}

MemoryStore is a datastore.Batching implementation that stores data in memory.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore returns a new MemoryStore.

func (*MemoryStore) Batching

func (ms *MemoryStore) Batching() datastore.Batching

Batching returns the MemoryStore's datastore.Batching implementation.

func (*MemoryStore) Get

func (ms *MemoryStore) Get(ctx context.Context, key string) ([]byte, error)

Get retrieves the value stored in the MemoryStore under the given key.

func (*MemoryStore) Put

func (ms *MemoryStore) Put(ctx context.Context, key string, content []byte) error

Put stores the given value, keyed by the given string, into the MemoryStore.

Jump to

Keyboard shortcuts

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