diff options
| author | Stefan Boberg <[email protected]> | 2025-10-07 11:50:53 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-10-07 11:50:53 +0200 |
| commit | a1e36d1743c78b645ff0195cccad720e6a655017 (patch) | |
| tree | 5e5d666aa20d88b2da03bd831036e642d9a1cf22 /src | |
| parent | added some progress indication (diff) | |
| download | zen-a1e36d1743c78b645ff0195cccad720e6a655017.tar.xz zen-a1e36d1743c78b645ff0195cccad720e6a655017.zip | |
just some intermediate stuff, switching workstation
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/rpcreplay_cmd.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/zen/cmds/rpcreplay_cmd.cpp b/src/zen/cmds/rpcreplay_cmd.cpp index 61e7d61c8..e31df045a 100644 --- a/src/zen/cmds/rpcreplay_cmd.cpp +++ b/src/zen/cmds/rpcreplay_cmd.cpp @@ -601,12 +601,32 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv CbPackage RequestPackage; CbObject Request; + std::unordered_map<IoHash, CompressedBuffer> Attachments; + + std::vector<IoHash> Hashes; + std::vector<IoBuffer> AttachmentData; + + auto OnAttachment = [&](const IoHash& Hash, const CompressedBuffer& Data) { + Attachments[Hash] = std::move(Data); + + Hashes.push_back(Hash); + AttachmentData.emplace_back(Data.GetCompressed().ToShared().AsIoBuffer()); + }; + switch (RequestInfo.ContentType) { case ZenContentType::kCbPackage: if (ParsePackageMessageWithLegacyFallback(Payload, RequestPackage)) { Request = RequestPackage.GetObject(); + + for (const auto& Attachment : RequestPackage.GetAttachments()) + { + const auto& Hash = Attachment.GetHash(); + const auto& Binary = Attachment.AsCompressedBinary(); + + OnAttachment(Hash, Binary); + } } break; @@ -623,6 +643,11 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv continue; } + if (!Hashes.empty()) + { + Cids.AddChunks(AttachmentData, Hashes); + } + ++RequestsSeen; if (RequestsSeen % 100'000 == 0) @@ -643,7 +668,7 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv } CbObjectView Params = Request["Params"sv].AsObjectView(); - std::string_view Namespace = Request["Namespace"sv].AsString(); + std::string_view Namespace = Params["Namespace"sv].AsString(); int BatchSize = 0; @@ -664,14 +689,19 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv switch (MethodHash) { case "GetCacheValues"_djb2: + // ZEN_CONSOLE("GETCACHEVALUES: {}/{}/{}", Namespace, Bucket, Hash); break; case "GetCacheRecords"_djb2: + // ZEN_CONSOLE("GETCACHERECORDS: {}/{}/{}", Namespace, Bucket, Hash); break; case "PutCacheValues"_djb2: + // ZEN_CONSOLE("PUTCACHEVALUES: {}/{}/{}", Namespace, Bucket, Hash); break; case "PutCacheRecords"_djb2: + // ZEN_CONSOLE("PUTCACHERECORDS: {}/{}/{}", Namespace, Bucket, Hash); break; case "GetCacheChunks"_djb2: + // ZEN_CONSOLE("GETCACHECHUNKS: {}/{}/{}", Namespace, Bucket, Hash); break; } @@ -684,6 +714,8 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv if (MethodHash == kGetCacheValues) { + ZEN_CONSOLE("GETCACHEVALUES: {}/{}/{}", Namespace, Bucket, Hash); + /* { @@ -709,6 +741,22 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv } else if (MethodHash == kGetCacheRecords) { + if (CbObjectView Params = RequestEntry["Params"sv].AsObject()) + { + const std::string_view Namesoace = Params["Namespace"sv].AsString(); + CbObjectArrayView Requests = Params["Requests"sv].AsArray(); + + for (auto Request : Requests) + { + CbObjectView RequestView{Request}; + CbObjectView Key = RequestView["Key"sv]; + const std::string_view Bucket = Key["Bucket"sv]; + const IoHash Hash = Key["Hash"sv]; + + ZEN_CONSOLE("{}/{}/{}", Namespace, Bucket, Hash); + } + } + /* { |