Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
ffeef8c9
Unverified
提交
ffeef8c9
authored
3月 06, 2017
作者:
Jakub Sztandera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: filestore silently being skipped on add if it wasn't enabled
License: MIT Signed-off-by:
Jakub Sztandera
<
kubuxu@protonmail.ch
>
上级
7c707b06
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
5 行删除
+24
-5
add.go
core/commands/add.go
+16
-3
t0270-filestore.sh
test/sharness/t0270-filestore.sh
+8
-2
没有找到文件。
core/commands/add.go
浏览文件 @
ffeef8c9
package
commands
import
(
"errors"
"fmt"
"io"
"github.com/ipfs/go-ipfs/core/coreunix"
"gx/ipfs/QmeWjRodbcZFKe5tMN7poEx3izym6osrLSnTLf9UjJZBbs/pb"
bstore
"github.com/ipfs/go-ipfs/blocks/blockstore"
blockservice
"github.com/ipfs/go-ipfs/blockservice"
cmds
"github.com/ipfs/go-ipfs/commands"
files
"github.com/ipfs/go-ipfs/commands/files"
core
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/coreunix"
offline
"github.com/ipfs/go-ipfs/exchange/offline"
dag
"github.com/ipfs/go-ipfs/merkledag"
dagtest
"github.com/ipfs/go-ipfs/merkledag/test"
mfs
"github.com/ipfs/go-ipfs/mfs"
ft
"github.com/ipfs/go-ipfs/unixfs"
u
"gx/ipfs/QmZuY8aV7zbNXVy6DyN9SmnuH3o9nG852F4aTiSBpts8d1/go-ipfs-util"
"gx/ipfs/QmeWjRodbcZFKe5tMN7poEx3izym6osrLSnTLf9UjJZBbs/pb"
)
// Error indicating the max depth has been exceded.
...
...
@@ -128,6 +129,12 @@ You can now refer to the added file in a gateway, like so:
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
cfg
,
err
:=
n
.
Repo
.
Config
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
// check if repo will exceed storage limit if added
// TODO: this doesn't handle the case if the hashed file is already in blocks (deduplicated)
// TODO: conditional GC is disabled due to it is somehow not possible to pass the size to the daemon
...
...
@@ -148,6 +155,12 @@ You can now refer to the added file in a gateway, like so:
nocopy
,
_
,
_
:=
req
.
Option
(
noCopyOptionName
)
.
Bool
()
fscache
,
_
,
_
:=
req
.
Option
(
fstoreCacheOptionName
)
.
Bool
()
if
nocopy
&&
!
cfg
.
Experimental
.
FilestoreEnabled
{
res
.
SetError
(
errors
.
New
(
"filestore is not enabled, see https://git.io/vy4XN"
),
cmds
.
ErrClient
)
return
}
if
nocopy
&&
!
rbset
{
rawblks
=
true
}
...
...
test/sharness/t0270-filestore.sh
浏览文件 @
ffeef8c9
...
...
@@ -24,7 +24,7 @@ assert_repo_size_less_than() {
test_expect_success
"check repo size"
'
test "$(get_repo_size)" -lt "$expval" ||
(get_repo_size && false)
test_fsh get_repo_size
'
}
...
...
@@ -33,7 +33,7 @@ assert_repo_size_greater_than() {
test_expect_success
"check repo size"
'
test "$(get_repo_size)" -gt "$expval" ||
(get_repo_size && false)
test_fsh get_repo_size
'
}
...
...
@@ -68,6 +68,12 @@ init_ipfs_filestore() {
test_init_ipfs
test_expect_success
"nocopy add errors and has right message"
'
test_must_fail ipfs add --nocopy -r somedir 2> add_out &&
grep "filestore is not enabled" add_out
'
test_expect_success
"enable filestore config setting"
'
ipfs config --json Experimental.FilestoreEnabled true
'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论