Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
8dd970b7
提交
8dd970b7
authored
6月 26, 2018
作者:
Kevin Atkinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
filestore: Return consistent err msg. when file/urlstore is not enabled.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
上级
6a4b1262
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
13 行增加
和
8 行删除
+13
-8
add.go
core/commands/add.go
+2
-2
filestore.go
core/commands/filestore.go
+1
-1
urlstore.go
core/commands/urlstore.go
+2
-1
filestore.go
filestore/filestore.go
+4
-0
fsrefstore.go
filestore/fsrefstore.go
+4
-4
没有找到文件。
core/commands/add.go
浏览文件 @
8dd970b7
...
...
@@ -10,6 +10,7 @@ import (
blockservice
"github.com/ipfs/go-ipfs/blockservice"
core
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/coreunix"
filestore
"github.com/ipfs/go-ipfs/filestore"
dag
"github.com/ipfs/go-ipfs/merkledag"
dagtest
"github.com/ipfs/go-ipfs/merkledag/test"
mfs
"github.com/ipfs/go-ipfs/mfs"
...
...
@@ -183,8 +184,7 @@ You can now check what blocks have been created by:
// nocopy -> filestoreEnabled
if
nocopy
&&
!
cfg
.
Experimental
.
FilestoreEnabled
{
res
.
SetError
(
errors
.
New
(
"filestore is not enabled, see https://git.io/vNItf"
),
cmdkit
.
ErrClient
)
res
.
SetError
(
filestore
.
ErrFilestoreNotEnabled
,
cmdkit
.
ErrClient
)
return
}
...
...
core/commands/filestore.go
浏览文件 @
8dd970b7
...
...
@@ -237,7 +237,7 @@ func getFilestore(env interface{}) (*core.IpfsNode, *filestore.Filestore, error)
}
fs
:=
n
.
Filestore
if
fs
==
nil
{
return
n
,
nil
,
f
mt
.
Errorf
(
"filestore not enabled"
)
return
n
,
nil
,
f
ilestore
.
ErrFilestoreNotEnabled
}
return
n
,
fs
,
err
}
...
...
core/commands/urlstore.go
浏览文件 @
8dd970b7
...
...
@@ -7,6 +7,7 @@ import (
"strings"
cmds
"github.com/ipfs/go-ipfs/commands"
filestore
"github.com/ipfs/go-ipfs/filestore"
balanced
"github.com/ipfs/go-ipfs/importer/balanced"
ihelper
"github.com/ipfs/go-ipfs/importer/helpers"
...
...
@@ -63,7 +64,7 @@ time.
}
if
!
cfg
.
Experimental
.
UrlstoreEnabled
{
res
.
SetError
(
f
mt
.
Errorf
(
"URL store not enabled."
)
,
cmdkit
.
ErrNormal
)
res
.
SetError
(
f
ilestore
.
ErrUrlstoreNotEnabled
,
cmdkit
.
ErrNormal
)
return
}
...
...
filestore/filestore.go
浏览文件 @
8dd970b7
...
...
@@ -9,6 +9,7 @@ package filestore
import
(
"context"
"errors"
blocks
"gx/ipfs/QmTRCUvZLiir12Qr6MV3HKfKMHX8Nf1Vddn6t2g5nsQSb9/go-block-format"
posinfo
"gx/ipfs/QmUWsXLvYYDAaoAt9TPZpFX4ffHHMg46AHrz1ZLTN5ABbe/go-ipfs-posinfo"
...
...
@@ -20,6 +21,9 @@ import (
var
log
=
logging
.
Logger
(
"filestore"
)
var
ErrFilestoreNotEnabled
=
errors
.
New
(
"filestore is not enabled, see https://git.io/vNItf"
)
var
ErrUrlstoreNotEnabled
=
errors
.
New
(
"urlstore is not enabled"
)
// Filestore implements a Blockstore by combining a standard Blockstore
// to store regular blocks and a special Blockstore called
// FileManager to store blocks which data exists in an external file.
...
...
filestore/fsrefstore.go
浏览文件 @
8dd970b7
...
...
@@ -159,7 +159,7 @@ func unmarshalDataObj(o interface{}) (*pb.DataObj, error) {
func
(
f
*
FileManager
)
readFileDataObj
(
c
*
cid
.
Cid
,
d
*
pb
.
DataObj
)
([]
byte
,
error
)
{
if
!
f
.
AllowFiles
{
return
nil
,
fmt
.
Errorf
(
"filestore not enabled"
)
return
nil
,
ErrFilestoreNotEnabled
}
p
:=
filepath
.
FromSlash
(
d
.
GetFilePath
())
...
...
@@ -202,7 +202,7 @@ func (f *FileManager) readFileDataObj(c *cid.Cid, d *pb.DataObj) ([]byte, error)
// reads and verifies the block from URL
func
(
f
*
FileManager
)
readURLDataObj
(
c
*
cid
.
Cid
,
d
*
pb
.
DataObj
)
([]
byte
,
error
)
{
if
!
f
.
AllowUrls
{
return
nil
,
fmt
.
Errorf
(
"urlstore not enabled"
)
return
nil
,
ErrUrlstoreNotEnabled
}
req
,
err
:=
http
.
NewRequest
(
"GET"
,
d
.
GetFilePath
(),
nil
)
...
...
@@ -267,12 +267,12 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error {
if
IsURL
(
b
.
PosInfo
.
FullPath
)
{
if
!
f
.
AllowUrls
{
return
fmt
.
Errorf
(
"urlstore not enabled"
)
return
ErrUrlstoreNotEnabled
}
dobj
.
FilePath
=
proto
.
String
(
b
.
PosInfo
.
FullPath
)
}
else
{
if
!
f
.
AllowFiles
{
return
fmt
.
Errorf
(
"filestore not enabled"
)
return
ErrFilestoreNotEnabled
}
if
!
filepath
.
HasPrefix
(
b
.
PosInfo
.
FullPath
,
f
.
root
)
{
return
fmt
.
Errorf
(
"cannot add filestore references outside ipfs root (%s)"
,
f
.
root
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论