io

package
Version: v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

package unixfs/io implements convenience objects for working with the ipfs unixfs data format.

Index

Constants

This section is empty.

Variables

View Source
var DefaultShardWidth = 256

DefaultShardWidth is the default value used for hamt sharding width.

View Source
var ErrCantReadSymlinks = errors.New("cannot currently read symlinks")
View Source
var ErrIsDir = errors.New("this dag node is a directory")
View Source
var ErrNotADir = fmt.Errorf("merkledag node was not a directory or shard")

ErrNotADir implies that the given node was not a unixfs directory

View Source
var ShardSplitThreshold = 1000

ShardSplitThreshold specifies how large of an unsharded directory the Directory code will generate. Adding entries over this value will result in the node being restructured into a sharded object.

View Source
var UseHAMTSharding = false

UseHAMTSharding is a global flag that signifies whether or not to use the HAMT sharding scheme for directory creation

Functions

func NewBufDagReader added in v0.4.5

func NewBufDagReader(b []byte) *bufDagReader

func NewPBFileReader added in v0.4.5

func NewPBFileReader(ctx context.Context, n *mdag.ProtoNode, pb *ftpb.Data, serv mdag.DAGService) *pbDagReader

func ResolveUnixfsOnce added in v0.4.5

func ResolveUnixfsOnce(ctx context.Context, ds dag.DAGService, nd node.Node, names []string) (*node.Link, []string, error)

ResolveUnixfsOnce resolves a single hop of a path through a graph in a unixfs context. This includes handling traversing sharded directories.

Types

type DagReader

type DagReader interface {
	ReadSeekCloser
	Size() uint64
	CtxReadFull(context.Context, []byte) (int, error)
	Offset() int64
}

func NewDagReader

func NewDagReader(ctx context.Context, n node.Node, serv mdag.DAGService) (DagReader, error)

NewDagReader creates a new reader object that reads the data represented by the given node, using the passed in DAGService for data retreival

type Directory added in v0.4.8

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

func NewDirectory

func NewDirectory(dserv mdag.DAGService) *Directory

NewDirectory returns a Directory. It needs a DAGService to add the Children

func NewDirectoryFromNode added in v0.4.8

func NewDirectoryFromNode(dserv mdag.DAGService, nd node.Node) (*Directory, error)

func (*Directory) AddChild added in v0.4.8

func (d *Directory) AddChild(ctx context.Context, name string, nd node.Node) error

AddChild adds a (name, key)-pair to the root node.

func (*Directory) Find added in v0.4.8

func (d *Directory) Find(ctx context.Context, name string) (node.Node, error)
func (d *Directory) ForEachLink(ctx context.Context, f func(*node.Link) error) error

func (*Directory) GetNode added in v0.4.8

func (d *Directory) GetNode() (node.Node, error)

GetNode returns the root of this Directory

func (*Directory) GetPrefix added in v0.4.12

func (d *Directory) GetPrefix() *cid.Prefix

GetPrefix returns the CID Prefix used

func (d *Directory) Links(ctx context.Context) ([]*node.Link, error)

func (*Directory) RemoveChild added in v0.4.8

func (d *Directory) RemoveChild(ctx context.Context, name string) error

func (*Directory) SetPrefix added in v0.4.9

func (d *Directory) SetPrefix(prefix *cid.Prefix)

SetPrefix sets the prefix of the root node

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
	io.WriterTo
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL