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

docs: add language-specific initialize naming #244

Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion specification.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
{
"id": "Requirement 2.4.1",
"machine_id": "requirement_2_4_1",
"content": "The `provider` MAY define an `initialize` function which accepts the global `evaluation context` as an argument and performs initialization logic relevant to the provider.",
"content": "The `provider` MAY define an initialization function which accepts the global `evaluation context` as an argument and performs initialization logic relevant to the provider.",
"RFC 2119 keyword": "MAY",
"children": []
},
Expand Down
10 changes: 5 additions & 5 deletions specification/sections/02-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ResolutionDetails<MyStruct> resolveStructureValue(string flagKey, MyStruct defau
```
##### Requirement 2.2.9

> The `provider` **SHOULD** populate the `resolution details` structure's `flag metadata` field.
> The `provider` **SHOULD** populate the `resolution details` structure's `flag metadata` field.

##### Requirement 2.2.10

Expand Down Expand Up @@ -164,11 +164,11 @@ class MyProvider implements Provider {

#### Requirement 2.4.1

> The `provider` **MAY** define an `initialize` function which accepts the global `evaluation context` as an argument and performs initialization logic relevant to the provider.
> The `provider` **MAY** define an initialization function which accepts the global `evaluation context` as an argument and performs initialization logic relevant to the provider.

Many feature flag frameworks or SDKs require some initialization before they can be used.
They might require the completion of an HTTP request, establishing persistent connections, or starting timers or worker threads.
The `initialization` function is an ideal place for such logic.
The initialization function is an ideal place for such logic.

```java
// MyProvider implementation of the initialize function defined in Provider
Expand Down Expand Up @@ -281,7 +281,7 @@ class MyProvider implements Provider {
//...

onContextChanged(EvaluationContext oldContext, EvaluationContext newContext): void {
// update context-sensitive cached flags, or otherwise react to the change in the global context
// update context-sensitive cached flags, or otherwise react to the change in the global context
}

//...
Expand All @@ -290,4 +290,4 @@ class MyProvider implements Provider {

Providers may maintain remote connections, timers, threads or other constructs that need to be appropriately disposed of.
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.
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.
Loading