Controller refactoring and feature push (#1285)
* Introduce Disk Async storage and use by default
... at least in all Environment based cases.
* Adjust storage usage in tests
... so use async by default and Sync once (switch that around compared to before)
* Adjust storage usage in tests
... so use async by default and Sync once (switch that around compared to before)
* Adds events of channel additions and networkaddress storage
Add an event to the Channel manager so that PeerSet can get an event when a new channel was added (potentially because device was connected by a peer) and enhance udp channel to expose it's network address to update the operational address on peerset
* Fixes in DeviceAdvertiser
invalid parameter name and data, and missing timer stop that blocked shutdown
* Refactor ExchangeProvider
ExchangeProvider is now an abstract class with two child classes.
One is a Dedicated version where the used channel is provided on construction and only this is used. This is mainly used by Commissioning.
The Reconnectable exchange provider now always uses the latest known channel instead of a static one. The reconnectChannel callback still exists but is only used when no channel exists. It also contains an event to inform other about a change of a channel.
Additionally, the ExchangeProvider class got moved to an own file.
* Validate subscription IDs on incoming datareports
Till now we accepted all datareports and just checked at the end if they are for a valid subscription id. This change adjusts this as needed to already decline invalid subscription data on first package to save bandwidth.
Additionally, we do not need to wait for the last Success Status to be sent or messenger to be closed before processing the data, so we ignore errors there but log them.
But still try to close the messenger as soon as possible to prevent resubmissions because of missing ack's.
* Ethernet connection wins in DeviceInformation
When no network interface is reported as connected or existing then we simply consider the devcie as ethernet connected because it is in fact on te network, else we would not be able to communicate with it.
* Added TODO
... i think subscriptions should not be on session but on node ... for later
* Rework Connection and InteractionClient handling
This commit reworks the way how we establish and reconnect a connection to a node. it also makes sure to only have one InteractionCLient instance which is shared (because it makes no sense to have different ones for now). Also Special reconnection with rediscovery is using deferred promisses to prevent concurrent actions.
* Always close unsecure sessions
... also when there are exceptions
* ControllerStore rework
I know that this part is "controverse" because ClientNode might not really use this but it is fine if this stays within the "legacy world".
ControllerStore and LegacyControllerstore hide the differences between the two versions and "clientNodeSTore" factory method generates a storage context for the storage for one client node. I know that this will be different in new API later but thats fine because this can be build up again.
This class combines several classes added into MatterController by one.
* Initialize Broadcaster for Controller
This commit add the broadcaster to the controller and triggers announcement on start. It also gets the port of the IPv6 socket and uses the same for IPv4 because we can only announce one port for now.
* Introduce ClientEndpointStore
... to be used by legacy logic. This enhances the Endpoint store by adding an in-mem layer. So reads are sync and writes are async but update in mem values too.
As discussed it also adjusts the initialValues of the Datastore function to be passed in once because they do not need to be referenced anymore because just initially relevant.
* EndpointStore: set in parallel
... process set in parallel to optimize storage timing. Will have some effects with Async storage
* Enhance PeerStore to get client store
* Introduce "PeerNodeStore" interface
This interface described the data interface to access cached attribute values for low level usage in interaction client. The idea is to have data structures "the same" as the ones received from the wire to easiely enhance data and such for developer convenience.
This class replaces the static structure in PeerSet.
* InteractionClient rework
This commit does two things
1.) Adjust the data storage and enrichment to the new way
2.) Optimizs communication again to keep the "withMessenger()" logic as small and relevant to communication as possible. Reason is that the messenger is closed at the end of the sub logic execution which delays the last ack potentially for not needed reasons. So most changes are moving around code to minify the code inside the Messenger part. Additionally we do not wait for the messenger to close because we are done and the result would not be different if the ack is not sent correctly, so we "ignore" this, but log.
* Enhance Controller protocol handlers
Adding a SecureChannel protocol handler allows devices to establish CASE sessions. We also directly add the SubscriptionClient by default (and not delayed with first subscription as before) so that we can recieve subscription datareports anytime.
... and some smaller changes
* PairedNode enhancements
* Add backoff strategy for reconnect delays
* PairedNode including complete structure is always initialized with known data when available and that's then updated. means: Node can usually be directly be used
* Splitup events to know if local or remote init was done
* internal optimizations for reconnects and such
* added some guards to prevent concurrent reconnection processes
* we always have an interactionClient and it is not replaced any longer
* Stop reconnection timeouts in some cases when devices with persisted subscriptions come back online fast enough
* Leftover changes because of other changes
* Adjust tests
* Shell adjustments
Mainly converting Shell to the environment based storage approach. With --legacyStorage parameter
* Changelog
* Readme and Storage migration guide
* Fix the chip testing async storage class
* Introduce IpNetworkChannel to mark channels on IP network
Addressing review feedback
* Class renames
Addressing review feedback
* Asyncstorage handling changes
... and some more review feedback
* Paired Node status enhancement