diff options
| author | Stefan Boberg <[email protected]> | 2023-09-13 12:03:27 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-13 12:03:27 +0200 |
| commit | caf171abc24c20206eb8ecaff4b6e9137cb9e871 (patch) | |
| tree | 00ad62f2e829e6cb4608a4d70c6c4104b21315ce /src/zenserver/cache | |
| parent | incremental oplog upload for block-based targets (#392) (diff) | |
| download | zen-caf171abc24c20206eb8ecaff4b6e9137cb9e871.tar.xz zen-caf171abc24c20206eb8ecaff4b6e9137cb9e871.zip | |
ZenCacheStore is now reference counted (#398)
this change also adds a GetNamespaces function which may be used to enumerate all currently known cache namespaces
Diffstat (limited to 'src/zenserver/cache')
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.cpp | 10 | ||||
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.h | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp index 1f284863d..56e83eef2 100644 --- a/src/zenserver/cache/structuredcachestore.cpp +++ b/src/zenserver/cache/structuredcachestore.cpp @@ -536,6 +536,16 @@ ZenCacheStore::FindNamespace(std::string_view Namespace) const return nullptr; } +std::vector<std::string> +ZenCacheStore::GetNamespaces() +{ + std::vector<std::string> Namespaces; + + IterateNamespaces([&](std::string_view Namespace, ZenCacheNamespace&) { Namespaces.push_back(std::string(Namespace)); }); + + return Namespaces; +} + void ZenCacheStore::IterateNamespaces(const std::function<void(std::string_view Namespace, ZenCacheNamespace& Store)>& Callback) const { diff --git a/src/zenserver/cache/structuredcachestore.h b/src/zenserver/cache/structuredcachestore.h index 067cfc0bf..05b60da34 100644 --- a/src/zenserver/cache/structuredcachestore.h +++ b/src/zenserver/cache/structuredcachestore.h @@ -102,11 +102,11 @@ private: /** Cache store interface - This manages a set of namespaces used for caching purposes. + This manages a set of namespaces used for derived data caching purposes. */ -class ZenCacheStore final +class ZenCacheStore final : public RefCounted { public: static constexpr std::string_view DefaultNamespace = @@ -157,6 +157,7 @@ public: Info GetInfo() const; std::optional<ZenCacheNamespace::Info> GetNamespaceInfo(std::string_view Namespace); std::optional<ZenCacheNamespace::BucketInfo> GetBucketInfo(std::string_view Namespace, std::string_view Bucket); + std::vector<std::string> GetNamespaces(); private: const ZenCacheNamespace* FindNamespace(std::string_view Namespace) const; |