diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/rpcreplay_cmd.cpp | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/zen/cmds/rpcreplay_cmd.cpp b/src/zen/cmds/rpcreplay_cmd.cpp index b54cb9681..7979aae65 100644 --- a/src/zen/cmds/rpcreplay_cmd.cpp +++ b/src/zen/cmds/rpcreplay_cmd.cpp @@ -18,7 +18,10 @@ #include <zenutil/packageformat.h> #include <zencore/jobqueue.h> -#include <zenstore/structuredcachestore.h> +#include <zenstore/cache/cacherpc.h> +#include <zenstore/cache/structuredcachestore.h> +#include <zenstore/cache/upstreamcacheclient.h> +#include <zenstore/cidstore.h> ZEN_THIRD_PARTY_INCLUDES_START #include <cpr/cpr.h> @@ -527,9 +530,53 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv ZenCacheStore::Configuration Config; Config.AllowAutomaticCreationOfNamespaces = true; + struct DummyClient : public UpstreamCacheClient + { + virtual bool IsActive() override { return false; } + + virtual void GetCacheValues(std::string_view Namespace, + std::span<CacheValueRequest*> CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) override + { + ZEN_UNUSED(Namespace, CacheValueRequests, OnComplete); + return; + } + + virtual void GetCacheRecords(std::string_view Namespace, + std::span<CacheKeyRequest*> Requests, + OnCacheRecordGetComplete&& OnComplete) override + { + ZEN_UNUSED(Namespace, Requests, OnComplete); + return; + } + + virtual void GetCacheChunks(std::string_view Namespace, + std::span<CacheChunkRequest*> CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) override + { + ZEN_UNUSED(Namespace, CacheChunkRequests, OnComplete); + return; + } + + virtual void EnqueueUpstream(UpstreamCacheRecord CacheRecord) override + { + ZEN_UNUSED(CacheRecord); + return; + } + }; + GcManager Gc; std::unique_ptr<JobQueue> Jq = MakeJobQueue(2, "cache_jobs"); - Ref<ZenCacheStore> Store(new ZenCacheStore(Gc, *Jq, TargetPath, Config, nullptr)); + Ref<ZenCacheStore> Store(new ZenCacheStore(Gc, *Jq, TargetPath / "cache", Config, nullptr)); + + CidStore Cids{Gc}; + CidStoreConfiguration CidConfig; + CidConfig.RootDirectory = TargetPath / "cas"; + Cids.Initialize(CidConfig); + + DummyClient DummyUpstream; + CacheStats Stats; + CacheRpcHandler RpcHandler{logging::Default(), Stats, DummyUpstream, *Store, Cids, nullptr}; std::unique_ptr<cache::IRpcRequestReplayer> Replayer = cache::MakeDiskRequestReplayer(m_RecordingPath, true); const uint64_t EntryCount = Replayer->GetRequestCount(); |