-
Notifications
You must be signed in to change notification settings - Fork 3
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
PineAPPL file format and backwards compatibility issues #83
Comments
As a first step, we might want to simply consider every version released as file version 0. Starting with |
Commit 3b88b4c adds the |
You can think about to declare a fixed number of older versions always supported. If occasionally is not overly complicated to maintain several older versions you do it, but it's not strictly required. |
Yes, that's what I meant with 'bootstraping'. It's a well known problem for GCC, which needs a C++ compiler to build 😄. |
You're definitely right, then just keep going :) |
Preliminary code to support file format changes are in commit d9897bc. If you find yourself not being able to read new grids, make sure the CAPI/CLI/Python API is up to date. |
Here's what I'd like to change in a newer version:
|
Just to have an idea: can you tell which are the subgrid types we're still using, and where? |
Here's an overview:
|
I'm closing this as support for the original is supported in v0.5.0. Further development should be discussed in #118. |
Backwards compatibility
First, let's define backwards compatibility:
Grid::read
must be able to read all generated PineAPPL grids if they were generated using a released version of PineAPPL. Released versions are the ones on the Releases page.PineAPPL file format
PineAPPL doesn't have a dedicated file format, but instead relies on
serde
for (de)serialization and onbincode
for actually writing bytes to and from files. This has the disadvantage that, for the sake of backwards compatibility, everystruct
that has the#[derive(Deserialize,Serialize)]
attributes must never be changed ever, and the only flexibility is adding further kinds ofenum
s; that's the reason why there are multiple versions of a struct asV1
andV2
variants.Obviously requirements change and even in the design mistakes were/will be made. To mention a few examples:
MoreMembers
enum was added to support aBinRemapper
. This struct basically supersedesBinLimits
, which only supports one-dimensional distributions that are contiguous (the right bin limit is the left limit of the next bin).BinRemapper
supports, at least in principle, an arbitrary number of dimensions and also normalizations that are not necessarily tied to bin sizes. Yet another structBinInfo
is needed to abstract the differences between the two, as shown inGrid::bin_info
.MoreMembers
enum is needed for metadata, which was previously missing. As a result, the methodsGrid::key_values
,Grid::key_values_mut
return anOption
depending on whether theGrid
does have metadata or not.Planned changes
To make file handling more flexible and to support different designs without sacrificing backwards compatibility, we need to implement a few changes:
['P', 'i', 'n', 'e', 'A', 'P', 'P', 'L']
. This is needed to letGrid::read
detect if a grid can immediately be deserialized or if it has first to be decompressed. The file version, on the other hand, lets us determine exactly how the read is performed.read
of the correct struct is called, followed byupgrade
which converts the grid from a specific version to the latest one. Theupgrade
method must also be offered by the CLI so that one can batch convert grids into the newest version.Grid
struct in the crate, possible aspineappl::grid::v0::Grid
,pineappl::grid::v1::Grid
as so forth, and a type definition forpineappl::grid::Grid
for the most recent version.upgrade
grids in bootstrap kind of way (install the latest version that still supports the file format that needs to be upgraded, upgrade to most recent version supported, etc.). This could and should probably be automated.upgrade
subcommand of the CLI itself as error messages (something along the lines oferror: tried to upgrade grid with file version 0. You need pineappl 0.5.0 to upgrade this version
).The text was updated successfully, but these errors were encountered: