summaryrefslogtreecommitdiff
path: root/src/Instance.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-29 12:02:14 +0100
committerMax Kellermann <max@musicpd.org>2018-01-30 00:05:57 +0100
commitce2b6dc84d2e62cb4686b052613af383c8f620e1 (patch)
treede2b924d2a671074bb3448baffde6fa57b3e8324 /src/Instance.hxx
parent7d16d8c8871b628244c5110103c7220940092462 (diff)
RemoteTagCache: new glue class for integrating RemoteTagScanner
This commit also puts an instance of RemoteTagScanner into the Instance class, and hooks it into the "add" and "addid" commands.
Diffstat (limited to 'src/Instance.hxx')
-rw-r--r--src/Instance.hxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Instance.hxx b/src/Instance.hxx
index 9dcb2f788..bec707219 100644
--- a/src/Instance.hxx
+++ b/src/Instance.hxx
@@ -26,6 +26,10 @@
#include "event/MaskMonitor.hxx"
#include "Compiler.h"
+#ifdef ENABLE_CURL
+#include "RemoteTagCacheHandler.hxx"
+#endif
+
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Listener.hxx"
class NeighborGlue;
@@ -38,11 +42,13 @@ class Storage;
class UpdateService;
#endif
+#include <memory>
#include <list>
class ClientList;
struct Partition;
class StateFile;
+class RemoteTagCache;
/**
* A utility class which, when used as the first base class, ensures
@@ -66,6 +72,9 @@ struct Instance final
#ifdef ENABLE_NEIGHBOR_PLUGINS
public NeighborListener
#endif
+#ifdef ENABLE_CURL
+ , public RemoteTagCacheHandler
+#endif
{
EventThread io_thread;
@@ -87,6 +96,10 @@ struct Instance final
UpdateService *update = nullptr;
#endif
+#ifdef ENABLE_CURL
+ std::unique_ptr<RemoteTagCache> remote_tag_cache;
+#endif
+
ClientList *client_list;
std::list<Partition> partitions;
@@ -139,6 +152,14 @@ struct Instance final
void FinishShutdownUpdate() noexcept;
void ShutdownDatabase() noexcept;
+#ifdef ENABLE_CURL
+ void LookupRemoteTag(const char *uri) noexcept;
+#else
+ void LookupRemoteTag(const char *) noexcept {
+ /* no-op */
+ }
+#endif
+
private:
#ifdef ENABLE_DATABASE
void OnDatabaseModified() override;
@@ -151,6 +172,11 @@ private:
void LostNeighbor(const NeighborInfo &info) noexcept override;
#endif
+#ifdef ENABLE_CURL
+ /* virtual methods from class RemoteTagCacheHandler */
+ void OnRemoteTag(const char *uri, const Tag &tag) noexcept override;
+#endif
+
/* callback for #idle_monitor */
void OnIdle(unsigned mask);
};