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

Ownership #51

Merged
merged 24 commits into from
Jan 7, 2020
Merged

Ownership #51

merged 24 commits into from
Jan 7, 2020

Conversation

magnusuMET
Copy link
Member

@magnusuMET magnusuMET commented Jan 5, 2020

This is a complete revamp of ownership and caching of the file. The rust side is now not reading more than strictly necessary, and instead goes through netcdf-c. The ownership is now determined by PhantomData, which prevents early dropping of the File.

Multiple VariableMut can be held simultaneously (from different groups or from variables_mut), with the PhantomData preventing data races. This change should decrease memory usage of the library, especially when not reading all attributes of a file, as only netCDF-c holds the metadata (fixes #44).

The library might be a bit more annoying to use, as almost all operations can fail in the netcdf-c layer. Some unwrapping can probably be done on the library side, so application users can deal with an easier API. I am leaving this as a future exercise.

@codecov-io
Copy link

codecov-io commented Jan 5, 2020

Codecov Report

Merging #51 into master will decrease coverage by 2.13%.
The diff coverage is 86.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #51      +/-   ##
==========================================
- Coverage   86.87%   84.74%   -2.14%     
==========================================
  Files           7        7              
  Lines        1280     1278       -2     
==========================================
- Hits         1112     1083      -29     
- Misses        168      195      +27
Impacted Files Coverage Δ
src/attribute.rs 89.26% <100%> (+0.08%) ⬆️
src/error.rs 44% <35.71%> (-3.5%) ⬇️
src/group.rs 82.55% <82.5%> (-8.22%) ⬇️
src/file.rs 79.8% <85.88%> (-11.65%) ⬇️
src/variable.rs 83.95% <86.84%> (+0.18%) ⬆️
src/lib.rs 93.75% <91.66%> (-6.25%) ⬇️
src/dimension.rs 96.73% <97.56%> (+0.73%) ⬆️

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 3ef1570...69d3c53. Read the comment docs.

@magnusuMET magnusuMET force-pushed the ownership branch 2 times, most recently from 1e2677c to da000d0 Compare January 6, 2020 19:51
@magnusuMET magnusuMET deleted the ownership branch January 7, 2020 11:55
@magnusuMET magnusuMET mentioned this pull request Jan 8, 2020
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.

High memory utilisation
2 participants