ipfs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client will write new documents to IPFS and read existing documents from IPFS based on CID. It implements Sidetree CAS interface.

func New

func New(url string, timeout time.Duration, cacheSize int, metrics metricsProvider,
	opts ...extendedcasclient.CIDFormatOption) *Client

New creates cas client. If no CID version is specified, then v1 will be used by default.

func (*Client) GetPrimaryWriterType

func (m *Client) GetPrimaryWriterType() string

GetPrimaryWriterType returns primary writer type.

func (*Client) Read

func (m *Client) Read(cidOrHash string) ([]byte, error)

Read reads the content for the given CID from CAS. returns the contents of CID.

func (*Client) Write

func (m *Client) Write(content []byte) (string, error)

Write writes the given content to IPFS. Returns the address (CID) of the content.

func (*Client) WriteWithCIDFormat

func (m *Client) WriteWithCIDFormat(content []byte, opts ...extendedcasclient.CIDFormatOption) (string, error)

WriteWithCIDFormat writes the given content to IPFS using the provided CID format options. Returns the address (CID) of the content. TODO (#443): Support v1 CID formats (different multibases and multicodecs) other than just the IPFS default.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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