-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App lifecycle #946
Comments
I agree with the proposal. With regard to the function ops.start (name)
local class = conf.apps[name].class
local arg = conf.apps[name].arg
local app = class:new(arg, { appname = name})
....
app.appname = name
app.output = {}
app.input = {} Otherwise, an app should have to wait until |
It would be great to have a |
@Eugenia Thanks for the pointer, that covers my use case. As for renaming |
This is a proposal for the lifecycle of apps and their callbacks from the engine. Motivation is to neatly support all existing use cases and provide simple and predictable behavior. Especially to resolve #945.
I propose that the callbacks to an app follow this grammar:
That is: first the
start
callback, then any number of andlink
andpull
andpush
andconfig
andtick
callbacks, then finally astop
callback.Callback definitions:
new(config) => app
is called to create the app with its starting configuration. Required.link()
is called any time the app's input/output links may have been changed (including on startup). Guaranteed to be called beforepull
andpush
are called with new links. Optional: no action if absent.pull()
is called to introduce new packets from external sources into the app network. Optional: no action if absent.push()
is called to process packets from input links. Optional: no action if absent.config(newconfig)
is called when the engine wants to change the configuration of the app. Optional: app is recreated if the config is changed and this callback is absent.tick()
is called every one millisecond. Can be used forpull
-like functionality that runs at low frequency. Optional: no action if absent.stop(error)
is called upon termination. The argumenterror
is nil for graceful termination or otherwise apcall
-style error. Optional: no action if absent.cc @dpino @alexandergall @eugeneia
The text was updated successfully, but these errors were encountered: