Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
a98a4f40
Unverified
提交
a98a4f40
authored
3月 25, 2018
作者:
Whyrusleeping
提交者:
GitHub
3月 25, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4873 from ipfs/fix/4871
make the tar writer handle sharded ipfs directories
上级
d4a43550
71a0a5c8
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
20 行增加
和
13 行删除
+20
-13
ls.go
core/commands/unixfs/ls.go
+4
-0
t0260-sharding.sh
test/sharness/t0260-sharding.sh
+5
-1
writer.go
unixfs/archive/tar/writer.go
+10
-11
pbdagreader.go
unixfs/io/pbdagreader.go
+1
-1
没有找到文件。
core/commands/unixfs/ls.go
浏览文件 @
a98a4f40
...
...
@@ -137,6 +137,10 @@ possible, please use 'ipfs ls' instead.
switch
t
{
case
unixfspb
.
Data_File
:
break
case
unixfspb
.
Data_HAMTShard
:
// We need a streaming ls API for this.
res
.
SetError
(
fmt
.
Errorf
(
"cannot list large directories yet"
),
cmdkit
.
ErrNormal
)
return
case
unixfspb
.
Data_Directory
:
links
:=
make
([]
LsLink
,
len
(
merkleNode
.
Links
()))
output
.
Objects
[
hash
]
.
Links
=
links
...
...
test/sharness/t0260-sharding
-flag
.sh
→
test/sharness/t0260-sharding.sh
浏览文件 @
a98a4f40
...
...
@@ -4,7 +4,7 @@
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test
global enable sharding fla
g"
test_description
=
"Test
directory shardin
g"
.
lib/test-lib.sh
...
...
@@ -23,6 +23,10 @@ test_add_large_dir() {
echo "$exphash" > sharddir_exp &&
test_cmp sharddir_exp sharddir_out
'
test_expect_success
"ipfs get on very large directory succeeds"
'
ipfs get -o testdata-out "$exphash" &&
test_cmp testdata testdata-out
'
}
test_init_ipfs
...
...
unixfs/archive/tar/writer.go
浏览文件 @
a98a4f40
...
...
@@ -39,23 +39,22 @@ func NewWriter(ctx context.Context, dag ipld.DAGService, archive bool, compressi
}
func
(
w
*
Writer
)
writeDir
(
nd
*
mdag
.
ProtoNode
,
fpath
string
)
error
{
dir
,
err
:=
uio
.
NewDirectoryFromNode
(
w
.
Dag
,
nd
)
if
err
!=
nil
{
return
err
}
if
err
:=
writeDirHeader
(
w
.
TarW
,
fpath
);
err
!=
nil
{
return
err
}
for
i
,
ng
:=
range
ipld
.
GetDAG
(
w
.
ctx
,
w
.
Dag
,
nd
)
{
child
,
err
:=
ng
.
Get
(
w
.
ctx
)
return
dir
.
ForEachLink
(
w
.
ctx
,
func
(
l
*
ipld
.
Link
)
error
{
child
,
err
:=
w
.
Dag
.
Get
(
w
.
ctx
,
l
.
Cid
)
if
err
!=
nil
{
return
err
}
npath
:=
path
.
Join
(
fpath
,
nd
.
Links
()[
i
]
.
Name
)
if
err
:=
w
.
WriteNode
(
child
,
npath
);
err
!=
nil
{
return
err
}
}
return
nil
npath
:=
path
.
Join
(
fpath
,
l
.
Name
)
return
w
.
WriteNode
(
child
,
npath
)
})
}
func
(
w
*
Writer
)
writeFile
(
nd
*
mdag
.
ProtoNode
,
pb
*
upb
.
Data
,
fpath
string
)
error
{
...
...
@@ -83,7 +82,7 @@ func (w *Writer) WriteNode(nd ipld.Node, fpath string) error {
switch
pb
.
GetType
()
{
case
upb
.
Data_Metadata
:
fallthrough
case
upb
.
Data_Directory
:
case
upb
.
Data_Directory
,
upb
.
Data_HAMTShard
:
return
w
.
writeDir
(
nd
,
fpath
)
case
upb
.
Data_Raw
:
fallthrough
...
...
unixfs/io/pbdagreader.go
浏览文件 @
a98a4f40
...
...
@@ -112,7 +112,7 @@ func (dr *PBDagReader) precalcNextBuf(ctx context.Context) error {
}
switch
pb
.
GetType
()
{
case
ftpb
.
Data_Directory
:
case
ftpb
.
Data_Directory
,
ftpb
.
Data_HAMTShard
:
// A directory should not exist within a file
return
ft
.
ErrInvalidDirLocation
case
ftpb
.
Data_File
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论