-
Notifications
You must be signed in to change notification settings - Fork 21
Description
As I just started playing with iroh-blobs, I thought I give some feedback from someone with a fresh eye.
As 1.0 seems to be close, I think it makes sense to mention APIs I find confusing/inconsistent. That's the case for FsStore::load_with_opts(). It takes a database path as parameter and other database paths as part of the options.
My code starts with an FsStore::load():
let path = std::env::current_dir()?.join("mydata");
let store = FsStore::load(&path).await?;All good, it creates some files and directories within mydata. I don't need to care about the details.
Now I want to add some options to it. I expected FsStore::load_with_opts() would similar to Blobs API when adding files. Blobs::add_path() takes only a path for the most basic case. When I want more options, I use Blobs::add_path_with_opts(), which doesn't take a path anymore, but only options.
Though FsStore::load_with_opts() still takes a path. So my first intuition is to use that same path twice:
let path = std::env::current_dir()?.join("mydata");
let options = Options {
path: PathOptions::new(&path),
gc: Default::default(),
inline: Default::default(),
batch: Default::default(),
};
let store = FsStore::load_with_opts(path, options).await?;But that would just block as the first parameter of FsStore::load_with_opts() needs to be a file and not a directory.
In order to reproduce the same result as FsStore::load() I would need to know that it appends blobs.db to the given path:
let store = FsStore::load_with_opts(path.join("blobs.db"), options).await?; I propose having a more straight forward transition from FsStore::load() to FsStore::load_with_opts(). I'm happy to provide a PR once there is an idea on what that should look like (or just do it yourself without much discussion if that's easier).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status