Documentation
¶
Index ¶
- Variables
- type DagBuilderHelper
- func (db *DagBuilderHelper) Add(node *UnixfsNode) (*dag.Node, error)
- func (db *DagBuilderHelper) Done() bool
- func (db *DagBuilderHelper) FillNodeLayer(node *UnixfsNode) error
- func (db *DagBuilderHelper) FillNodeWithData(node *UnixfsNode) error
- func (db *DagBuilderHelper) Maxlinks() int
- func (db *DagBuilderHelper) Next() []byte
- type DagBuilderParams
- type UnixfsNode
Constants ¶
This section is empty.
Variables ¶
var BlockSizeLimit = 1048576 // 1 MB
BlockSizeLimit specifies the maximum size an imported block can have.
var DefaultLinksPerBlock = (roughLinkBlockSize / roughLinkSize)
DefaultLinksPerBlock governs how the importer decides how many links there will be per block. This calculation is based on expected distributions of:
- the expected distribution of block sizes
- the expected distribution of link sizes
- desired access speed
For now, we use:
var roughLinkBlockSize = 1 << 13 // 8KB
var roughLinkSize = 288 // sha256 + framing + name
var DefaultLinksPerBlock = (roughLinkBlockSize / roughLinkSize)
See calc_test.go
var ErrSizeLimitExceeded = fmt.Errorf("object size limit exceeded")
ErrSizeLimitExceeded signals that a block is larger than BlockSizeLimit.
Functions ¶
This section is empty.
Types ¶
type DagBuilderHelper ¶
type DagBuilderHelper struct {
// contains filtered or unexported fields
}
DagBuilderHelper wraps together a bunch of objects needed to efficiently create unixfs dag trees
func (*DagBuilderHelper) Done ¶
func (db *DagBuilderHelper) Done() bool
Done returns whether or not we're done consuming the incoming data.
func (*DagBuilderHelper) FillNodeLayer ¶
func (db *DagBuilderHelper) FillNodeLayer(node *UnixfsNode) error
FillNodeLayer will add datanodes as children to the give node until at most db.indirSize ndoes are added
warning: **children** pinned indirectly, but input node IS NOT pinned.
func (*DagBuilderHelper) FillNodeWithData ¶
func (db *DagBuilderHelper) FillNodeWithData(node *UnixfsNode) error
type DagBuilderParams ¶
type DagBuilderParams struct {
// Maximum number of links per intermediate node
Maxlinks int
// DAGService to write blocks to (required)
Dagserv dag.DAGService
// Pinner to use for pinning files (optionally nil)
Pinner pin.ManualPinner
}
type UnixfsNode ¶
type UnixfsNode struct {
// contains filtered or unexported fields
}
UnixfsNode is a struct created to aid in the generation of unixfs DAG trees
func NewUnixfsNode ¶
func NewUnixfsNode() *UnixfsNode
func (*UnixfsNode) AddChild ¶
func (n *UnixfsNode) AddChild(child *UnixfsNode, db *DagBuilderHelper) error
addChild will add the given UnixfsNode as a child of the receiver. the passed in DagBuilderHelper is used to store the child node an pin it locally so it doesnt get lost
func (*UnixfsNode) GetDagNode ¶
func (n *UnixfsNode) GetDagNode() (*dag.Node, error)
getDagNode fills out the proper formatting for the unixfs node inside of a DAG node and returns the dag node
func (*UnixfsNode) NumChildren ¶
func (n *UnixfsNode) NumChildren() int