diff --git a/Design:Shared-Global-Context.md b/Design:Shared-Global-Context.md new file mode 100644 index 0000000..3080ca4 --- /dev/null +++ b/Design:Shared-Global-Context.md @@ -0,0 +1,15 @@ +## Requirements + +1. Enable persistence of context across restarts [reference](https://trello.com/c/J5xWa9r0) +2. Enable shared context when multiple instances of node-red are running the same flows [reference](https://trello.com/c/J5xWa9r0) +3. The model should follow that of the existing storage plugin mechanism. [reference](https://trello.com/c/J5xWa9r0) + +## Considerations + +1. Current [plugin model interface](https://github.com/node-red/node-red/blob/master/red/runtime/storage/index.js#L47) is specifically designed with getters/setters for specific data types (flows, settings, sessions). +2. The global context is dynamically typed, with the 'interface' being that of a [context](https://github.com/node-red/node-red/blob/e4c951984a45b33ffa65e1246efdab47066882b6/red/runtime/nodes/context.js#L21) with dynamic getter / setter functions accepting keys. + +## Approaches + +1. Create an inherited interface with dynamic getter / setters, extend prototype to create [storageModuleInterface](https://github.com/node-red/node-red/blob/master/red/runtime/storage/index.js#L47). +2. Modify the [storageModuleInterface](https://github.com/node-red/node-red/blob/master/red/runtime/storage/index.js#L47) to include dynamic getter / setters. \ No newline at end of file