remove Wrap
This can be trivially implemented by the end-user if desired. The best the CoreAPI can do is name the file with it's own hash so this isn't really all that helpful either. Note: This differs from js-ipfs because _there_, all files have paths (even outside directories). This commit was moved from ipfs/interface-go-ipfs-core@ac37dde21aaeea010bbe50c8c37155e4471c0000 This commit was moved from ipfs/boxo@a0c8ed395649c7fcda2ceaccdd65aa13feb2d2ae
Steven Allen committed
Mar 22, 2019 at 15:05 UTC
84faa010ce5dbb944845c22658025f4a0523ab6d
2 files changed
-49
core/coreiface/options/unixfs.go
-13
@@ -33,8 +33,6 @@ type UnixfsAddSettings struct {
33
FsCache bool
34
NoCopy bool
35
36
- Wrap bool
37
-
36
Events chan<- interface{}
37
Silent bool
38
Progress bool
@@ -65,8 +63,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
63
FsCache: false,
64
NoCopy: false,
65
68
- Wrap: false,
69
-
66
Events: nil,
67
Silent: false,
68
Progress: false,
@@ -234,15 +230,6 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption {
230
}
231
}
232
237
-// Wrap tells the adder to wrap the added file structure with an additional
238
-// directory.
239
-func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
240
- return func(settings *UnixfsAddSettings) error {
241
- settings.Wrap = wrap
242
- return nil
243
- }
244
-}
245
-
233
// Events specifies channel which will be used to report events about ongoing
234
// Add operation.
235
//
core/coreiface/tests/unixfs.go
-36
@@ -248,13 +248,6 @@ func (tp *provider) TestAdd(t *testing.T) {
248
data: flatDir,
249
path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp",
250
},
251
- {
252
- name: "simpleDirWrap",
253
- data: flatDir,
254
- expect: wrapped("QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp"),
255
- path: "/ipfs/QmXxCaQkC8Z6Qws1nTkTQfCsL9y4XvWXnrPokp9bhmjC1L",
256
- opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
257
- },
251
{
252
name: "simpleDir",
253
data: flatDir,
@@ -279,35 +272,6 @@ func (tp *provider) TestAdd(t *testing.T) {
272
wrap: "foo",
273
expect: wrapped("foo"),
274
},
282
- {
283
- name: "stdinWrapped",
284
- path: "/ipfs/QmU3r81oZycjHS9oaSHw37ootMFuFUw1DvMLKXPsezdtqU",
285
- data: func() files.Node {
286
- return files.NewBytesFile([]byte(helloStr))
287
- },
288
- expect: func(files.Node) files.Node {
289
- return files.NewMapDirectory(map[string]files.Node{
290
- "QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk": files.NewBytesFile([]byte(helloStr)),
291
- })
292
- },
293
- opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
294
- },
295
- {
296
- name: "twoLevelDirWrapped",
297
- data: twoLevelDir(),
298
- wrap: "t",
299
- expect: wrapped("QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", "t"),
300
- path: "/ipfs/QmXzZwAh34pmNjuKsVGZfpbByis5S5qeZjCCUxa1ajZqzH",
301
- opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
302
- },
303
- {
304
- name: "twoLevelInlineHash",
305
- data: twoLevelDir(),
306
- wrap: "t",
307
- expect: wrapped("zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", "t"),
308
- path: "/ipfs/QmUX6GykDGHTMtLmDkfjqs48QwQK82vou51xwaY9TSU7Zo",
309
- opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true), options.Unixfs.Hash(mh.SHA3)},
310
- },
275
// hidden
276
{
277
name: "hiddenFilesAdded",