* Use more hooks and no custom object managers
* Use the settings manager for the config values
* Allow fully disabling the hooks when both restore-props and restore-target
are disabled in the settings
* Change the format AND the name of the state file; use json directly
in the values now that we can
It is better to have type-specific event names to minimize the amount
of constraint string matches we do on hooks, as most hooks (if not all)
are interested on specific types of objects only.
Similarly, use a different object manager for each object type to
minimize the performance impact of iterations and lookups, as all
such actions are interested in only 1 object type every time.
Port all existing hooks to the new event names and the get-object-manager API.
This avoids having to determine the subject type prior to pushing
an event from lua code and makes the call more convenient
Also add a debug statement to trace calls to push_event
* Use a common function to unwrap the objects out of the event
* Use the same common function to get the si flags
* Do not store back the si flags - there is no point in doing that,
tables are objects in lua and they are passed around by reference
* Store the target on the event
Most of the configuration settings have a default value when they are loaded by
the Lua scripts if they are not present, so we leave them commented in the
configuration. This will make the configuration smaller when supporting layered
configuration, as all the commented sections will be part of the override files.
We cannot guarantee that the object's bound-id is always valid when an event is
triggered, especially when an object is removed. This patch uses the new object
wireplumber unique ID to index Lua tables, fixing runtime WP_PROXY_FEATURE_BOUND
check warnings.
- WirePlumber Lua now facilitates Lua libraries/modules, utilize this and create
modules. Add some tests around this functionality.
- Create policy-hooks.lua containing all the hooks to find-target events
- Create policy-utils.lua module and push all the policy utility functions to it.
- Create common-utils.lua module and push the common utility functions to it.
- Remove all the above functionality from policy-node.lua and clean it up.
- remove scheduling rescan via core APIs instead use the event stack for proper
scheduling.
- The rescan & handlelinkable hooks will push new findTargetSiAndLink events one
per session item.
- Register a new "after-events-with-event" hook for findTargetSiAndLink event,
it runs with lower priority than the rescan hook and so rescan hook can cancel
unneeded findTargetSiAndLink events.
- Register hooks for move and follow properties.
They is really no needed with the new _get() API and the WpSpaJson API. In C,
users can use 'wp_spa_json_parse_{boolean|int|float|string}()' APIs to parse the
WpSpaJson. In Lua, users can just do 'Settings.get(setting, m):parse()'.