Commit ac37dde2 authored by Steven Allen's avatar Steven Allen

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).
parent 0c1d0480
...@@ -33,8 +33,6 @@ type UnixfsAddSettings struct { ...@@ -33,8 +33,6 @@ type UnixfsAddSettings struct {
FsCache bool FsCache bool
NoCopy bool NoCopy bool
Wrap bool
Events chan<- interface{} Events chan<- interface{}
Silent bool Silent bool
Progress bool Progress bool
...@@ -65,8 +63,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, ...@@ -65,8 +63,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
FsCache: false, FsCache: false,
NoCopy: false, NoCopy: false,
Wrap: false,
Events: nil, Events: nil,
Silent: false, Silent: false,
Progress: false, Progress: false,
...@@ -234,15 +230,6 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { ...@@ -234,15 +230,6 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption {
} }
} }
// Wrap tells the adder to wrap the added file structure with an additional
// directory.
func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
return func(settings *UnixfsAddSettings) error {
settings.Wrap = wrap
return nil
}
}
// Events specifies channel which will be used to report events about ongoing // Events specifies channel which will be used to report events about ongoing
// Add operation. // Add operation.
// //
......
...@@ -248,13 +248,6 @@ func (tp *provider) TestAdd(t *testing.T) { ...@@ -248,13 +248,6 @@ func (tp *provider) TestAdd(t *testing.T) {
data: flatDir, data: flatDir,
path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp",
}, },
{
name: "simpleDirWrap",
data: flatDir,
expect: wrapped("QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp"),
path: "/ipfs/QmXxCaQkC8Z6Qws1nTkTQfCsL9y4XvWXnrPokp9bhmjC1L",
opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
},
{ {
name: "simpleDir", name: "simpleDir",
data: flatDir, data: flatDir,
...@@ -279,35 +272,6 @@ func (tp *provider) TestAdd(t *testing.T) { ...@@ -279,35 +272,6 @@ func (tp *provider) TestAdd(t *testing.T) {
wrap: "foo", wrap: "foo",
expect: wrapped("foo"), expect: wrapped("foo"),
}, },
{
name: "stdinWrapped",
path: "/ipfs/QmU3r81oZycjHS9oaSHw37ootMFuFUw1DvMLKXPsezdtqU",
data: func() files.Node {
return files.NewBytesFile([]byte(helloStr))
},
expect: func(files.Node) files.Node {
return files.NewMapDirectory(map[string]files.Node{
"QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk": files.NewBytesFile([]byte(helloStr)),
})
},
opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
},
{
name: "twoLevelDirWrapped",
data: twoLevelDir(),
wrap: "t",
expect: wrapped("QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", "t"),
path: "/ipfs/QmXzZwAh34pmNjuKsVGZfpbByis5S5qeZjCCUxa1ajZqzH",
opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)},
},
{
name: "twoLevelInlineHash",
data: twoLevelDir(),
wrap: "t",
expect: wrapped("zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", "t"),
path: "/ipfs/QmUX6GykDGHTMtLmDkfjqs48QwQK82vou51xwaY9TSU7Zo",
opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true), options.Unixfs.Hash(mh.SHA3)},
},
// hidden // hidden
{ {
name: "hiddenFilesAdded", name: "hiddenFilesAdded",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment