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
interface-go-dms3-core
Commits
8521907e
Commit
8521907e
authored
Sep 20, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi unixfs: pin/local/hash-only options
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
ee22ac43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
options/unixfs.go
options/unixfs.go
+29
-0
No files found.
options/unixfs.go
View file @
8521907e
...
...
@@ -21,6 +21,10 @@ type UnixfsAddSettings struct {
Chunker
string
Layout
Layout
Pin
bool
OnlyHash
bool
Local
bool
}
type
UnixfsAddOption
func
(
*
UnixfsAddSettings
)
error
...
...
@@ -36,6 +40,10 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) {
Chunker
:
"size-262144"
,
Layout
:
BalancedLayout
,
Pin
:
false
,
OnlyHash
:
false
,
Local
:
false
,
}
for
_
,
opt
:=
range
opts
{
...
...
@@ -94,3 +102,24 @@ func (unixfsOpts) Layout(layout Layout) UnixfsAddOption {
return
nil
}
}
func
(
unixfsOpts
)
Pin
(
pin
bool
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
Pin
=
pin
return
nil
}
}
func
(
unixfsOpts
)
HashOnly
(
hashOnly
bool
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
OnlyHash
=
hashOnly
return
nil
}
}
func
(
unixfsOpts
)
Local
(
local
bool
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
Local
=
local
return
nil
}
}
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