Skip to content
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

Implement layer export and import more generically #64

Merged
merged 9 commits into from
Apr 12, 2021

Conversation

matko
Copy link
Member

@matko matko commented Apr 12, 2021

This implements layer export and import for the PersistentLayerStore, which currently backs both the memory and the directory layer store (yes it is a bit of a misnomer).

This closes #58. It is also an initial step towards #62, implementing the pack functionality as a separate trait in its own file instead of as part of a bigger trait. It also makes use of the async_trait macro as mentioned in #56.

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #64 (dbd2967) into master (4a197d2) will decrease coverage by 0.13%.
The diff coverage is 60.43%.

❗ Current head dbd2967 differs from pull request most recent head 5719d52. Consider uploading reports for the commit 5719d52 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
- Coverage   72.36%   72.23%   -0.14%     
==========================================
  Files          31       32       +1     
  Lines       11999    12072      +73     
  Branches     2127     2154      +27     
==========================================
+ Hits         8683     8720      +37     
- Misses       1079     1084       +5     
- Partials     2237     2268      +31     
Impacted Files Coverage Δ
src/storage/cache.rs 56.17% <0.00%> (-0.76%) ⬇️
src/store/mod.rs 50.97% <0.00%> (ø)
src/storage/pack.rs 60.09% <60.09%> (ø)
src/storage/directory.rs 60.49% <100.00%> (-1.05%) ⬇️
src/storage/layer.rs 67.49% <100.00%> (-0.03%) ⬇️
src/storage/memory.rs 79.94% <100.00%> (+0.81%) ⬆️
src/store/sync.rs 57.00% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a197d2...5719d52. Read the comment docs.

@matko
Copy link
Member Author

matko commented Apr 12, 2021

@rrooij are you available for a review?

@rrooij
Copy link
Contributor

rrooij commented Apr 12, 2021

I like this. However, I get the following error when compiling.

error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
  --> src/storage/pack.rs:67:10
   |
67 |     ) -> io::Result<()> {
   |          ^^^^^^^^^^^^^^
   |
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
   --> src/storage/pack.rs:322:10
    |
322 |     ) -> io::Result<()> {
    |          ^^^^^^^^^^^^^^
    |

let parent_id = string_to_name(parent_id_str)?;

result_map.insert(id, Some(parent_id));
} else if !result_map.contains_key(&id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://rust-lang.github.io/rust-clippy/master/index.html#map_entry

contains_key followed by insert is inefficient


result_map.insert(id, Some(parent_id));
} else if !result_map.contains_key(&id) {
println!("hello b");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for debugging?


println!("about to go into loop");
for e in archive.entries()? {
println!("a");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printlns should probably be removed?

@rrooij rrooij merged commit 7f3a2ca into master Apr 12, 2021
@matko matko deleted the pack_generalization branch April 19, 2021 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement layer export and import for memory store
2 participants