- Merged together Bluetooth legacy and BLE plugins and scanners.
- Introduced Theengs as a dependency to infer BLE device types and
create sub-entities appropriately.
- Using `BluetoothDevice` and `BluetoothService` entities as the bread
and butter for all the Bluetooth plugin's components.
- Using a shared cache of devices and services between the legacy and
BLE integrations, with merging/coalescing logic included.
- Extended list of discoverable services to include all those officially
supported by the Bluetooth specs.
- Instantiate a separate pool of workers to discover services.
- Refactor of the Bluetooth events - all of them are now instantiated
from a single `BluetoothDevice` object.
Not the upserted entities themselves, no matter if expunged or made transient.
Reminder to my future self: returning the flushed entities and then using them
outside of the session or in another thread opens a big can of worms when using
SQLAlchemy.
That's the best way to ensure that all the columns are fetched eagerly and
prevent errors later when trying to access lazily loaded attributes outside
of the session/thread.
- Added `wait_start()` method that other threads can use to synchronize
with the engine and wait before performing db operations.
- Callback logic wrapped in a try/except block to prevent custom
integrations with buggy callbacks from crashing the engine.
ImportErrors on these entity modules will be ignored when dynamically
loading them, since they have optional external dependencies and we
shouldn't throw an error if we can't import them.
- Support for an optional callback on `publish_entities` to get notified
when the published object are flushed to the db.
- Use `lazy='selectin'` for the entity parent -> children relationship -
it is more efficient and it ensures that all the data the application
needs is loaded upfront.
- `Entity.entity_key` rolled back to `<external_id, plugin>`. The
fallback logic on `<id, plugin>` created more problems than those it
as supposed to solve.
- Added `expire_on_commit=False` to the entities engine session to make
sure that we don't get errors on detached/expired instances.
- Better logic to recursively link parent/children entities, so partial
updates won't get lost.
- Removed `EntitiesCache` - it was too much to maintain while keeping
consistent with the ORM, and it was a perennial fight against
SQLAlchemy's own cache.
- Removed `EntityNotifier` - with no need to merge cached entities, the
`notify` method has become much simpler and it's simply been merged
in the `EntitiesRepository`.
SQLAlchemy 2 has introduced several breaking changes that can break
several things in the application - especially where the code uses
`connection.execute()` with raw SQL statements.
We need to temporarily force the installation of versions from the 1.x
branch, while migrating the existing code to the new version.