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

fix: various clarifications #193

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions specification.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"id": "Requirement 1.1.2.2",
"machine_id": "requirement_1_1_2_2",
"content": "The `provider mutator` function MUST invoke the `initialize` function on the newly registered provider before using it to resolve flag values.",
"content": "The `provider mutator` function MUST await the termination of the `initialize` function on the newly registered provider before using it to resolve flag values.",
toddbaert marked this conversation as resolved.
Show resolved Hide resolved
toddbaert marked this conversation as resolved.
Show resolved Hide resolved
"RFC 2119 keyword": "MUST",
"children": []
},
Expand Down Expand Up @@ -230,7 +230,7 @@
{
"id": "Requirement 1.6.1",
"machine_id": "requirement_1_6_1",
"content": "The API MUST define a `shutdown` function which, when called, must call the respective `shutdown` function on the active provider.",
"content": "The API MUST define a mechanism to propagate a shutdown request to active providers.",
"RFC 2119 keyword": "MUST",
"children": []
},
Expand Down Expand Up @@ -386,7 +386,7 @@
{
"id": "Requirement 2.5.1",
"machine_id": "requirement_2_5_1",
"content": "The provider MAY define a `shutdown` function to perform whatever cleanup is necessary for the implementation.",
"content": "The provider MAY define a mechanism to gracefully shutdown and dispose of resources.",
"RFC 2119 keyword": "MAY",
"children": []
},
Expand Down
12 changes: 7 additions & 5 deletions specification/sections/01-flag-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ See [provider](./02-providers.md) for details.

#### Requirement 1.1.2.2

> The `provider mutator` function **MUST** invoke the `initialize` function on the newly registered provider before using it to resolve flag values.
> The `provider mutator` function **MUST** await the termination of the `initialize` function on the newly registered provider before using it to resolve flag values.

The `provider's` readiness can state can be determined from its `status` member/accessor.
Provider instances which are already active (because they have been bound to other `names` or otherwise) need not be initialized again.

See [provider initialization](./02-providers.md#24-initialization).

#### Requirement 1.1.2.3

> The `provider mutator` function **MUST** invoke the `shutdown` function on the previously registered provider once it's no longer being used to resolve flag values.

Setting a new provider means the previous provider is no longer in use, and should therefore be disposed of using its `shutdown` function.
When a provider is no longer in use, it should be disposed of using its `shutdown` mechanism.
Provider instances which are bound to multiple names won't be shut down until the last binding is removed.

see: [shutdown](./02-providers.md#25-shutdown), [setting a provider](#setting-a-provider)

Expand Down Expand Up @@ -274,9 +276,9 @@ See [hooks](./04-hooks.md) for details.

#### Requirement 1.6.1

> The API **MUST** define a `shutdown` function which, when called, must call the respective `shutdown` function on the active provider.
> The API **MUST** define a mechanism to propagate a shutdown request to active providers.

The precise name of this function is not prescribed by this specification, but should be defined be the SDK.
Relevant language idioms should be considered when choosing the name for this function, in accordance with the resource-disposal semantics of the language in question.
The global API object might expose a `shutdown` function, which will call the respective `shutdown` function on the registered providers.
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.

see: [`shutdown`](./02-providers.md#25-shutdown)
8 changes: 4 additions & 4 deletions specification/sections/02-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ see: [error codes](https://openfeature.dev/specification/types#error-code)

#### Requirement 2.5.1

> The provider **MAY** define a `shutdown` function to perform whatever cleanup is necessary for the implementation.
> The provider **MAY** define a mechanism to gracefully shutdown and dispose of resources.

```java
// MyProvider implementation of the dispose function defined in Provider
class MyProvider implements Provider, AutoDisposable {
Expand All @@ -249,6 +250,5 @@ class MyProvider implements Provider, AutoDisposable {
```

Providers may maintain remote connections, timers, threads or other constructs that need to be appropriately disposed of.
Provider authors may implement the `shutdown` function to perform relevant clean-up actions.
The precise name of this function is not prescribed by this specification, but should be defined be the SDK.
Relevant language idioms should be considered when choosing the name for this function, in accordance with the resource-disposal semantics of the language in question.
Provider authors may implement a `shutdown` function to perform relevant clean-up actions.
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.