core
core copied to clipboard
Expose the Volatilizer interface functions to the server-side runtime
There's missing functions from a server-side function PoV from the internal.Volatilizer (Cache / PubSub) interface that would be useful to have in functions.
The custom server-side runtime is implemented in the function package in the runtime.go file.
At this moment the runtime adds functions that are made available from the function's JavaScript interpreter.
In the function addVolatileFunctions in runtime.go line:391 we would need to add the following functions from the interface.
Look at the send function for an example
cacheGet and cacheSet would wrap the interface's GetType and SetType functions which will handle passing string as well as any object.
inc and dec would map to the interface's Inc and Dec functions
Lastly queueWork maps to the interface's QueueWork function
Adding those runtime functions will enable a world of possibility from server-side function, even though they run inside a sandboxed runtime.