-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I read an existing hypercore on disk? #82
Comments
Here is what I tried. Forgive the bad rust, just playing around on a Sunday night... fn read_feed(path: std::path::PathBuf) {
let mut storage = Storage::new_disk(&path).expect("cannot create storage");
let mut feed = Feed::with_storage(storage).expect("cannot create feed");
println!("{} {:x?}", feed.len(), feed.public_key().as_bytes());
let mut i = 0;
while let Ok(Some(x)) = feed.get(i) {
i += 1;
println!("{} {:?}", i, x);
}
println!("{}", i);
} I get a length of 0, and even if I read the feed I don't get any elements. |
Although I'm not familiar with this repo, from a quick glance, it seems that the on disk data is not read in at all. I guess this is very much a work in progress. PRs are appreciated! :) |
The above may also be a part of the problem, but at the very least it is because while opening the feed it gets the correct keys, but it always assumes it has no data by creating empty data structures and setting its length to 0. |
Question
How do I read an existing hypercore on disk?
Your Environment
Question
I was doing some initial evaluation of rust hypercore. One of the things I wanted to try was to read existing hypercores, such as the ones written by mafintosh/hypercore. However, I could not figure out how to do that. Even when passing in the directory of an existing hypercore, the
.len()
method returns 0.Context
I want to check compatibility with js hypercore and also compare read performance.
The text was updated successfully, but these errors were encountered: