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

Exploded layer proof of concept #203

Closed
wants to merge 1 commit into from

Conversation

schneems
Copy link
Contributor

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).

@schneems schneems force-pushed the schneems/get-set-exploded-layer branch from d2d0233 to 4974006 Compare September 19, 2023 18:11
@schneems schneems force-pushed the schneems/logging-state-machine-continued branch 2 times, most recently from 34ea214 to 02758b4 Compare September 26, 2023 19:42
@schneems schneems force-pushed the schneems/logging-state-machine-continued branch 3 times, most recently from 64c7e62 to ce52872 Compare October 6, 2023 14:54
@schneems schneems force-pushed the schneems/logging-state-machine-continued branch from 0ebcbe9 to 7c85b5e Compare October 11, 2023 16:48
@schneems schneems force-pushed the schneems/logging-state-machine-continued branch 2 times, most recently from d645702 to b3ccd76 Compare October 30, 2023 15:03
Base automatically changed from schneems/logging-state-machine-continued to main October 30, 2023 15:11
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant