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

Created Design:Shared Global Context (markdown)

TJKoury 2016-11-01 20:21:41 -04:00
parent d1ff38853c
commit 84b366f32e

@ -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.