Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
082498de
提交
082498de
authored
6月 12, 2018
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
coreapi: more docs for ResolvedPath
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
0adb69a7
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
35 行增加
和
6 行删除
+35
-6
path.go
core/coreapi/interface/path.go
+35
-6
没有找到文件。
core/coreapi/interface/path.go
浏览文件 @
082498de
...
@@ -29,13 +29,38 @@ type Path interface {
...
@@ -29,13 +29,38 @@ type Path interface {
Mutable
()
bool
Mutable
()
bool
}
}
// ResolvedPath is a
resolved Path
// ResolvedPath is a
path which was resolved to the last resolvable node
type
ResolvedPath
interface
{
type
ResolvedPath
interface
{
// Cid returns the CID of the object referenced by the path.
// Cid returns the CID of the node referenced by the path. Remainder of the
// path is guaranteed to be within the node.
//
//
// Example:
// Examples:
// If you have 3 linked objects: QmRoot -> A -> B, and resolve path
// If you have 3 linked objects: QmRoot -> A -> B:
// "/ipfs/QmRoot/A/B", the Cid method will return the CID of object B
//
// cidB := {"foo": {"bar": 42 }}
// cidA := {"B": {"/": cidB }}
// cidRoot := {"A": {"/": cidA }}
//
// And resolve paths:
// * "/ipfs/${cidRoot}"
// * Calling Cid() will return `cidRoot`
// * Calling Root() will return `cidRoot`
// * Calling Remainder() will return ``
//
// * "/ipfs/${cidRoot}/A"
// * Calling Cid() will return `cidA`
// * Calling Root() will return `cidRoot`
// * Calling Remainder() will return ``
//
// * "/ipfs/${cidRoot}/A/B/foo"
// * Calling Cid() will return `cidB`
// * Calling Root() will return `cidRoot`
// * Calling Remainder() will return `foo`
//
// * "/ipfs/${cidRoot}/A/B/foo/bar"
// * Calling Cid() will return `cidB`
// * Calling Root() will return `cidRoot`
// * Calling Remainder() will return `foo/bar`
Cid
()
*
cid
.
Cid
Cid
()
*
cid
.
Cid
// Root returns the CID of the root object of the path
// Root returns the CID of the root object of the path
...
@@ -43,6 +68,8 @@ type ResolvedPath interface {
...
@@ -43,6 +68,8 @@ type ResolvedPath interface {
// Example:
// Example:
// If you have 3 linked objects: QmRoot -> A -> B, and resolve path
// If you have 3 linked objects: QmRoot -> A -> B, and resolve path
// "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot
// "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot
//
// For more examples see the documentation of Cid() method
Root
()
*
cid
.
Cid
Root
()
*
cid
.
Cid
// Remainder returns unresolved part of the path
// Remainder returns unresolved part of the path
...
@@ -51,9 +78,11 @@ type ResolvedPath interface {
...
@@ -51,9 +78,11 @@ type ResolvedPath interface {
// If you have 2 linked objects: QmRoot -> A, where A is a CBOR node
// If you have 2 linked objects: QmRoot -> A, where A is a CBOR node
// containing the following data:
// containing the following data:
//
//
// {"foo": {"bar": 42}}
// {"foo": {"bar": 42
}}
//
//
// When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar"
// When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar"
//
// For more examples see the documentation of Cid() method
Remainder
()
string
Remainder
()
string
Path
Path
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论