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.
The current design of the Layer trait encourages developers to put lots of logic into their layer. One impact of this, is it forces stateful logging to jump through hoops that I would call less ergonomic heroku/libcnb.rs#669.
This proof of concept is a re-imagining of how we might want to interact with a layer using only the existing layer primitives from libcnb. It encourages operations to be performed outside of a layer because it does not require the developer to implement
Layer
on their own structs. Instead, it treats metadata as a primitive and makes "read" and "write" layer information their own discrete actions.At a high level the flow of interacting with a layer now becomes:
In this process, I reimagined the flow for cache invalidation to fit within a
MetadataDiff
enum. This essentially encourages a set of "reasonable defaults" for equality-based metadata, but does not restrict to a specific use cases.Worth noting that I've got an idea of a way to better handle metadata that cannot be deserialized, but it would be distracting from the primary purpose of this PoC.
Known
The code in
main.rs
is quite long and would likely be moved to its own function if we continued down this path.Discussion/Feedback
The purpose of this PR is to get feedback on this approach, both high level (concept) and low level (implementation).