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

Update byte-unit dependency with breaking changes #329

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

schneems
Copy link
Contributor

@schneems schneems commented Oct 1, 2024

Byte unit 4 broke a lot of interfaces that we depended on. This commit uses the new interfaces:

  • Byte::from_bytes -> Byte::from_ (like Byte::from_u64)
  • Byte.get_appropriate_unit(bool) -> Byte.get_appropriate_unit(UnitType)
  • macros such as n_mib_bytes are no longer present.

This has one (technically) breaking change in the mib convenience function provided by commons. However if a literal is being used in the code (which it is in the Ruby main.rs) then it is not affected.

Even though lots of things changed internally, the overall interface to AppCache stayed (almost) stable and no code inside of the main buildpack needed to be updated. That indicates a relatively successful encapsulation attempt.

Moving forward it would be best to not directly rely on types from external crates but rather to provide new type interfaces for them so we have control over the API and therefore stability.

Byte unit 4 broke a lot of interfaces that we depended on. This commit uses the new interfaces:

- Byte::from_bytes -> Byte::from_<type> (like Byte::from_u64)
- Byte.get_appropriate_unit(bool) -> Byte.get_appropriate_unit(UnitType)
- macros such as `n_mib_bytes` are no longer present.

This has one (technically) breaking change in the `mib` convenience function provided by commons. However if a literal is being used in the code (which it is in the Ruby main.rs) then it is not affected.

Even though lots of things changed internally, the overall interface to AppCache stayed (almost) stable and no code inside of the main buildpack needed to be updated. That indicates a relatively successful encapsulation attempt.

Moving forward it would be best to not directly rely on types from external crates but rather to provide new type interfaces for them so we have control over the API and therefore stability.
@schneems schneems requested a review from a team as a code owner October 1, 2024 13:59
@schneems schneems merged commit 39660ca into main Oct 4, 2024
7 of 8 checks passed
@schneems schneems deleted the schneems/rev-byte-unit branch October 4, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants