Skip to content

External packages and example CLI#4

Merged
stgraber merged 8 commits into
canonical:mainfrom
masnax:app
Jul 27, 2022
Merged

External packages and example CLI#4
stgraber merged 8 commits into
canonical:mainfrom
masnax:app

Conversation

@masnax
Copy link
Copy Markdown
Contributor

@masnax masnax commented Jul 11, 2022

Depends on #3

This mainly refactors the project to expose some components so that they can be externally called from other packages.
Basically, this moves stuff out of the internal package and adds top-level packages for:

  • client - Adds a /1.0 endpoint helper and helpers for querying the entire cluster at once. Creating a client is still internal, except through a few helpers in the microcluster package.
  • cluster - The generated components of the database need to be external because external calls to the generator will rely on them.
  • rest - Exposes types for API endpoint creation. The actual handling is still internal.
  • state - This one's a bit hacky, basically we need the external APIs to have access to the daemon's state to be able to actually do things, so this just exposes a type definition.

Additionally there is now a microcluster package with an App command that takes some state args and interfaces with the internal package to create some useful helpers for interacting with the daemon externally. This will allow passing in our own set of []rest.Endpoint and map[int]schema.Update that will be appended to the /1.0 endpoints and the default schema, respectively.

Lastly there is an example directory with a microd/microctl project inside. This uses microcluster.App along with the packages above to create a basic cluster. Here is the readme.

@masnax masnax force-pushed the app branch 2 times, most recently from ab8ada7 to f9db2b1 Compare July 12, 2022 23:51
@masnax masnax mentioned this pull request Jul 13, 2022
@masnax masnax force-pushed the app branch 3 times, most recently from ceef8b3 to 1773447 Compare July 19, 2022 18:48
masnax added 6 commits July 21, 2022 03:31
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
@masnax masnax marked this pull request as ready for review July 21, 2022 03:31
Comment thread cluster/cluster_members.go Outdated
Comment thread example/Makefile Outdated
masnax added 2 commits July 27, 2022 19:38
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
@stgraber stgraber merged commit e0b0b27 into canonical:main Jul 27, 2022
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.

2 participants