-
Notifications
You must be signed in to change notification settings - Fork 54
How to add a directory with sharding enabled? #48
Comments
@daviddias I could be wrong here, but from what I can tell it relies on the use of a set global variable:
This variable can be set as an IPFS config option: https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#directory-sharding--hamt |
Thank you jumping in to help, @aschmahmann! Does that mean that IPFS operates either in a "every dir is sharded" or "no dir is sharded"? Is there any technical reason why both can't happen at the same time? |
It looks like it, but more precisely it's either "every new directory is sharded" or "no new directory is sharded". I think we can still read sharded directories even without passing the global flag. Not sure why we don't, but the readme on go-ipfs experimental features (https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#directory-sharding--hamt) has "Make sure that objects that don't have to be sharded aren't" as one of the blockers on the road to being a real feature. I'm sure @Stebalien or @mikeal would know more details (e.g. is this blocked on unixfs v2, etc.) |
|
I already figured out how to enable sharding with the current configuration. Taking in account that you have a configuration object of the type // imports
config "github.com/ipfs/go-ipfs-config"
"github.com/ipfs/go-ipfs/repo/fsrepo"
// code
cfg, _ := config.Init(ioutil.Discard, 2048)
cfg.Experimental.ShardingEnabled = true
// then create the repository with that config
fsrepo.Init(repoPath, cfg) |
@daviddias I think we can close this! |
@hacdias can you make sure this gets documented? |
Doesn't seem to be an option today at https://godoc.org/github.com/ipfs/interface-go-ipfs-core#UnixfsAPI
The text was updated successfully, but these errors were encountered: