aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2024-04-05 22:57:53 -0600
committerGitHub Enterprise <[email protected]>2024-04-05 22:57:53 -0600
commit9140fe9650e53f3a5d07ad135aa0fc02d041b72f (patch)
tree66744b2ee1ecebe7a55ec7b6206069a887a57bda /src
parent5.4.4-pre0 (diff)
parentUpdate changelog (diff)
downloadzen-9140fe9650e53f3a5d07ad135aa0fc02d041b72f.tar.xz
zen-9140fe9650e53f3a5d07ad135aa0fc02d041b72f.zip
Merge pull request #41 from ue-foundation/zs/import-oplog-clean
Zs/import oplog clean
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/projectstore_cmd.cpp20
-rw-r--r--src/zen/cmds/projectstore_cmd.h3
2 files changed, 18 insertions, 5 deletions
diff --git a/src/zen/cmds/projectstore_cmd.cpp b/src/zen/cmds/projectstore_cmd.cpp
index 40ba48137..f877a3c51 100644
--- a/src/zen/cmds/projectstore_cmd.cpp
+++ b/src/zen/cmds/projectstore_cmd.cpp
@@ -1007,6 +1007,12 @@ ImportOplogCommand::ImportOplogCommand()
m_Options.add_option("", "u", "hosturl", "Host URL", cxxopts::value(m_HostName)->default_value(""), "<hosturl>");
m_Options.add_option("", "p", "project", "Project name", cxxopts::value(m_ProjectName), "<projectid>");
m_Options.add_option("", "o", "oplog", "Oplog name", cxxopts::value(m_OplogName), "<oplogid>");
+ m_Options.add_option("",
+ "",
+ "gcpath",
+ "Absolute path to oplog lifetime marker file if we create the oplog",
+ cxxopts::value(m_GcPath),
+ "<path>");
m_Options.add_option("", "", "maxblocksize", "Max size for bundled attachments", cxxopts::value(m_MaxBlockSize), "<blocksize>");
m_Options.add_option("",
"",
@@ -1016,6 +1022,7 @@ ImportOplogCommand::ImportOplogCommand()
"<chunksize>");
m_Options.add_option("", "f", "force", "Force import of all attachments", cxxopts::value(m_Force), "<force>");
m_Options.add_option("", "a", "async", "Trigger import but don't wait for completion", cxxopts::value(m_Async), "<async>");
+ m_Options.add_option("", "", "clean", "Delete existing target oplog", cxxopts::value(m_Clean), "<clean>");
m_Options.add_option("",
"",
"ignore-missing-attachments",
@@ -1052,12 +1059,12 @@ ImportOplogCommand::ImportOplogCommand()
m_Options.add_option("", "", "zen", "Zen service upload address", cxxopts::value(m_ZenUrl), "<url>");
m_Options.add_option("zen", "", "source-project", "Zen source project name", cxxopts::value(m_ZenProjectName), "<sourceprojectid>");
m_Options.add_option("zen", "", "source-oplog", "Zen source oplog name", cxxopts::value(m_ZenOplogName), "<sourceoplogid>");
- m_Options.add_option("zen", "", "clean", "Delete existing target Zen oplog", cxxopts::value(m_ZenClean), "<clean>");
m_Options.add_option("", "", "file", "Local folder path", cxxopts::value(m_FileDirectoryPath), "<path>");
m_Options.add_option("file", "", "name", "Local file name", cxxopts::value(m_FileName), "<filename>");
- m_Options.parse_positional({"project", "oplog"});
+ m_Options.parse_positional({"project", "oplog", "gcpath"});
+ m_Options.positional_help("[<projectid> <oplogid> [<gcpath>]]");
}
ImportOplogCommand::~ImportOplogCommand()
@@ -1153,7 +1160,7 @@ ImportOplogCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** arg
bool CreateOplog = false;
if (HttpClient::Response Result = Http.Get(Url, HttpClient::Accept(ZenContentType::kJSON)))
{
- if (m_ZenClean)
+ if (m_Clean)
{
ZEN_WARN("Deleting oplog '{}/{}'", m_ProjectName, m_OplogName)
Result = Http.Delete(Url, HttpClient::Accept(ZenContentType::kJSON));
@@ -1177,8 +1184,13 @@ ImportOplogCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** arg
if (CreateOplog)
{
+ IoBuffer OplogPayload;
+ if (!m_GcPath.empty())
+ {
+ OplogPayload = MakeCbObjectPayload([&](CbObjectWriter& Writer) { Writer.AddString("gcpath"sv, m_GcPath); });
+ }
ZEN_WARN("Creating oplog '{}/{}'", m_ProjectName, m_OplogName);
- if (HttpClient::Response Result = Http.Post(Url); !Result)
+ if (HttpClient::Response Result = Http.Post(Url, OplogPayload); !Result)
{
Result.ThrowError("failed creating oplog"sv);
return 1;
diff --git a/src/zen/cmds/projectstore_cmd.h b/src/zen/cmds/projectstore_cmd.h
index 5a3f7281b..215614b01 100644
--- a/src/zen/cmds/projectstore_cmd.h
+++ b/src/zen/cmds/projectstore_cmd.h
@@ -172,11 +172,13 @@ private:
std::string m_HostName;
std::string m_ProjectName;
std::string m_OplogName;
+ std::string m_GcPath;
size_t m_MaxBlockSize = 0;
size_t m_MaxChunkEmbedSize = 0;
bool m_Force = false;
bool m_Async = false;
bool m_IgnoreMissingAttachments = false;
+ bool m_Clean = false;
std::string m_CloudUrl;
std::string m_CloudNamespace;
@@ -191,7 +193,6 @@ private:
std::string m_ZenUrl;
std::string m_ZenProjectName;
std::string m_ZenOplogName;
- bool m_ZenClean;
std::string m_FileDirectoryPath;
std::string m_FileName;