mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Updated Design: Persistable Context (markdown)
parent
4197caf60c
commit
3ad4911ba6
@ -119,22 +119,22 @@ To support all of the above cases, when the imported flow contains a persistable
|
|||||||
1. if the identifier is defined, use the context storage.
|
1. if the identifier is defined, use the context storage.
|
||||||
2. if the identifier is not defined but `default` identifier is defined, use the default context storage.
|
2. if the identifier is not defined but `default` identifier is defined, use the default context storage.
|
||||||
> DCJ: In this case - what happens if the default doesn't support a feature (like 'run(...') ? We should warn at least if not exact match.
|
> DCJ: In this case - what happens if the default doesn't support a feature (like 'run(...') ? We should warn at least if not exact match.
|
||||||
>> KN: Then we have no clue how to handle the instruction. So we should throw an exception.
|
>> KN: Then we have no clue how to handle the instruction. So we should throw an error.
|
||||||
3. if neither the identifier nor a `default` identifier are not defined, throw an exception.
|
3. if neither the identifier nor a `default` identifier are not defined, throw an error.
|
||||||
> DCJ: Yes not running but ideally still able to edit/correct the error if possible.
|
> DCJ: Yes not running but ideally still able to edit/correct the error if possible.
|
||||||
>> KN: If a user does not specify `default` identifier, it means they declare that they want to receive an error instead of doing something. So I think that just throwing an exception with an appropriate error message would be fine.
|
>> KN: If a user does not specify `default` identifier, it means they declare that they want to receive an error instead of doing something. So I think that just throwing an error with an appropriate error message would be fine.
|
||||||
>>> NOL: To be clear - this only applies if they have `contextStorage` in their settings, but no `default` config within it?
|
>>> NOL: To be clear - this only applies if they have `contextStorage` in their settings, but no `default` config within it?
|
||||||
>>>> KN: Yes, that's right. I've added a table below to clarify the conditions.
|
>>>> KN: Yes, that's right. I've added a table below to clarify the conditions.
|
||||||
4. if the entire contextStorage section is missing in settings.js, use `memory` module (same as the current context).
|
4. if the entire contextStorage section is missing in settings.js, use `memory` module (same as the current context).
|
||||||
|
|
||||||
The table below shows the settting of `settings.js` for each case above.
|
The table below shows the settting of `settings.js` for each case above.
|
||||||
|
|
||||||
| Case | `contextStorage` object in settings.js | appropriate identifier in `contextStorage` | `defualt` in `contextStorage` |
|
| Case | `contextStorage` object in settings.js | appropriate identifier in `contextStorage` | `default` in `contextStorage` | Action |
|
||||||
| ---- | --------- | --------- | -------- |
|
| ---- | --------- | --------- | -------- | -------- |
|
||||||
| 1 | Exists | Exists | Exists / Not exist|
|
| 1 | Exists | Exists | Exists / Not exist| Use the specified module |
|
||||||
| 2 | Exists | Not exist | Exists |
|
| 2 | Exists | Not exist | Exists | Use the `default` module |
|
||||||
| 3 | Exists | Not exist | Not exist |
|
| 3 | Exists | Not exist | Not exist | Throw an error |
|
||||||
| 4 | Not exist | N/A | N/A |
|
| 4 | Not exist | N/A | N/A | Use `memory` module |
|
||||||
|
|
||||||
## Executing plugin specific function
|
## Executing plugin specific function
|
||||||
Currently, `get` / `set` / `keys` is only methods to handle Context.
|
Currently, `get` / `set` / `keys` is only methods to handle Context.
|
||||||
|
Loading…
Reference in New Issue
Block a user