The device list in the UI thread is replicated so we can show UI clients
the list without the need for a lock.
The previous implementation relied on loading and reloading of the device
list from the store every time an event changed either the devices or their
trust state.
This leads to a couple of ineficiencies leading to timeouts while
waiting on the database lock if a user has a large number of devices.
The new implementation never loads devices in the UI thread from the
database, they get passed through the thread queue by the main thread
which already holds them in memory.
This patch moves all the indexing, event storing and searching into a
separate class.
The index and message store are now represented as a single class and
messages are indexed and stored atomically now which should minimize the
chance of store/index inconsistencies.
Messages are now loaded from the store as a single SQL query and the
context for the messages is as well loaded from the store instead of
fetched from the server.
The room state and start/end tokens for the context aren't currently
loaded.
This patch adds support for the Matrix search API endpoint.
Events are stored in the pan sqlite database while the indexing is
handled by tanvity.
An tantivy index is created for each pan user. Currently only ordering
by ranking is supported, and all the search options are ignored for now.