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
88ca0a07
Commit
88ca0a07
authored
Oct 02, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi unixfs: separate option to enable inlining
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
eeb50d8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
options/unixfs.go
options/unixfs.go
+21
-4
No files found.
options/unixfs.go
View file @
88ca0a07
...
...
@@ -20,6 +20,7 @@ type UnixfsAddSettings struct {
CidVersion
int
MhType
uint64
Inline
bool
InlineLimit
int
RawLeaves
bool
RawLeavesSet
bool
...
...
@@ -39,7 +40,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
CidVersion
:
-
1
,
MhType
:
mh
.
SHA2_256
,
InlineLimit
:
0
,
Inline
:
false
,
InlineLimit
:
32
,
RawLeaves
:
false
,
RawLeavesSet
:
false
,
...
...
@@ -124,11 +126,26 @@ func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption {
}
}
// Inline tells the adder to inline small blocks into CIDs
func
(
unixfsOpts
)
Inline
(
enable
bool
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
Inline
=
enable
return
nil
}
}
// InlineLimit sets the amount of bytes below which blocks will be encoded
// directly into CID instead of being stored and addressed by it's hash
// directly into CID instead of being stored and addressed by it's hash.
// Specifying this option won't enable block inlining. For that use `Inline`
// option. Default: 32 bytes
//
// Note that while there is no hard limit on the number of bytes, it should
// be kept at a reasonably low value, like 64 bytes if you intend to display
// these hashes. Larger values like 256 bytes will work fine, but may affect
// de-duplication of smaller blocks.
//
//
Note that while there is no hard limit on the number of bytes here, it should
// b
e kept at something reasonably low like 32b (default for 'ipfs add')
//
Setting this value too high may cause various problems, such as render some
// b
locks unfetchable
func
(
unixfsOpts
)
InlineLimit
(
limit
int
)
UnixfsAddOption
{
return
func
(
settings
*
UnixfsAddSettings
)
error
{
settings
.
InlineLimit
=
limit
...
...
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