Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
3d79102e
Commit
3d79102e
authored
Mar 19, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return CID from 'ipfs files flush'
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
ca97b111
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
core/commands/files.go
core/commands/files.go
+19
-4
No files found.
core/commands/files.go
View file @
3d79102e
...
...
@@ -347,7 +347,7 @@ var filesCpCmd = &cmds.Command{
}
if
flush
{
err
:=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
dst
)
_
,
err
:=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
dst
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"cp: cannot flush the created file %s: %s"
,
dst
,
err
)
}
...
...
@@ -649,7 +649,7 @@ Example:
err
=
mfs
.
Mv
(
nd
.
FilesRoot
,
src
,
dst
)
if
err
==
nil
&&
flush
{
err
=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
"/"
)
_
,
err
=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
"/"
)
}
return
err
},
...
...
@@ -856,6 +856,10 @@ Examples:
},
}
type
flushRes
struct
{
Cid
string
}
var
filesFlushCmd
=
&
cmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Flush a given path's data to disk."
,
...
...
@@ -873,13 +877,24 @@ are run with the '--flush=false'.
return
err
}
enc
,
err
:=
cmdenv
.
GetCidEncoder
(
req
)
if
err
!=
nil
{
return
err
}
path
:=
"/"
if
len
(
req
.
Arguments
)
>
0
{
path
=
req
.
Arguments
[
0
]
}
return
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
path
)
n
,
err
:=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
path
)
if
err
!=
nil
{
return
err
}
return
cmds
.
EmitOnce
(
res
,
&
flushRes
{
enc
.
Encode
(
n
.
Cid
())})
},
Type
:
flushRes
{},
}
var
filesChcidCmd
=
&
cmds
.
Command
{
...
...
@@ -916,7 +931,7 @@ Change the cid version or hash function of the root node of a given path.
err
=
updatePath
(
nd
.
FilesRoot
,
path
,
prefix
)
if
err
==
nil
&&
flush
{
err
=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
path
)
_
,
err
=
mfs
.
FlushPath
(
req
.
Context
,
nd
.
FilesRoot
,
path
)
}
return
err
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment