db/update/Service: migrate from DeferredMonitor to DeferEvent
This commit is contained in:
parent
13f6b1b344
commit
0db7a0c9e2
@ -40,7 +40,7 @@
|
|||||||
UpdateService::UpdateService(EventLoop &_loop, SimpleDatabase &_db,
|
UpdateService::UpdateService(EventLoop &_loop, SimpleDatabase &_db,
|
||||||
CompositeStorage &_storage,
|
CompositeStorage &_storage,
|
||||||
DatabaseListener &_listener)
|
DatabaseListener &_listener)
|
||||||
:DeferredMonitor(_loop),
|
:defer(_loop, BIND_THIS_METHOD(RunDeferred)),
|
||||||
db(_db), storage(_storage),
|
db(_db), storage(_storage),
|
||||||
listener(_listener),
|
listener(_listener),
|
||||||
update_thread(BIND_THIS_METHOD(Task))
|
update_thread(BIND_THIS_METHOD(Task))
|
||||||
@ -136,7 +136,7 @@ UpdateService::Task()
|
|||||||
else
|
else
|
||||||
LogDebug(update_domain, "finished");
|
LogDebug(update_domain, "finished");
|
||||||
|
|
||||||
DeferredMonitor::Schedule();
|
defer.Schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -237,7 +237,7 @@ UpdateService::Enqueue(const char *path, bool discard)
|
|||||||
* Called in the main thread after the database update is finished.
|
* Called in the main thread after the database update is finished.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
UpdateService::RunDeferred()
|
UpdateService::RunDeferred() noexcept
|
||||||
{
|
{
|
||||||
assert(next.IsDefined());
|
assert(next.IsDefined());
|
||||||
assert(walk != nullptr);
|
assert(walk != nullptr);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "Queue.hxx"
|
#include "Queue.hxx"
|
||||||
#include "event/DeferredMonitor.hxx"
|
#include "event/DeferEvent.hxx"
|
||||||
#include "thread/Thread.hxx"
|
#include "thread/Thread.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
@ -34,7 +34,9 @@ class CompositeStorage;
|
|||||||
/**
|
/**
|
||||||
* This class manages the update queue and runs the update thread.
|
* This class manages the update queue and runs the update thread.
|
||||||
*/
|
*/
|
||||||
class UpdateService final : DeferredMonitor {
|
class UpdateService final {
|
||||||
|
DeferEvent defer;
|
||||||
|
|
||||||
SimpleDatabase &db;
|
SimpleDatabase &db;
|
||||||
CompositeStorage &storage;
|
CompositeStorage &storage;
|
||||||
|
|
||||||
@ -61,6 +63,10 @@ public:
|
|||||||
|
|
||||||
~UpdateService();
|
~UpdateService();
|
||||||
|
|
||||||
|
EventLoop &GetEventLoop() noexcept {
|
||||||
|
return defer.GetEventLoop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -93,8 +99,8 @@ public:
|
|||||||
void CancelMount(const char *uri);
|
void CancelMount(const char *uri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* virtual methods from class DeferredMonitor */
|
/* DeferEvent callback */
|
||||||
virtual void RunDeferred() override;
|
void RunDeferred() noexcept;
|
||||||
|
|
||||||
/* the update thread */
|
/* the update thread */
|
||||||
void Task();
|
void Task();
|
||||||
|
Loading…
Reference in New Issue
Block a user