Skip to content

Import YDB C++ SDK 15 #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/import_generation.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15
16
2 changes: 1 addition & 1 deletion .github/last_commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9a3ba4fbaa4d0b2d6dcff910256db11b3c909166
b6b887dc9b0107368d53dff40e8ddcbc04001b57
17 changes: 16 additions & 1 deletion include/ydb-cpp-sdk/client/import/import.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class ListObjectsInS3ExportResult;
}

namespace NYdb::inline V3 {

class TProtoAccessor;

namespace NImport {

/// Common
Expand Down Expand Up @@ -99,6 +102,8 @@ struct TListObjectsInS3ExportSettings : public TOperationRequestSettings<TListOb
};

class TListObjectsInS3ExportResult : public TStatus {
friend class NYdb::TProtoAccessor;

public:
struct TItem {
// S3 object prefix
Expand All @@ -110,16 +115,26 @@ class TListObjectsInS3ExportResult : public TStatus {
void Out(IOutputStream& out) const;
};

TListObjectsInS3ExportResult(TStatus&& status, const ::Ydb::Import::ListObjectsInS3ExportResult& proto);
TListObjectsInS3ExportResult(TStatus&& status, const Ydb::Import::ListObjectsInS3ExportResult& proto);
TListObjectsInS3ExportResult(TListObjectsInS3ExportResult&&);
TListObjectsInS3ExportResult(const TListObjectsInS3ExportResult&);
~TListObjectsInS3ExportResult();

TListObjectsInS3ExportResult& operator=(TListObjectsInS3ExportResult&&);
TListObjectsInS3ExportResult& operator=(const TListObjectsInS3ExportResult&);

const std::vector<TItem>& GetItems() const;
const std::string& NextPageToken() const { return NextPageToken_; }

void Out(IOutputStream& out) const;

private:
const Ydb::Import::ListObjectsInS3ExportResult& GetProto() const;

private:
std::vector<TItem> Items_;
std::string NextPageToken_;
std::unique_ptr<Ydb::Import::ListObjectsInS3ExportResult> Proto_;
};

using TAsyncListObjectsInS3ExportResult = NThreading::TFuture<TListObjectsInS3ExportResult>;
Expand Down
7 changes: 6 additions & 1 deletion include/ydb-cpp-sdk/client/proto/accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class TTableDescription;
class TIndexDescription;
}

namespace NImport {
class TListObjectsInS3ExportResult;
}

//! Provides access to raw protobuf values of YDB API entities. It is not recommended to use this
//! class in client applications as it add dependency on API protobuf format which is subject to
//! change. Use functionality provided by YDB SDK classes.
Expand All @@ -46,7 +50,8 @@ class TProtoAccessor {
static const Ydb::Topic::DescribeTopicResult& GetProto(const NYdb::NTopic::TTopicDescription& topicDescription);
static const Ydb::Topic::DescribeConsumerResult& GetProto(const NYdb::NTopic::TConsumerDescription& consumerDescription);
static const Ydb::Monitoring::SelfCheckResult& GetProto(const NYdb::NMonitoring::TSelfCheckResult& selfCheckResult);
static const Ydb::Coordination::DescribeNodeResult& GetProto(const NYdb::NCoordination::TNodeDescription &describeNodeResult);
static const Ydb::Coordination::DescribeNodeResult& GetProto(const NYdb::NCoordination::TNodeDescription& describeNodeResult);
static const Ydb::Import::ListObjectsInS3ExportResult& GetProto(const NYdb::NImport::TListObjectsInS3ExportResult& result);
#ifdef YDB_SDK_INTERNAL_CLIENTS
static const Ydb::Replication::DescribeReplicationResult& GetProto(const NYdb::NReplication::TDescribeReplicationResult& desc);
static const Ydb::View::DescribeViewResult& GetProto(const NYdb::NView::TDescribeViewResult& desc);
Expand Down
1 change: 1 addition & 0 deletions src/client/import/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ target_sources(client-ydb_import
PRIVATE
import.cpp
out.cpp
proto_accessor.cpp
)

generate_enum_serilization(client-ydb_import
Expand Down
29 changes: 28 additions & 1 deletion src/client/import/import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ const TImportFromS3Response::TMetadata& TImportFromS3Response::Metadata() const
return Metadata_;
}

TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, const ::Ydb::Import::ListObjectsInS3ExportResult& proto)
TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, const Ydb::Import::ListObjectsInS3ExportResult& proto)
: TStatus(std::move(status))
, Proto_(std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(proto))
{
Items_.reserve(proto.items_size());
for (const auto& item : proto.items()) {
Expand All @@ -100,10 +101,36 @@ TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, con
NextPageToken_ = proto.next_page_token();
}

TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(const TListObjectsInS3ExportResult& result)
: TStatus(result)
, Items_(result.Items_)
, NextPageToken_(result.NextPageToken_)
, Proto_(std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(*result.Proto_))
{
}

TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TListObjectsInS3ExportResult&&) = default;

TListObjectsInS3ExportResult::~TListObjectsInS3ExportResult() = default;

TListObjectsInS3ExportResult& TListObjectsInS3ExportResult::operator=(TListObjectsInS3ExportResult&&) = default;

TListObjectsInS3ExportResult& TListObjectsInS3ExportResult::operator=(const TListObjectsInS3ExportResult& result) {
TStatus::operator=(result);
Items_ = result.Items_;
NextPageToken_ = result.NextPageToken_;
Proto_ = std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(*result.Proto_);
return *this;
}

const std::vector<TListObjectsInS3ExportResult::TItem>& TListObjectsInS3ExportResult::GetItems() const {
return Items_;
}

const Ydb::Import::ListObjectsInS3ExportResult& TListObjectsInS3ExportResult::GetProto() const {
return *Proto_;
}

void TListObjectsInS3ExportResult::Out(IOutputStream& out) const {
if (IsSuccess()) {
out << "{ items: [" << JoinSeq(", ", Items_) << "], next_page_token: \"" << NextPageToken_ << "\" }";
Expand Down
11 changes: 11 additions & 0 deletions src/client/import/proto_accessor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <ydb-cpp-sdk/client/proto/accessor.h>

#include <ydb-cpp-sdk/client/import/import.h>

namespace NYdb::inline V3 {

const Ydb::Import::ListObjectsInS3ExportResult& TProtoAccessor::GetProto(const NYdb::NImport::TListObjectsInS3ExportResult& result) {
return result.GetProto();
}

}
Loading
Loading