Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
b818679c
Unverified
提交
b818679c
authored
7月 22, 2018
作者:
Whyrusleeping
提交者:
GitHub
7月 22, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5117 from ipfs/kevina/idhash0
Add initial support for identity hashes (Part 1)
上级
1dede1b1
c8613b43
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
80 行增加
和
4 行删除
+80
-4
builder.go
core/builder.go
+6
-4
t0046-id-hash.sh
test/sharness/t0046-id-hash.sh
+74
-0
没有找到文件。
core/builder.go
浏览文件 @
b818679c
...
...
@@ -204,18 +204,20 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
opts
.
HasBloomFilterSize
=
0
}
c
bs
,
err
:=
bstore
.
CachedBlockstore
(
ctx
,
bs
,
opts
)
w
bs
,
err
:=
bstore
.
CachedBlockstore
(
ctx
,
bs
,
opts
)
if
err
!=
nil
{
return
err
}
n
.
BaseBlocks
=
cbs
wbs
=
bstore
.
NewIdStore
(
wbs
)
n
.
BaseBlocks
=
wbs
n
.
GCLocker
=
bstore
.
NewGCLocker
()
n
.
Blockstore
=
bstore
.
NewGCBlockstore
(
c
bs
,
n
.
GCLocker
)
n
.
Blockstore
=
bstore
.
NewGCBlockstore
(
w
bs
,
n
.
GCLocker
)
if
conf
.
Experimental
.
FilestoreEnabled
||
conf
.
Experimental
.
UrlstoreEnabled
{
// hash security
n
.
Filestore
=
filestore
.
NewFilestore
(
c
bs
,
n
.
Repo
.
FileManager
())
n
.
Filestore
=
filestore
.
NewFilestore
(
w
bs
,
n
.
Repo
.
FileManager
())
n
.
Blockstore
=
bstore
.
NewGCBlockstore
(
n
.
Filestore
,
n
.
GCLocker
)
n
.
Blockstore
=
&
verifbs
.
VerifBSGC
{
GCBlockstore
:
n
.
Blockstore
}
}
...
...
test/sharness/t0046-id-hash.sh
0 → 100755
浏览文件 @
b818679c
#!/usr/bin/env bash
test_description
=
"Test basic operations with identity hash"
.
lib/test-lib.sh
test_init_ipfs
ID_HASH0
=
z25RnHTQ7DveGAsV6YDSDR8EkWvD
ID_HASH0_CONTENTS
=
jkD98jkD975hkD8
test_expect_success
"can fetch random id hash"
'
ipfs cat $ID_HASH0 > expected &&
echo $ID_HASH0_CONTENTS > actual &&
test_cmp expected actual
'
test_expect_success
"can pin random id hash"
'
ipfs pin add $ID_HASH0
'
test_expect_success
"ipfs add succeeds with id hash"
'
echo "djkd7jdkd7jkHHG" > junk.txt &&
HASH=$(ipfs add -q --hash=id junk.txt)
'
test_expect_success
"content not actually added"
'
ipfs refs local | fgrep -q -v $HASH
'
test_expect_success
"but can fetch it anyway"
'
ipfs cat $HASH > actual &&
test_cmp junk.txt actual
'
test_expect_success
"block rm does nothing"
'
ipfs pin rm $HASH &&
ipfs block rm $HASH
'
test_expect_success
"can still fetch it"
'
ipfs cat $HASH > actual
test_cmp junk.txt actual
'
test_expect_success
"enable filestore"
'
ipfs config --json Experimental.FilestoreEnabled true
'
test_expect_success
"can fetch random id hash (filestore enabled)"
'
ipfs cat $ID_HASH0 > expected &&
echo $ID_HASH0_CONTENTS > actual &&
test_cmp expected actual
'
test_expect_success
"can pin random id hash (filestore enabled)"
'
ipfs pin add $ID_HASH0
'
test_expect_success
"ipfs add succeeds with id hash and --nocopy"
'
echo "djkd7jdkd7jkHHG" > junk.txt &&
HASH=$(ipfs add -q --hash=id --nocopy junk.txt)
'
test_expect_success
"content not actually added (filestore enabled)"
'
ipfs refs local | fgrep -q -v $HASH
'
test_expect_success
"but can fetch it anyway (filestore enabled)"
'
ipfs cat $HASH > actual &&
test_cmp junk.txt actual
'
test_done
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论