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.
This commit is contained in:
@@ -23,6 +23,11 @@
|
||||
#include "Idle.hxx"
|
||||
#include "Stats.hxx"
|
||||
|
||||
#ifdef ENABLE_CURL
|
||||
#include "RemoteTagCache.hxx"
|
||||
#include "util/UriUtil.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DATABASE
|
||||
#include "db/DatabaseError.hxx"
|
||||
|
||||
@@ -114,3 +119,31 @@ Instance::LostNeighbor(gcc_unused const NeighborInfo &info) noexcept
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CURL
|
||||
|
||||
void
|
||||
Instance::LookupRemoteTag(const char *uri) noexcept
|
||||
{
|
||||
if (!uri_has_scheme(uri))
|
||||
return;
|
||||
|
||||
if (!remote_tag_cache)
|
||||
remote_tag_cache = std::make_unique<RemoteTagCache>(event_loop,
|
||||
*this);
|
||||
|
||||
remote_tag_cache->Lookup(uri);
|
||||
}
|
||||
|
||||
void
|
||||
Instance::OnRemoteTag(const char *uri, const Tag &tag) noexcept
|
||||
{
|
||||
if (!tag.IsDefined())
|
||||
/* boring */
|
||||
return;
|
||||
|
||||
for (auto &partition : partitions)
|
||||
partition.TagModified(uri, tag);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user