blob: bf41e2d7b39c52d49109766adb16771ab9ca8b1f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <zencore/filesystem.h>
#include <zencore/iohash.h>
#include <functional>
namespace zen {
class CbObjectView;
}
namespace cpr {
class Response;
}
class ExportProjectCommand : public ZenCmdBase
{
public:
ExportProjectCommand();
~ExportProjectCommand();
virtual int Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options* Options() override { return &m_Options; }
struct OplogHeader
{
enum uint32
{
kMagic = 0x7816'B013
};
uint32_t Magic = kMagic;
uint32_t HeaderSize = sizeof(OplogHeader);
uint64_t OpCount = 0;
zen::IoHash Checksum = zen::IoHash::Zero;
};
struct OplogEntry
{
uint64_t Offset;
uint32_t OpLength;
};
struct ChunksHeader
{
enum uint32
{
kMagic = 0x574C'B016
};
uint32_t Magic = kMagic;
uint64_t ChunkCount = 0;
uint8_t BlockSizeShift = 31u;
uint8_t Reserved1 = 0;
uint16_t Reserved2 = 0;
uint32_t Reserved3 = 0;
};
struct ChunkEntry
{
zen::IoHash ChunkHash;
uint64_t Offset;
uint64_t Length;
};
static std::filesystem::path GetOplogPath(const std::filesystem::path RootPath, const std::string& Oplog);
static std::filesystem::path GetLargeChunkPath(const std::filesystem::path RootPath, const zen::IoHash& OpHash);
static std::filesystem::path GetProjectPath(const std::filesystem::path RootPath, const std::string_view ProjectName);
static std::filesystem::path GetChunksIndexPath(const std::filesystem::path RootPath);
static std::filesystem::path GetChunksPath(const std::filesystem::path RootPath, uint32_t BlockIndex);
static bool IsSuccess(const cpr::Response& Response, const std::string_view Operation);
private:
cxxopts::Options m_Options{"export-project", "Export one or more project oplogs to disk"};
std::string m_HostName;
std::string m_TargetPath;
std::string m_ProjectName;
std::vector<std::string> m_OplogNames;
};
|