From 379c15cb123cd6641a585afc32772d619b81707c Mon Sep 17 00:00:00 2001 From: Kazuki Nakanishi Date: Tue, 20 Mar 2018 16:38:05 +0900 Subject: [PATCH] Updated Design: Persistable Context (markdown) --- Design:-Persistable-Context.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Design:-Persistable-Context.md b/Design:-Persistable-Context.md index ca51a77..77d2de7 100644 --- a/Design:-Persistable-Context.md +++ b/Design:-Persistable-Context.md @@ -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. >> 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. +>>>> 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 Currently, `get` / `set` / `keys` is only methods to handle Context.