摘要
详情
定义接口
BlockStat:块状态
类型 | 说明 |
Size() int |
块尺寸 |
Path() path.Resolved |
块路径 |
BlockAPI: 块api
类型 | 说明 |
Put(context.Context, io.Reader, ...options.BlockPutOption) (BlockStat, error) |
放入块 |
Get(context.Context, path.Path) (io.Reader, error) |
根据路径拿块内容 |
Rm(context.Context, path.Path, ...options.BlockRmOption) error |
删除路径 |
Stat(context.Context, path.Path) (BlockStat, error) |
返回块状态 |
CoreAPI:核心api
类型 | 说明 |
Unixfs() UnixfsAPI |
|
Block() BlockAPI |
|
Dag() APIDagService |
|
Name() NameAPI |
|
Key() KeyAPI |
|
Pin() PinAPI |
|
Object() ObjectAPI |
|
Dht() DhtAPI |
|
Swarm() SwarmAPI |
|
PubSub() PubSubAPI |
|
ResolvePath(context.Context, path.Path) (path.Resolved, error) |
|
ResolveNode(context.Context, path.Path) (ipld.Node, error) |
|
WithOptions(...options.ApiOption) (CoreAPI, error) |
APIDagService:dagserv
类型 | 说明 |
ipld.DAGService |
|
Pinning() ipld.NodeAdder |
DhtAPI
类型 | 说明 |
FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) |
|
FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan peer.AddrInfo, error) |
|
Provide(context.Context, path.Path, ...options.DhtProvideOption) error |
Key
类型 | 说明 |
Name() string |
key的名字 |
Path() path.Path |
路径 |
ID() peer.ID |
id |
KeyAPI
类型 | 说明 |
Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) |
|
Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) |
|
List(ctx context.Context) ([]Key, error) |
|
Self(ctx context.Context) (Key, error) |
|
Remove(ctx context.Context, name string) (Key, error) |
IpnsEntry
类型 | 说明 |
Name() string |
|
Value() path.Path |
NameAPI
类型 | 说明 |
Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (IpnsEntry, error) |
|
Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (path.Path, error) |
|
Search(ctx context.Context, name string, opts ...options.NameResolveOption) (<-chan IpnsResult, error) |
定义类型
类型 | 说明 |
type ChangeType int |
定义全局变量
变量名 | 类型 | 值 |
ErrIsDir |
error | errors.New("this dag node is a directory") |
ErrNotFile |
error | errors.New("this dag node is not a regular file") |
ErrOffline |
error | errors.New("this action must be run in online mode, try running 'ipfs daemon' first") |
ErrNotSupported |
error | errors.New("operation not supported") |
DiffAdd |
ChangeType |
0.添加 |
DiffRemove |
ChangeType |
1.删除 |
DiffMod |
ChangeType |
2.修改 |
定义类
IpnsResult
类型 | 说明 |
path.Path |
|
Err error |
ObjectStat