Introduce restate-platform foundation crate#4626
Merged
AhmedSoliman merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
This was referenced Apr 22, 2026
tillrohrmann
approved these changes
Apr 22, 2026
Contributor
tillrohrmann
left a comment
There was a problem hiding this comment.
Thanks for cleaning up or crate structure @AhmedSoliman. LGTM. +1 for merging :-)
| struct Inner(HashMap<u64, String>); | ||
|
|
||
| assert_impl_all!(SomeMessage: NetSerde); | ||
| const _: fn() = || { |
Contributor
There was a problem hiding this comment.
Before we usually used const _: (). Any reason to use a function value here?
Contributor
Author
There was a problem hiding this comment.
This is just the macro expansion as is. No strong opinion, just wanted to remove the dependency.
Comment on lines
-136
to
-179
| /// Validates that `KeyRange`'s general bilrost encoding produces the same | ||
| /// wire format as `RangeInclusive<u64>` with `RestateEncoding`. This ensures | ||
| /// that `KeyRange` fields can use `#[bilrost(N)]` and remain wire-compatible | ||
| /// with the old `#[bilrost(tag(N), encoding(RestateEncoding))] RangeInclusive<u64>`. | ||
| #[test] | ||
| fn key_range_wire_compat_with_range_inclusive() { | ||
| use restate_sharding::KeyRange; | ||
|
|
||
| use super::RestateEncoding; | ||
|
|
||
| #[derive(Debug, PartialEq, bilrost::Message)] | ||
| struct WithKeyRange { | ||
| #[bilrost(1)] | ||
| range: KeyRange, | ||
| } | ||
|
|
||
| #[derive(Debug, PartialEq, bilrost::Message)] | ||
| struct WithRangeInclusive { | ||
| #[bilrost(tag(1), encoding(RestateEncoding))] | ||
| range: std::ops::RangeInclusive<u64>, | ||
| } | ||
|
|
||
| for (start, end) in [(0u64, 0u64), (1, 100), (0, u64::MAX), (42, 42)] { | ||
| let kr = KeyRange::new(start, end); | ||
| let ri = start..=end; | ||
|
|
||
| let kr_bytes = WithKeyRange { range: kr }.encode_to_vec(); | ||
| let ri_bytes = WithRangeInclusive { range: ri.clone() }.encode_to_vec(); | ||
|
|
||
| assert_eq!( | ||
| kr_bytes, ri_bytes, | ||
| "wire format mismatch for range ({start}, {end})" | ||
| ); | ||
|
|
||
| // Cross-decode | ||
| let decoded: WithRangeInclusive = | ||
| WithRangeInclusive::decode(&*kr_bytes).expect("cross-decode KeyRange→RI"); | ||
| assert_eq!(decoded.range, ri); | ||
|
|
||
| let decoded: WithKeyRange = | ||
| WithKeyRange::decode(&*ri_bytes).expect("cross-decode RI→KeyRange"); | ||
| assert_eq!(decoded.range, kr); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Why was this test removed?
Contributor
Author
There was a problem hiding this comment.
(1) The test was added a couple of commits ago to prove wire compatibility, we don't really need to maintain it in the long run. (2) it was removed because restate-encoding doesn't really need to depend on restate-sharding.
Part of the effort to decompose the restate-types monolith into focused, composable utility crates. Add `restate-platform` as a low-dependency foundation crate that provides key type aliases, traits, and essential types the rest of the project can reliably depend upon. It sits at the bottom of the dependency graph with minimal transitive dependencies. Moves the following into restate-platform: - Error traits (GenericError, CodedError) from restate-types - Storage traits (StorageEncode, StorageDecode) from restate-types - Network marker trait (NetSerde) from restate-encoding - Memory estimation trait (EstimatedMemorySize) from restate-memory - Hash re-exports (HashMap, HashSet) for consistent hashing - Sync utilities (OwnedSemaphorePermit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Part of the effort to decompose the restate-types monolith into focused,
composable utility crates.
Add
restate-platformas a low-dependency foundation crate that provideskey type aliases, traits, and essential types the rest of the project can
reliably depend upon. It sits at the bottom of the dependency graph with
minimal transitive dependencies.
Moves the following into restate-platform:
Stack created with Sapling. Best reviewed with ReviewStack.