I'm writing a Matter node and I have a configuration node that generates a virtual Matter device, when the device is generated I have several ids and a small json object I need to store in order to restore the device anytime Node-RED starts.
So, since the user is already in the config node edit panel, can't you simply create the device and store whatever is necessary in the config nodes defaults object. Then it will persist as part of the flow. The advantage is it will work on systems without a file system or persistent context.
So in the config edit form, where the user generates a device, can't that be a device description that, when deployed creates the device?
I was asking for details so I can pinpoint where and when data needs persisting.
That's not correct Steve. A standard Node-RED docker install would have no problems with writing to the filing system. Since you have to add a /data/ folder which is writable from Node-RED otherwise NR won't work at all.
It is only a problem for services like FlowForge that don't provide a full filing system.
If you want the best of all worlds, you can put the choice of storage into the flow authors hands by allowing them to choose from the possible context stores.
Check out uibuilder's uib-cache node for an example of how to do this. The choice of store is set in the node's config in the Editor and the user is offered all of the available stores.
That would have the same issue as other FS based answers. It uses the FS to do the store and I'm not convinced it gives anything better than a persistent Node-RED context store?
As long as you are in an environment where a persistent store will work (either the FS based one or perhaps the REDIS store), then you should be good.
For most people, you can. But as Steve mentioned, there are some Node-RED environments that don't have a full FS available. Won't matter to most people running their own or standard cloud environments. Will matter if you use FlowForge or some other environment that does horizontal scaling and so where work might get passed to a different instance.