store-worker: implement
store-worker is a thread + async queue to throttle requests to a single thread.
This commit is contained in:
@ -131,6 +131,7 @@ struct Store::Private {
|
||||
XapianDb xapian_db_;
|
||||
Config config_;
|
||||
ContactsCache contacts_cache_;
|
||||
std::unique_ptr<StoreWorker> store_worker_;
|
||||
std::unique_ptr<Indexer> indexer_;
|
||||
|
||||
const std::string root_maildir_;
|
||||
@ -252,6 +253,7 @@ Store::Store(Store&& other)
|
||||
{
|
||||
priv_ = std::move(other.priv_);
|
||||
priv_->indexer_.reset();
|
||||
priv_->store_worker_.reset();
|
||||
}
|
||||
|
||||
Store::~Store() = default;
|
||||
@ -316,6 +318,15 @@ Store::indexer()
|
||||
return *priv_->indexer_.get();
|
||||
}
|
||||
|
||||
StoreWorker&
|
||||
Store::store_worker()
|
||||
{
|
||||
if (!priv_->store_worker_)
|
||||
priv_->store_worker_ = std::make_unique<StoreWorker>(*this);
|
||||
|
||||
return *priv_->store_worker_;
|
||||
}
|
||||
|
||||
Result<Store::Id>
|
||||
Store::add_message(Message& msg, bool is_new)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user