Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
94f55f2d
提交
94f55f2d
authored
2月 28, 2015
作者:
Henry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added implements check for root types and fixed remaining interfaces on nodes
上级
335caf0b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
36 行增加
和
16 行删除
+36
-16
ipns_unix.go
fuse/ipns/ipns_unix.go
+22
-11
readonly_unix.go
fuse/readonly/readonly_unix.go
+14
-5
没有找到文件。
fuse/ipns/ipns_unix.go
浏览文件 @
94f55f2d
...
...
@@ -167,7 +167,7 @@ func (*Root) Attr() fuse.Attr {
}
// Lookup performs a lookup under this node.
func
(
s
*
Root
)
Lookup
(
name
string
,
ctx
context
.
Context
)
(
fs
.
Node
,
error
)
{
func
(
s
*
Root
)
Lookup
(
ctx
context
.
Context
,
name
string
)
(
fs
.
Node
,
error
)
{
switch
name
{
case
"mach_kernel"
,
".hidden"
,
"._."
:
// Just quiet some log noise on OS X.
...
...
@@ -195,8 +195,8 @@ func (s *Root) Lookup(name string, ctx context.Context) (fs.Node, error) {
return
&
Link
{
s
.
IpfsRoot
+
"/"
+
resolved
.
B58String
()},
nil
}
// ReadDir reads a particular directory. Disallowed for root.
func
(
r
*
Root
)
ReadDir
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
// ReadDir
All
reads a particular directory. Disallowed for root.
func
(
r
*
Root
)
ReadDir
All
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
listing
:=
[]
fuse
.
Dirent
{
fuse
.
Dirent
{
Name
:
"local"
,
...
...
@@ -285,7 +285,7 @@ func (s *Node) Attr() fuse.Attr {
}
// Lookup performs a lookup under this node.
func
(
s
*
Node
)
Lookup
(
name
string
,
ctx
context
.
Context
)
(
fs
.
Node
,
error
)
{
func
(
s
*
Node
)
Lookup
(
ctx
context
.
Context
,
name
string
)
(
fs
.
Node
,
error
)
{
nodes
,
err
:=
s
.
Ipfs
.
Resolver
.
ResolveLinks
(
s
.
Nd
,
[]
string
{
name
})
if
err
!=
nil
{
// todo: make this error more versatile.
...
...
@@ -314,8 +314,8 @@ func (n *Node) makeChild(name string, node *mdag.Node) *Node {
return
child
}
// ReadDir reads the link structure as directory entries
func
(
s
*
Node
)
ReadDir
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
// ReadDir
All
reads the link structure as directory entries
func
(
s
*
Node
)
ReadDir
All
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
entries
:=
make
([]
fuse
.
Dirent
,
len
(
s
.
Nd
.
Links
))
for
i
,
link
:=
range
s
.
Nd
.
Links
{
n
:=
link
.
Name
...
...
@@ -331,7 +331,7 @@ func (s *Node) ReadDir(ctx context.Context) ([]fuse.Dirent, error) {
return
nil
,
fuse
.
ENOENT
}
func
(
s
*
Node
)
Read
(
req
*
fuse
.
ReadRequest
,
resp
*
fuse
.
ReadResponse
,
ctx
context
.
Context
)
error
{
func
(
s
*
Node
)
Read
(
ctx
context
.
Context
,
req
*
fuse
.
ReadRequest
,
resp
*
fuse
.
ReadResponse
)
error
{
k
,
err
:=
s
.
Nd
.
Key
()
if
err
!=
nil
{
return
err
...
...
@@ -627,17 +627,28 @@ func (n *Node) update(name string, newnode *mdag.Node) error {
}
// to check that out Node implements all the interfaces we want
type
ipns
Node
interface
{
type
ipns
Root
interface
{
fs
.
Node
fs
.
HandleWriter
fs
.
HandleReadDirAller
fs
.
NodeStringLookuper
}
var
_
ipnsRoot
=
(
*
Root
)(
nil
)
type
ipnsNode
interface
{
fs
.
HandleFlusher
fs
.
HandleReadDirAller
fs
.
HandleReader
fs
.
HandleWriter
fs
.
Node
fs
.
NodeCreater
fs
.
NodeFsyncer
fs
.
NodeMkdirer
fs
.
NodeOpener
fs
.
NodeMknoder
fs
.
Node
Creat
er
fs
.
Node
Open
er
fs
.
NodeRemover
fs
.
NodeRenamer
fs
.
NodeStringLookuper
}
var
_
ipnsNode
=
(
*
Node
)(
nil
)
fuse/readonly/readonly_unix.go
浏览文件 @
94f55f2d
...
...
@@ -67,8 +67,8 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
return
&
Node
{
Ipfs
:
s
.
Ipfs
,
Nd
:
nd
},
nil
}
// ReadDir reads a particular directory. Disallowed for root.
func
(
*
Root
)
ReadDir
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
// ReadDir
All
reads a particular directory. Disallowed for root.
func
(
*
Root
)
ReadDir
All
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
log
.
Debug
(
"Read Root."
)
return
nil
,
fuse
.
EPERM
}
...
...
@@ -127,8 +127,8 @@ func (s *Node) Lookup(ctx context.Context, name string) (fs.Node, error) {
return
&
Node
{
Ipfs
:
s
.
Ipfs
,
Nd
:
nodes
[
len
(
nodes
)
-
1
]},
nil
}
// ReadDir reads the link structure as directory entries
func
(
s
*
Node
)
ReadDir
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
// ReadDir
All
reads the link structure as directory entries
func
(
s
*
Node
)
ReadDir
All
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
log
.
Debug
(
"Node ReadDir"
)
entries
:=
make
([]
fuse
.
Dirent
,
len
(
s
.
Nd
.
Links
))
for
i
,
link
:=
range
s
.
Nd
.
Links
{
...
...
@@ -180,10 +180,19 @@ func (s *Node) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadR
}
// to check that out Node implements all the interfaces we want
type
ro
Node
interface
{
type
ro
Root
interface
{
fs
.
Node
fs
.
HandleReadDirAller
fs
.
NodeStringLookuper
}
var
_
roRoot
=
(
*
Root
)(
nil
)
type
roNode
interface
{
fs
.
HandleReadDirAller
fs
.
HandleReader
fs
.
Node
fs
.
NodeStringLookuper
}
var
_
roNode
=
(
*
Node
)(
nil
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论