@@ -19,6 +19,7 @@ import (
19
19
cmds "gx/ipfs/QmPTfgFTo9PFr1PvPKyKoeMgBvYPh6cX3aDP7DHKVbnCbi/go-ipfs-cmds"
20
20
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
21
21
pb "gx/ipfs/QmPtj12fdwuAqj9sBSTNUxBNu8kCGNp8b3o8yUzMm5GHpq/pb"
22
+ cidutil "gx/ipfs/QmPyxJ2QS7L5FhGkNYkNcXHGjDhvGHueJ4auqAstFHYxy5/go-cidutil"
22
23
cmdkit "gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
23
24
files "gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit/files"
24
25
offline "gx/ipfs/QmZxjqR9Qgompju73kakSoUj3rbVndAzky3oCDiBNCxPs1/go-ipfs-exchange-offline"
@@ -45,6 +46,8 @@ const (
45
46
fstoreCacheOptionName = "fscache"
46
47
cidVersionOptionName = "cid-version"
47
48
hashOptionName = "hash"
49
+ inlineOptionName = "inline"
50
+ inlineLimitOptionName = "inline-limit"
48
51
)
49
52
50
53
const adderOutChanSize = 8
@@ -121,6 +124,8 @@ You can now check what blocks have been created by:
121
124
cmdkit .BoolOption (fstoreCacheOptionName , "Check the filestore for pre-existing blocks. (experimental)" ),
122
125
cmdkit .IntOption (cidVersionOptionName , "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)" ),
123
126
cmdkit .StringOption (hashOptionName , "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)" ).WithDefault ("sha2-256" ),
127
+ cmdkit .BoolOption (inlineOptionName , "Inline small blocks into CIDs. (experimental)" ),
128
+ cmdkit .IntOption (inlineLimitOptionName , "Maximum block size to inline. (experimental)" ).WithDefault (32 ),
124
129
},
125
130
PreRun : func (req * cmds.Request , env cmds.Environment ) error {
126
131
quiet , _ := req .Options [quietOptionName ].(bool )
@@ -174,6 +179,8 @@ You can now check what blocks have been created by:
174
179
fscache , _ := req .Options [fstoreCacheOptionName ].(bool )
175
180
cidVer , cidVerSet := req .Options [cidVersionOptionName ].(int )
176
181
hashFunStr , _ := req .Options [hashOptionName ].(string )
182
+ inline , _ := req .Options [inlineOptionName ].(bool )
183
+ inlineLimit , _ := req .Options [inlineLimitOptionName ].(int )
177
184
178
185
// The arguments are subject to the following constraints.
179
186
//
@@ -280,7 +287,14 @@ You can now check what blocks have been created by:
280
287
fileAdder .Silent = silent
281
288
fileAdder .RawLeaves = rawblks
282
289
fileAdder .NoCopy = nocopy
283
- fileAdder .CidBuilder = & prefix
290
+ fileAdder .CidBuilder = prefix
291
+
292
+ if inline {
293
+ fileAdder .CidBuilder = cidutil.InlineBuilder {
294
+ Builder : fileAdder .CidBuilder ,
295
+ Limit : inlineLimit ,
296
+ }
297
+ }
284
298
285
299
if hash {
286
300
md := dagtest .Mock ()
0 commit comments