-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: - Read cached data (get LayerData) - Do stuff (modify path, log, etc.) - Write new data (write LayerResult) 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).
- Loading branch information
Showing
9 changed files
with
505 additions
and
118 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.