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
ee22ac43
Commit
ee22ac43
authored
Sep 20, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi unixfs: layout/chunker options
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
dbdf6fd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
options/unixfs.go
options/unixfs.go
+27
-0
No files found.
options/unixfs.go
View file @
ee22ac43
...
@@ -4,6 +4,13 @@ import (
...
@@ -4,6 +4,13 @@ import (
mh
"gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
mh
"gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
)
)
type
Layout
int
const
(
BalancedLayout
Layout
=
iota
TrickleLeyout
)
type
UnixfsAddSettings
struct
{
type
UnixfsAddSettings
struct
{
CidVersion
int
CidVersion
int
MhType
uint64
MhType
uint64
...
@@ -11,6 +18,9 @@ type UnixfsAddSettings struct {
...
@@ -11,6 +18,9 @@ type UnixfsAddSettings struct {
InlineLimit
int
InlineLimit
int
RawLeaves
bool
RawLeaves
bool
RawLeavesSet
bool
RawLeavesSet
bool
Chunker
string
Layout
Layout
}
}
type
UnixfsAddOption
func
(
*
UnixfsAddSettings
)
error
type
UnixfsAddOption
func
(
*
UnixfsAddSettings
)
error
...
@@ -23,6 +33,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) {
...
@@ -23,6 +33,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) {
InlineLimit
:
0
,
InlineLimit
:
0
,
RawLeaves
:
false
,
RawLeaves
:
false
,
RawLeavesSet
:
false
,
RawLeavesSet
:
false
,
Chunker
:
"size-262144"
,
Layout
:
BalancedLayout
,
}
}
for
_
,
opt
:=
range
opts
{
for
_
,
opt
:=
range
opts
{
...
@@ -67,3 +80,17 @@ func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption {
...
@@ -67,3 +80,17 @@ func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption {
return
nil
return
nil
}
}
}
}
func
(
unixfsOpts
)
Chunker
(
chunker
string
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
Chunker
=
chunker
return
nil
}
}
func
(
unixfsOpts
)
Layout
(
layout
Layout
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
Layout
=
layout
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