-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* NBS-4905 GetCheckpointStatus * Fix compilation errors * Remove go changes * Fix go build * Fix review issues
- Loading branch information
Showing
22 changed files
with
418 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
cloud/blockstore/apps/client/lib/get_checkpoint_status.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "get_checkpoint_status.h" | ||
|
||
#include <cloud/blockstore/libs/service/context.h> | ||
#include <cloud/blockstore/libs/service/request_helpers.h> | ||
#include <cloud/blockstore/libs/service/service.h> | ||
#include <cloud/storage/core/libs/common/error.h> | ||
#include <cloud/storage/core/libs/diagnostics/logging.h> | ||
|
||
#include <library/cpp/protobuf/util/pb_io.h> | ||
|
||
namespace NCloud::NBlockStore::NClient { | ||
|
||
namespace { | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
class TGetCheckpointStatusCommand final: public TCommand | ||
{ | ||
private: | ||
TString DiskId; | ||
TString CheckpointId; | ||
|
||
public: | ||
TGetCheckpointStatusCommand(IBlockStorePtr client) | ||
: TCommand(std::move(client)) | ||
{ | ||
Opts.AddLongOption("disk-id", "volume identifier") | ||
.RequiredArgument("STR") | ||
.StoreResult(&DiskId); | ||
|
||
Opts.AddLongOption("checkpoint-id", "Checkpoint identifier") | ||
.RequiredArgument("STR") | ||
.StoreResult(&CheckpointId); | ||
} | ||
|
||
protected: | ||
bool DoExecute() override | ||
{ | ||
if (!Proto && !CheckOpts()) { | ||
return false; | ||
} | ||
|
||
auto& input = GetInputStream(); | ||
auto& output = GetOutputStream(); | ||
|
||
STORAGE_DEBUG("Reading GetCheckpointStatus request"); | ||
auto request = std::make_shared<NProto::TGetCheckpointStatusRequest>(); | ||
if (Proto) { | ||
ParseFromTextFormat(input, *request); | ||
} else { | ||
request->SetDiskId(DiskId); | ||
request->SetCheckpointId(CheckpointId); | ||
} | ||
|
||
STORAGE_DEBUG("Sending GetCheckpointStatus request"); | ||
const auto requestId = GetRequestId(*request); | ||
auto result = WaitFor(ClientEndpoint->GetCheckpointStatus( | ||
MakeIntrusive<TCallContext>(requestId), | ||
std::move(request))); | ||
|
||
STORAGE_DEBUG("Received GetCheckpointStatus response"); | ||
if (Proto) { | ||
SerializeToTextFormat(result, output); | ||
return true; | ||
} | ||
|
||
if (HasError(result)) { | ||
output << FormatError(result.GetError()) << Endl; | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private: | ||
bool CheckOpts() const | ||
{ | ||
const auto* diskId = ParseResultPtr->FindLongOptParseResult("disk-id"); | ||
if (!diskId) { | ||
STORAGE_ERROR("Disk id is required"); | ||
return false; | ||
} | ||
|
||
const auto* checkpointId = | ||
ParseResultPtr->FindLongOptParseResult("checkpoint-id"); | ||
if (!checkpointId) { | ||
STORAGE_ERROR("Checkpoint id is required"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
}; | ||
|
||
} // namespace | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
TCommandPtr NewGetCheckpointStatusCommand(IBlockStorePtr client) | ||
{ | ||
return MakeIntrusive<TGetCheckpointStatusCommand>(std::move(client)); | ||
} | ||
|
||
} // namespace NCloud::NBlockStore::NClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include "command.h" | ||
|
||
namespace NCloud::NBlockStore::NClient { | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
TCommandPtr NewGetCheckpointStatusCommand(IBlockStorePtr client); | ||
|
||
} // namespace NCloud::NBlockStore::NClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.