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

setup modes for context builder #96

Merged
merged 3 commits into from
Sep 9, 2022
Merged

setup modes for context builder #96

merged 3 commits into from
Sep 9, 2022

Conversation

mandelsoft
Copy link
Contributor

@mandelsoft mandelsoft commented Sep 3, 2022

What this PR does / why we need it:

Support different setup modes for context creation.

<context package>.New() by default, now creates a complete fresh context graph, using the default handler registries.
Additionally, it accepts an optional parameter with the intended setup mode. It relates to all settings not explicitly configured with appropriate With* methods:

  • MODE_SHARED: the original mode creates a new local context sharing the rest from the default context graph
  • MODE_DEFAULTED: creates a decoupled graph, but reuses the default handler registries.
  • MODE_CONFIGURED: creates a decoupled graph, with own registries initialized with the actual settings of the default ones.
  • MODE_INITAL: creates a decoupled graph with empty handler registries.

The typical use case to create any number of functional contexts on demand, should be the mode MODE_DEFAULTED, which is the default mode for the builders New methods, now.

It assure a new, independent environment, featuring all the capabilities of the library, but ready for a new local configuration. For example with credentials, or other specific settings, and with own local caches stored in the context attributes.

If dedicated handlers should be registered for a temporary environment, the mode MODE_CONFIGURED must be used
to avoid the pollution of other context graphs. It provided the standard handlers provided by the default registrations, but
provided local handler registries in the context graph.

As before, dedicated, explicitly configured environments can be composed with the context builders. The setup mode
is used in addition, to decide how to fill the gaps in the configured graph, not explicitly configured by the builder settings.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

@gardener-robot
Copy link
Contributor

@phoban01 You have pull request review open invite, please check

@gardener-robot
Copy link
Contributor

@mandelsoft You need rebase this pull request with latest master branch. Please check.

Skarlso
Skarlso previously approved these changes Sep 6, 2022
yitsushi
yitsushi previously approved these changes Sep 6, 2022
@mandelsoft mandelsoft dismissed stale reviews from yitsushi and Skarlso via 4d8c268 September 8, 2022 13:34
@mandelsoft
Copy link
Contributor Author

rebased and linted

@gardener-robot
Copy link
Contributor

@phoban01 You have pull request review open invite, please check

@mandelsoft mandelsoft merged commit 2a8750f into main Sep 9, 2022
@mandelsoft mandelsoft deleted the mandelsoft/private branch September 9, 2022 12:57
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.

4 participants