unixfile

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ReedSolomonDagOff   = 0
	ReedSolomonDagOpen  = 1
	ReedSolomonDagNext  = 2
	ReedSolomonDagClose = 3
)

Variables

View Source
var (
	ErrNilTreeBuf = errors.New("treeBuf is nil for directory node")
)

Functions

func GetRsNode

func GetRsNode(l interface{}) (uio.Node, error)

func InitDag

func InitDag(ctx context.Context, dataBuf *bytes.Buffer, cid string) context.Context

func NewReedSolomonDirectory

func NewReedSolomonDirectory(ctx context.Context, root ipld.Node, dataNode ipld.Node, dserv ipld.DAGService, opts UnixfsFileOptions,
	metaStruct *MetadataStruct) (files.Node, error)

NewReedSolomonDirectory returns files.Node for the root DAG node of a BTFS object in Reed-Solomon encoding. This builder function is supposed to be called only one time for `btfs get` for a BTFS merkle DAG.

func NewReedSolomonFileUnderDirectory

func NewReedSolomonFileUnderDirectory(
	ctx context.Context, dserv ipld.DAGService, cid string, nd uio.Node, bfs bool) (files.Node, error)

NewReedSolomonFileUnderDirectory returns a files.Node for the given `nd` Node. This functioon is called within the context of Reed-Solomon DAG for directory. The given `nd` is a uio.FileNode and is used to create a reader.

func NewReedSolomonStandaloneFile

func NewReedSolomonStandaloneFile(ctx context.Context, root ipld.Node, dataNode ipld.Node, dserv ipld.DAGService, opts UnixfsFileOptions,
	metaStruct *MetadataStruct) (files.Node, error)

func NewReedSolomonSubDirectory

func NewReedSolomonSubDirectory(ctx context.Context, dserv ipld.DAGService, cid string, nd uio.Node) (files.Node, error)

NewReedSolomonSugDirectory creates and returns a files.Dir with the given uio.Node.

func NewUnixfsFile

func NewUnixfsFile(ctx context.Context, dserv ipld.DAGService, nd ipld.Node,
	opts UnixfsFileOptions) (files.Node, error)

NewUnixFsFile returns a DagReader for the 'nd' root node. If opts.Meta = true, only return a valid metadata node if it exists. If not, return error. If opts.Meta = false, return only the data contents. If opts.Meta = false && opts.RepairShards != nil, the shards would be reconstructed and added on this node.

Types

type MetadataStruct

type MetadataStruct struct {
	Buff    []byte
	RsMeta  *chunker.RsMetaMap
	DirRoot *uio.DirNode
}

func ObtainMetadataFromDag

func ObtainMetadataFromDag(ctx context.Context, metaNode ipld.Node, dserv ipld.NodeGetter) (*MetadataStruct, error)

ObtainMetadataFromDag returns MetadataStruct object.

type ReedSolomonDag

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

func GetDag

func GetDag(ctx context.Context, cid string) *ReedSolomonDag

func NewReedSolomonDag

func NewReedSolomonDag(dataBuf *bytes.Buffer, cid string) *ReedSolomonDag

type RsDirectory

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

func (*RsDirectory) Close

func (d *RsDirectory) Close() error

func (*RsDirectory) Entries

func (d *RsDirectory) Entries() files.DirIterator

func (*RsDirectory) IsReedSolomon

func (f *RsDirectory) IsReedSolomon() bool

func (*RsDirectory) SetSize

func (f *RsDirectory) SetSize(size int64) error

func (*RsDirectory) Size

func (d *RsDirectory) Size() (int64, error)

type RsIterator

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

func (*RsIterator) BreadthFirstTraversal

func (it *RsIterator) BreadthFirstTraversal()

func (*RsIterator) Err

func (it *RsIterator) Err() error

func (*RsIterator) Name

func (it *RsIterator) Name() string

func (*RsIterator) Next

func (it *RsIterator) Next() bool

func (*RsIterator) Node

func (it *RsIterator) Node() files.Node

type UnixfsFileOptions

type UnixfsFileOptions struct {
	Meta         bool
	RepairShards []cid.Cid
}

Jump to

Keyboard shortcuts

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