Documentation ¶
Overview ¶
package unixfs/io implements convenience objects for working with the ipfs unixfs data format.
Index ¶
- Variables
- func NewBufDagReader(b []byte) *bufDagReader
- func NewPBFileReader(ctx context.Context, n *mdag.ProtoNode, pb *ftpb.Data, serv mdag.DAGService) *pbDagReader
- func ResolveUnixfsOnce(ctx context.Context, ds dag.DAGService, nd node.Node, names []string) (*node.Link, []string, error)
- type DagReader
- type Directory
- func (d *Directory) AddChild(ctx context.Context, name string, nd node.Node) error
- 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 (d *Directory) GetNode() (node.Node, error)
- func (d *Directory) GetPrefix() *cid.Prefix
- func (d *Directory) Links(ctx context.Context) ([]*node.Link, error)
- func (d *Directory) RemoveChild(ctx context.Context, name string) error
- func (d *Directory) SetPrefix(prefix *cid.Prefix)
- type ReadSeekCloser
Constants ¶
This section is empty.
Variables ¶
var DefaultShardWidth = 256
DefaultShardWidth is the default value used for hamt sharding width.
var ErrCantReadSymlinks = errors.New("cannot currently read symlinks")
var ErrIsDir = errors.New("this dag node is a directory")
var ErrNotADir = fmt.Errorf("merkledag node was not a directory or shard")
ErrNotADir implies that the given node was not a unixfs directory
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.
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 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 ¶
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