db/update/Service: add noexcept

This commit is contained in:
Max Kellermann 2019-09-01 13:51:34 +02:00
parent d3cc54d4eb
commit 366de8773c
2 changed files with 11 additions and 11 deletions

View File

@ -41,7 +41,7 @@
UpdateService::UpdateService(const ConfigData &_config, UpdateService::UpdateService(const ConfigData &_config,
EventLoop &_loop, SimpleDatabase &_db, EventLoop &_loop, SimpleDatabase &_db,
CompositeStorage &_storage, CompositeStorage &_storage,
DatabaseListener &_listener) DatabaseListener &_listener) noexcept
:config(_config), :config(_config),
defer(_loop, BIND_THIS_METHOD(RunDeferred)), defer(_loop, BIND_THIS_METHOD(RunDeferred)),
db(_db), storage(_storage), db(_db), storage(_storage),
@ -50,7 +50,7 @@ UpdateService::UpdateService(const ConfigData &_config,
{ {
} }
UpdateService::~UpdateService() UpdateService::~UpdateService() noexcept
{ {
CancelAllAsync(); CancelAllAsync();
@ -59,7 +59,7 @@ UpdateService::~UpdateService()
} }
void void
UpdateService::CancelAllAsync() UpdateService::CancelAllAsync() noexcept
{ {
assert(GetEventLoop().IsInside()); assert(GetEventLoop().IsInside());
@ -70,7 +70,7 @@ UpdateService::CancelAllAsync()
} }
void void
UpdateService::CancelMount(const char *uri) UpdateService::CancelMount(const char *uri) noexcept
{ {
/* determine which (mounted) database will be updated and what /* determine which (mounted) database will be updated and what
storage will be scanned */ storage will be scanned */
@ -160,7 +160,7 @@ UpdateService::StartThread(UpdateQueueItem &&i)
} }
unsigned unsigned
UpdateService::GenerateId() UpdateService::GenerateId() noexcept
{ {
unsigned id = update_task_id + 1; unsigned id = update_task_id + 1;
if (id > update_task_id_max) if (id > update_task_id_max)

View File

@ -64,9 +64,9 @@ public:
UpdateService(const ConfigData &_config, UpdateService(const ConfigData &_config,
EventLoop &_loop, SimpleDatabase &_db, EventLoop &_loop, SimpleDatabase &_db,
CompositeStorage &_storage, CompositeStorage &_storage,
DatabaseListener &_listener); DatabaseListener &_listener) noexcept;
~UpdateService(); ~UpdateService() noexcept;
auto &GetEventLoop() const noexcept { auto &GetEventLoop() const noexcept {
return defer.GetEventLoop(); return defer.GetEventLoop();
@ -76,7 +76,7 @@ public:
* Returns a non-zero job id when we are currently updating * Returns a non-zero job id when we are currently updating
* the database. * the database.
*/ */
unsigned GetId() const { unsigned GetId() const noexcept {
return next.id; return next.id;
} }
@ -96,14 +96,14 @@ public:
* Clear the queue and cancel the current update. Does not * Clear the queue and cancel the current update. Does not
* wait for the thread to exit. * wait for the thread to exit.
*/ */
void CancelAllAsync(); void CancelAllAsync() noexcept;
/** /**
* Cancel all updates for the given mount point. If an update * Cancel all updates for the given mount point. If an update
* is already running for it, the method will wait for * is already running for it, the method will wait for
* cancellation to complete. * cancellation to complete.
*/ */
void CancelMount(const char *uri); void CancelMount(const char *uri) noexcept;
private: private:
/* DeferEvent callback */ /* DeferEvent callback */
@ -114,7 +114,7 @@ private:
void StartThread(UpdateQueueItem &&i); void StartThread(UpdateQueueItem &&i);
unsigned GenerateId(); unsigned GenerateId() noexcept;
}; };
#endif #endif