提交 a3bd2c23 作者: Kevin Atkinson

Add "--raw-leaves" option to "ipfs files"

License: MIT
Signed-off-by: 's avatarKevin Atkinson <k@kevina.org>
上级 7302c3ab
......@@ -43,6 +43,7 @@ operations.
},
Options: []cmds.Option{
cmds.BoolOption("f", "flush", "Flush target and ancestors after write.").Default(true),
cmds.BoolOption("raw-leaves", "Use raw blocks for newly created leaf nodes. (experimental)"),
},
Subcommands: map[string]*cmds.Command{
"read": FilesReadCmd,
......@@ -598,6 +599,7 @@ stat' on the file or any of its ancestors.
create, _, _ := req.Option("create").Bool()
trunc, _, _ := req.Option("truncate").Bool()
flush, _, _ := req.Option("flush").Bool()
rawLeaves, _, _ := req.Option("raw-leaves").Bool()
nd, err := req.InvocContext().GetNode()
if err != nil {
......@@ -620,6 +622,7 @@ stat' on the file or any of its ancestors.
res.SetError(err, cmds.ErrNormal)
return
}
fi.RawLeaves = rawLeaves
wfd, err := fi.Open(mfs.OpenWriteOnly, flush)
if err != nil {
......
......@@ -23,6 +23,8 @@ type File struct {
dserv dag.DAGService
node node.Node
nodelk sync.Mutex
RawLeaves bool
}
// NewFile returns a NewFile object with the given parameters
......@@ -79,6 +81,7 @@ func (fi *File) Open(flags int, sync bool) (FileDescriptor, error) {
if err != nil {
return nil, err
}
dmod.RawLeaves = fi.RawLeaves
return &fileDescriptor{
inode: fi,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论