Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
60039f27
提交
60039f27
authored
7月 25, 2018
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
object coreapi: Address review
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
36c6fb35
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
17 行增加
和
18 行删除
+17
-18
request.go
commands/request.go
+0
-6
env.go
core/commands/env.go
+4
-2
patch.go
core/commands/object/patch.go
+1
-1
object.go
core/coreapi/interface/object.go
+8
-6
diff.go
dagutils/diff.go
+4
-3
没有找到文件。
commands/request.go
浏览文件 @
60039f27
...
...
@@ -68,12 +68,6 @@ func (c *Context) GetApi() (coreiface.CoreAPI, error) {
return
c
.
api
,
nil
}
// NodeWithoutConstructing returns the underlying node variable
// so that clients may close it.
func
(
c
*
Context
)
NodeWithoutConstructing
()
*
core
.
IpfsNode
{
return
c
.
node
}
// Context returns the node's context.
func
(
c
*
Context
)
Context
()
context
.
Context
{
n
,
err
:=
c
.
GetNode
()
...
...
core/commands/env.go
浏览文件 @
60039f27
...
...
@@ -7,6 +7,8 @@ import (
"github.com/ipfs/go-ipfs/core"
coreiface
"github.com/ipfs/go-ipfs/core/coreapi/interface"
"github.com/ipfs/go-ipfs/repo/config"
cmds
"gx/ipfs/QmNueRyPRQiV7PUEpnP4GgGLuK1rKQLaRW7sfPvUetYig1/go-ipfs-cmds"
)
// GetNode extracts the node from the environment.
...
...
@@ -20,7 +22,7 @@ func GetNode(env interface{}) (*core.IpfsNode, error) {
}
// GetApi extracts CoreAPI instance from the environment.
func
GetApi
(
env
interface
{}
)
(
coreiface
.
CoreAPI
,
error
)
{
func
GetApi
(
env
cmds
.
Environment
)
(
coreiface
.
CoreAPI
,
error
)
{
ctx
,
ok
:=
env
.
(
*
commands
.
Context
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"expected env to be of type %T, got %T"
,
ctx
,
env
)
...
...
@@ -30,7 +32,7 @@ func GetApi(env interface{}) (coreiface.CoreAPI, error) {
}
// GetConfig extracts the config from the environment.
func
GetConfig
(
env
interface
{}
)
(
*
config
.
Config
,
error
)
{
func
GetConfig
(
env
cmds
.
Environment
)
(
*
config
.
Config
,
error
)
{
ctx
,
ok
:=
env
.
(
*
commands
.
Context
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"expected env to be of type %T, got %T"
,
ctx
,
env
)
...
...
core/commands/object/patch.go
浏览文件 @
60039f27
...
...
@@ -254,7 +254,7 @@ to a file containing 'bar', and returns the hash of the new object.
// TODO: fix import loop with core/commands so we don't need that
// COPIED FROM ONE LEVEL UP
// GetApi extracts CoreAPI instance from the environment.
func
GetApi
(
env
interface
{}
)
(
coreiface
.
CoreAPI
,
error
)
{
func
GetApi
(
env
cmds
.
Environment
)
(
coreiface
.
CoreAPI
,
error
)
{
ctx
,
ok
:=
env
.
(
*
oldcmds
.
Context
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"expected env to be of type %T, got %T"
,
ctx
,
env
)
...
...
core/coreapi/interface/object.go
浏览文件 @
60039f27
...
...
@@ -31,25 +31,27 @@ type ObjectStat struct {
CumulativeSize
int
}
// ChangeType denotes type of change in ObjectChange
type
ChangeType
int
const
(
// DiffAdd is
a Type of ObjectChange where
a link was added to the graph
DiffAdd
=
iota
// DiffAdd is
set when
a link was added to the graph
DiffAdd
ChangeType
=
iota
// DiffRemove is
a Type of ObjectChange where
a link was removed from the graph
// DiffRemove is
set when
a link was removed from the graph
DiffRemove
// DiffMod is
a Type of ObjectChange where
a link was changed in the graph
// DiffMod is
set when
a link was changed in the graph
DiffMod
)
// ObjectChange represents a change ia a graph
// TODO: do we want this to be an interface?
type
ObjectChange
struct
{
// Type of the change, either:
// * DiffAdd - Added a link
// * DiffRemove - Removed a link
// * DiffMod - Modified a link
Type
int
Type
ChangeType
// Path to the changed link
Path
string
...
...
dagutils/diff.go
浏览文件 @
60039f27
...
...
@@ -5,9 +5,10 @@ import (
"fmt"
"path"
dag
"gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag
"
coreiface
"github.com/ipfs/go-ipfs/core/coreapi/interface
"
cid
"gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
dag
"gx/ipfs/QmRy4Qk9hbgFX9NGJRm8rBThrA8PZhNCitMgeRYyZ67s59/go-merkledag"
"gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld
"gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
)
...
...
@@ -21,7 +22,7 @@ const (
// Change represents a change to a DAG and contains a reference to the old and
// new CIDs.
type
Change
struct
{
Type
int
Type
coreiface
.
ChangeType
Path
string
Before
*
cid
.
Cid
After
*
cid
.
Cid
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论