1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Updated Design: Persistable Context (markdown)

Kazuki Nakanishi 2018-03-20 16:38:05 +09:00
parent 55f31963ec
commit 379c15cb12

@ -98,6 +98,23 @@ The value set in the config is passed to the plugin. These items are defined by
>> but I'm worry that a user may continue to use existing memory context unintentionally. >> but I'm worry that a user may continue to use existing memory context unintentionally.
>> I think Node-RED should send warn to user. (but it will be too noisy...) >> I think Node-RED should send warn to user. (but it will be too noisy...)
>>> NOL: rather than 'if not specified', what if they explicitly set `default` to `"memory"` as a special identifier. >>> NOL: rather than 'if not specified', what if they explicitly set `default` to `"memory"` as a special identifier.
>>>> KN: I agree with supporting `"memory"` module. But I think that the case of 'if not specified' should happen when an existing user upgraded Node-RED.
>>>> There are three options to handle such a case. I prefer the option 1.
>>>> 1. Throw an error.
>>>> 2. Store the context variable in memory.
>>>> 3. Store the context variable in memory, and notify a user of the undefined module name.
>>>>
>>>> I listed the actual cases below. The above handling is related to the case 3.
- There are three different scenarios when importing a flow that uses context storage.
1. A user wants to run the flow as is by settings a context storage appropriately.
1. A user wants to always store context variable on the same storage (e.g. memory, file).
1. A user wants to receive an error if a context storage is used involuntarily.
- To support all of the above cases, when the imported flow contains a persistable context:
1. if the identifier is defined, use the context storage.
1. if the identifier is not defined but `default` identifier is defined, use the default context storage.
1. if neither the identifier nor a `default` identifier are not defined, throw an exception.
## 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.