impl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const UnixfsChunkSize uint64 = 1 << 20

Variables

This section is empty.

Functions

func BalanceNode

func BalanceNode(ctx context.Context, f io.Reader, fsize int64, bufDs format.DAGService, cidBuilder cid.Builder, batchReadNum int) (cid.Cid, error)

Todos:

read more bytes and parallel the dags save work

func NewDagWithData

func NewDagWithData(rd []byte, fsNodeType pb.Data_DataType, cidBuilder cid.Builder) (format.Node, error)

Types

type BatchSplitter

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

func NewBatchSplitter

func NewBatchSplitter(r io.Reader, size int64, batch int) *BatchSplitter

NewSizeSplitter returns a new size-based Splitter with the given block size.

func (*BatchSplitter) NextBytes

func (ss *BatchSplitter) NextBytes() ([]*Idxbuf, error)

NextBytes produces a new chunk.

func (*BatchSplitter) Reader

func (ss *BatchSplitter) Reader() io.Reader

Reader returns the io.Reader associated to this Splitter.

type CommonAPI

type CommonAPI struct {
	Node *node.Node
}

func (*CommonAPI) Add

func (a *CommonAPI) Add(ctx context.Context, path string) (chan api.PBar, error)

func (*CommonAPI) Add2

func (a *CommonAPI) Add2(ctx context.Context, path string, br int) (chan api.PBar, error)

func (*CommonAPI) Get

func (a *CommonAPI) Get(ctx context.Context, cid cid.Cid, path string) (chan api.PBar, error)

type DagAPI

type DagAPI struct {
	Node *node.Node
}

func (*DagAPI) DagExport

func (a *DagAPI) DagExport(ctx context.Context, c cid.Cid, path string, pad bool, batchNum int, swarm bool) (chan api.PBar, error)

func (*DagAPI) DagHas

func (a *DagAPI) DagHas(ctx context.Context, cid cid.Cid) (bool, error)

func (*DagAPI) DagImport

func (a *DagAPI) DagImport(ctx context.Context, targetPath string) (chan api.PBar, error)

func (*DagAPI) DagStat

func (a *DagAPI) DagStat(ctx context.Context, cid cid.Cid, timeout uint) (*format.NodeStat, error)

func (*DagAPI) DagSync

func (a *DagAPI) DagSync(ctx context.Context, cids []cid.Cid, concur int) (chan string, error)

type FSNodeOverDag

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

func NewFSNFromDag

func NewFSNFromDag(nd *merkledag.ProtoNode) (*FSNodeOverDag, error)

func NewFSNodeOverDag

func NewFSNodeOverDag(fsNodeType pb.Data_DataType, cidBuilder cid.Builder) *FSNodeOverDag

func (*FSNodeOverDag) AddChild

func (n *FSNodeOverDag) AddChild(link *format.Link, fileSize uint64) error

func (*FSNodeOverDag) Commit

func (n *FSNodeOverDag) Commit() (format.Node, error)

func (*FSNodeOverDag) SetFileData

func (n *FSNodeOverDag) SetFileData(fileData []byte)

type FullNodeAPI

type FullNodeAPI struct {
	CommonAPI
	NetAPI
	DagAPI
}
type IdxLink struct {
	Idx      int
	Link     *format.Link
	FileSize uint64
}

type Idxbuf

type Idxbuf struct {
	Idx int
	Buf []byte
}

type NetAPI

type NetAPI struct {
	Host host.Host
}

func (*NetAPI) ID

func (a *NetAPI) ID(context.Context) (peer.ID, error)

func (*NetAPI) NetAddrsListen

func (a *NetAPI) NetAddrsListen(context.Context) (peer.AddrInfo, error)

func (*NetAPI) NetConnect

func (a *NetAPI) NetConnect(ctx context.Context, p peer.AddrInfo) error

func (*NetAPI) NetConnectedness

func (a *NetAPI) NetConnectedness(ctx context.Context, pid peer.ID) (network.Connectedness, error)

func (*NetAPI) NetDisconnect

func (a *NetAPI) NetDisconnect(ctx context.Context, p peer.ID) error

func (*NetAPI) NetPeers

func (a *NetAPI) NetPeers(context.Context) ([]peer.AddrInfo, error)

Jump to

Keyboard shortcuts

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