Documentation ¶
Index ¶
- Constants
- func DefaultDagServiceAction(c cid.Cid, nodeType pb.Data_DataType)
- func DefaultHelperAction(node ipld.Node, srcPath string, offset uint64, size uint64)
- func DefaultWriteAfterAction(path string, buf []byte, offset uint64)
- func DefaultWriteBeforeAction(buf []byte, w io.Writer) ([]byte, error)
- func WrappedDagService(dagService ipld.DAGService, cb DagServiceAction) ipld.DAGService
- func WrappedWriter(w io.Writer, path string, acb WriteAfterAction, bcb WriteBeforeAction) io.Writer
- type DagServiceAction
- type EnhancedSplitter
- type HelperAction
- type SliceMeta
- type WrapDagBuilder
- type WrapDagService
- func (wds *WrapDagService) Add(ctx context.Context, node ipld.Node) error
- func (wds *WrapDagService) AddMany(ctx context.Context, nodes []ipld.Node) error
- func (wds *WrapDagService) Get(ctx context.Context, c cid.Cid) (ipld.Node, error)
- func (wds *WrapDagService) GetMany(ctx context.Context, cids []cid.Cid) <-chan *ipld.NodeOption
- func (wds *WrapDagService) Remove(ctx context.Context, c cid.Cid) error
- func (wds *WrapDagService) RemoveMany(ctx context.Context, cids []cid.Cid) error
- type WrapWriter
- type WriteAfterAction
- type WriteBeforeAction
Constants ¶
const UnixfsChunkSize uint64 = 1 << 20 //Deafault chunksize 2M
Variables ¶
This section is empty.
Functions ¶
func DefaultDagServiceAction ¶
func DefaultDagServiceAction(c cid.Cid, nodeType pb.Data_DataType)
func DefaultHelperAction ¶
func DefaultWriteAfterAction ¶
func WrappedDagService ¶
func WrappedDagService(dagService ipld.DAGService, cb DagServiceAction) ipld.DAGService
func WrappedWriter ¶
func WrappedWriter(w io.Writer, path string, acb WriteAfterAction, bcb WriteBeforeAction) io.Writer
Types ¶
type DagServiceAction ¶
type EnhancedSplitter ¶
type EnhancedSplitter interface { chunker.Splitter NextBytesWithMeta() ([]byte, *SliceMeta, error) }
Defining the EnhancedSplitter interface as an extension of the Splitter interface, which reads data while also returning source data path, offset, and size
func NewSplitter ¶
type HelperAction ¶
Helper callback function, when Helper calls Add to add a node to DAGService, it passes the mapping information of the node to MappingService.
type SliceMeta ¶
Reading data while obtaining source data information, including the source data file path, offset, and size:
type WrapDagBuilder ¶
func WrappedDagBuilder ¶
func WrappedDagBuilder(params *helpers.DagBuilderParams, spl EnhancedSplitter, hcb HelperAction) (*WrapDagBuilder, error)
func (*WrapDagBuilder) Add ¶
func (w *WrapDagBuilder) Add(node ipld.Node) error
Rewrite the 'Add' method to invoke a callback function to pass back the mapping information of the node.
func (*WrapDagBuilder) Done ¶
func (w *WrapDagBuilder) Done() bool
Rewrite the 'Done' function to make the helper retrieve data from the 'EnhancedSplitter' interface.
func (*WrapDagBuilder) NewLeafDataNode ¶
func (w *WrapDagBuilder) NewLeafDataNode(fsNodeType pb.Data_DataType) (node ipld.Node, dataSize uint64, err error)
Rewrite 'NewLeafDataNode' to cache the 'SliceMeta' information retrieved from the 'EnhancedSplitter'
func (*WrapDagBuilder) Next ¶
func (w *WrapDagBuilder) Next() ([]byte, error)
Rewrite the 'Next' function to make the helper retrieve data from the 'EnhancedSplitter' interface.
type WrapDagService ¶
type WrapDagService struct {
// contains filtered or unexported fields
}
func (*WrapDagService) GetMany ¶
func (wds *WrapDagService) GetMany(ctx context.Context, cids []cid.Cid) <-chan *ipld.NodeOption
func (*WrapDagService) RemoveMany ¶
type WrapWriter ¶
Encapsulate io.Writer. When the Write method is executed, invoke a callback function to notify MappingService about the data that has been written.
type WriteAfterAction ¶
The callback function for WrapWriter.