Documentation ¶
Index ¶
- Variables
- type DagModifier
- func (dm *DagModifier) CtxReadFull(ctx context.Context, b []byte) (int, error)
- func (dm *DagModifier) GetNode() (node.Node, error)
- func (dm *DagModifier) HasChanges() bool
- func (dm *DagModifier) Read(b []byte) (int, error)
- func (dm *DagModifier) Seek(offset int64, whence int) (int64, error)
- func (dm *DagModifier) Size() (int64, error)
- func (dm *DagModifier) Sync() error
- func (dm *DagModifier) Truncate(size int64) error
- func (dm *DagModifier) Write(b []byte) (int, error)
- func (dm *DagModifier) WriteAt(b []byte, offset int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotUnixfs = fmt.Errorf("dagmodifier only supports unixfs nodes (proto or raw)")
var ErrSeekFail = errors.New("failed to seek properly")
var ErrUnrecognizedWhence = errors.New("unrecognized whence")
Functions ¶
This section is empty.
Types ¶
type DagModifier ¶
type DagModifier struct { Prefix cid.Prefix RawLeaves bool // contains filtered or unexported fields }
DagModifier is the only struct licensed and able to correctly perform surgery on a DAG 'file' Dear god, please rename this to something more pleasant
func NewDagModifier ¶
func NewDagModifier(ctx context.Context, from node.Node, serv mdag.DAGService, spl chunk.SplitterGen) (*DagModifier, error)
NewDagModifier returns a new DagModifier, the Cid prefix for newly created nodes will be inherted from the passed in node. If the Cid version if not 0 raw leaves will also be enabled. The Prefix and RawLeaves options can be overridden by changing them after the call.
func (*DagModifier) CtxReadFull ¶
Read data from this dag starting at the current offset
func (*DagModifier) GetNode ¶
func (dm *DagModifier) GetNode() (node.Node, error)
GetNode gets the modified DAG Node
func (*DagModifier) HasChanges ¶
func (dm *DagModifier) HasChanges() bool
HasChanges returned whether or not there are unflushed changes to this dag
func (*DagModifier) Read ¶
func (dm *DagModifier) Read(b []byte) (int, error)
Read data from this dag starting at the current offset
func (*DagModifier) Size ¶
func (dm *DagModifier) Size() (int64, error)
Size returns the Filesize of the node
func (*DagModifier) Sync ¶
func (dm *DagModifier) Sync() error
Sync writes changes to this dag to disk
func (*DagModifier) Truncate ¶
func (dm *DagModifier) Truncate(size int64) error