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
19e3c127
Commit
19e3c127
authored
Sep 03, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drop wrap check and modify parameter name
License: MIT Signed-off-by:
Kejie Zhang
<
601172892@qq.com
>
parent
514891d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
core/commands/add.go
core/commands/add.go
+4
-4
core/coreunix/add.go
core/coreunix/add.go
+6
-5
No files found.
core/commands/add.go
View file @
19e3c127
...
...
@@ -37,7 +37,7 @@ const (
progressOptionName
=
"progress"
trickleOptionName
=
"trickle"
wrapOptionName
=
"wrap-with-directory"
wrapP
athName
=
"name"
p
athName
=
"name"
hiddenOptionName
=
"hidden"
onlyHashOptionName
=
"only-hash"
chunkerOptionName
=
"chunker"
...
...
@@ -117,7 +117,7 @@ You can now check what blocks have been created by:
cmdkit
.
BoolOption
(
trickleOptionName
,
"t"
,
"Use trickle-dag format for dag generation."
),
cmdkit
.
BoolOption
(
onlyHashOptionName
,
"n"
,
"Only chunk and hash - do not write to disk."
),
cmdkit
.
BoolOption
(
wrapOptionName
,
"w"
,
"Wrap files with a directory object."
),
cmdkit
.
StringOption
(
wrapP
athName
,
"Assign path name when use wrap-with-directory option"
),
cmdkit
.
StringOption
(
p
athName
,
"Assign path name when use wrap-with-directory option"
),
cmdkit
.
BoolOption
(
hiddenOptionName
,
"H"
,
"Include files that are hidden. Only takes effect on recursive add."
),
cmdkit
.
StringOption
(
chunkerOptionName
,
"s"
,
"Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]"
)
.
WithDefault
(
"size-262144"
),
cmdkit
.
BoolOption
(
pinOptionName
,
"Pin this object when adding."
)
.
WithDefault
(
true
),
...
...
@@ -183,7 +183,7 @@ You can now check what blocks have been created by:
hashFunStr
,
_
:=
req
.
Options
[
hashOptionName
]
.
(
string
)
inline
,
_
:=
req
.
Options
[
inlineOptionName
]
.
(
bool
)
inlineLimit
,
_
:=
req
.
Options
[
inlineLimitOptionName
]
.
(
int
)
wrapP
athName
,
_
:=
req
.
Options
[
wrapP
athName
]
.
(
string
)
p
athName
,
_
:=
req
.
Options
[
p
athName
]
.
(
string
)
// The arguments are subject to the following constraints.
//
...
...
@@ -290,7 +290,7 @@ You can now check what blocks have been created by:
fileAdder
.
Silent
=
silent
fileAdder
.
RawLeaves
=
rawblks
fileAdder
.
NoCopy
=
nocopy
fileAdder
.
Wp
Name
=
wrapP
athName
fileAdder
.
Name
=
p
athName
fileAdder
.
CidBuilder
=
prefix
if
inline
{
...
...
core/coreunix/add.go
View file @
19e3c127
...
...
@@ -26,7 +26,6 @@ import (
cid
"gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid"
bstore
"gx/ipfs/QmcmpX42gtDv1fz24kau4wjS9hfwWj5VexWBKgGnWzsyag/go-ipfs-blockstore"
mfs
"gx/ipfs/QmdghKsSDa2AD1kC4qYRnVYWqZecdSBRZjeXRdhMYYhafj/go-mfs"
"strings"
)
var
log
=
logging
.
Logger
(
"coreunix"
)
...
...
@@ -84,7 +83,7 @@ type Adder struct {
RawLeaves
bool
Silent
bool
Wrap
bool
Wp
Name
string
Name
string
NoCopy
bool
Chunker
string
root
ipld
.
Node
...
...
@@ -472,11 +471,13 @@ func (adder *Adder) addFile(file files.File) error {
return
err
}
if
!
strings
.
EqualFold
(
adder
.
WpName
,
""
)
&&
adder
.
Wrap
{
return
adder
.
addNode
(
dagnode
,
adder
.
WpName
)
addFileName
:=
file
.
FileName
()
if
addFileName
==
""
&&
adder
.
Name
!=
""
{
addFileName
=
adder
.
Name
adder
.
Name
=
""
}
// patch it into the root
return
adder
.
addNode
(
dagnode
,
file
.
FileName
()
)
return
adder
.
addNode
(
dagnode
,
add
FileName
)
}
func
(
adder
*
Adder
)
addDir
(
dir
files
.
File
)
error
{
...
...
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