1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00
Files
Steven Allen 85acad9a01 gx update go-log, sys, go-crypto
* go-log
* sys
* go-crypto

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2018-06-08 22:36:24 -07:00

69 lines
2.1 KiB
Go

package iface
import (
"context"
"io"
options "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format"
cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid"
)
// ObjectStat provides information about dag nodes
type ObjectStat struct {
// Cid is the CID of the node
Cid *cid.Cid
// NumLinks is number of links the node contains
NumLinks int
// BlockSize is size of the raw serialized node
BlockSize int
// LinksSize is size of the links block section
LinksSize int
// DataSize is the size of data block section
DataSize int
// CumulativeSize is size of the tree (BlockSize + link sizes)
CumulativeSize int
}
// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities
// for manipulating MerkleDAG data structures.
type ObjectAPI interface {
// New creates new, empty (by default) dag-node.
New(context.Context, ...options.ObjectNewOption) (ipld.Node, error)
// Put imports the data into merkledag
Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error)
// Get returns the node for the path
Get(context.Context, Path) (ipld.Node, error)
// Data returns reader for data of the node
Data(context.Context, Path) (io.Reader, error)
// Links returns lint or links the node contains
Links(context.Context, Path) ([]*ipld.Link, error)
// Stat returns information about the node
Stat(context.Context, Path) (*ObjectStat, error)
// AddLink adds a link under the specified path. child path can point to a
// subdirectory within the patent which must be present (can be overridden
// with WithCreate option).
AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error)
// RmLink removes a link from the node
RmLink(ctx context.Context, base Path, link string) (Path, error)
// AppendData appends data to the node
AppendData(context.Context, Path, io.Reader) (Path, error)
// SetData sets the data contained in the node
SetData(context.Context, Path, io.Reader) (Path, error)
}