Restructure (9): Make State interface and Hooks public#610
Open
roosterfish wants to merge 10 commits intocanonical:v3from
Open
Restructure (9): Make State interface and Hooks public#610roosterfish wants to merge 10 commits intocanonical:v3from
State interface and Hooks public#610roosterfish wants to merge 10 commits intocanonical:v3from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restructures the codebase by moving the State interface and Hooks struct from internal packages to the public microcluster/types package, eliminating the previous import indirection through type aliases.
Changes:
- Moved
Stateinterface frominternal/state/state.gotomicrocluster/types/state.goas a public interface - Moved
Hooksstruct frominternal/state/hooks.gotomicrocluster/types/hooks.goas a public struct - Removed the
state/state.gopackage that previously provided type aliases for these types - Updated all import statements and function signatures across the codebase to use
types.Stateandtypes.Hooksinstead ofstate.Stateandstate.Hooks
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| state/state.go | Removed type alias package that provided public access to internal types |
| microcluster/types/state.go | Added public State interface definition with all required methods |
| microcluster/types/hooks.go | Added public Hooks struct definition with all hook function fields |
| microcluster/rest/rest.go | Updated EndpointAction to use types.State in function signatures |
| internal/state/state.go | Removed State interface definition and updated Hooks field type, updated ToInternal signature |
| internal/state/hooks.go | Removed Hooks struct (moved to public package) |
| internal/rest/rest.go | Updated function signatures to use types.State |
| internal/rest/resources/*.go | Updated all resource handler function signatures to use types.State |
| internal/rest/access/authentication.go | Updated authentication functions to use types.State |
| internal/daemon/daemon.go | Updated daemon to use types.Hooks and types.State throughout |
| example/cmd/microd/main.go | Updated example hooks to use types.Hooks and types.State |
| example/api/extended.go | Updated extended API handlers to use types.State |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is now possible based on the previous package restructurings. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
The internal State and Hooks where only available to Microcluster users due to this indirection. The entire package can now be dropped. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
55ec502 to
47cc8c0
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is the ninth PR taken from a single commit in #534 (even though in this case the actual changes are very different from the original commit).
The final package layout will be different but to allow reviewing the changes in smaller chunks I will split this PR by its commits.
In this PR the
Stateinterface can finally be moved to a public package together with theHooksstruct which allows removing the import indirection which was previously necessary to be able to access both theStateandHooks.