client

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const CidBufferSize = 64

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client uint32

func New

func New() (Client, error)

func (Client) Create added in v0.1.23

func (c Client) Create() (*Content, error)

Creates creates and returns the new content.

func (Client) Open added in v0.1.23

func (c Client) Open(_cid cid.Cid) (*Content, error)

Open creates a new content using the cid given as the file. Returns a new content.

type Content added in v0.1.23

type Content struct {
	Id uint32
	// contains filtered or unexported fields
}

func (*Content) Cid added in v0.1.23

func (c *Content) Cid() (cid.Cid, error)

Cid returns the cid of the file and an error.

func (*Content) Close added in v0.1.23

func (c *Content) Close() error

Close closes the file associated with the content. Returns an error.

func (*Content) Push added in v0.1.23

func (c *Content) Push() (cid.Cid, error)

Push adds the file into the network. Updates the cid of the file. Returns cid and an error

func (*Content) Read added in v0.1.23

func (c *Content) Read(p []byte) (int, []byte, error)

Read reads up to len p in the file. Returns how much was read and an error.

func (*Content) Seek added in v0.1.23

func (c *Content) Seek(offset int64, whence int) (int64, error)

Seek moves to a position inside the file. Offset is how much to move the current position Whence has three options: 0 = SeekStart, 1 = SeekCurrent, or 2 = SeekEnd Combines both offset and whence to find a new offset inside the file Returns the new offset and an error

func (*Content) Write added in v0.1.23

func (c *Content) Write(p []byte) (int, error)

Write writes the passed in data into the file. Returns how much was written and an error.

Jump to

Keyboard shortcuts

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