Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes: please link all relevant issues
PR content/description
Adds a trait and a type to mark deprecation of older versions of a type that are no longer supported.
Namely, there is a trait
Deprecable
that is used on a user facing type to tell that older versions of this type can be deprecated. This trait mainly defines some str associated constants that will be used to provide a friendlier error message to the user. In the example below, a user that tries to deserialize a deprecated version, would get the following error:(In the context of tfhe-rs, this could be something like
Deprecated ServerKey found in serialized data, minimal supported version is tfhe-rs v0.8
)The type
Deprecated<MyStruct>
should be used in the dispatch enum and replaces the deprecated versions. As it replaces them, it allows to remove all the code associated to defining, loading and upgrading them.Since the remaining valid versions will still keep their place in the dispatch enum, any data that has not been explicitly deprecated will still be compatible.
Example:
We could also define a macro in tfhe-rs for the Deprecable trait implementation. (Something like
deprecable!(ServerKey)
)Check-list: