Skip to content

Commit 4443524

Browse files
UgnineSirdisGazizonoki
authored andcommitted
Support NImport::TListObjectsInS3ExportResult in TProtoAccessor (#20372)
1 parent 72dd89a commit 4443524

File tree

7 files changed

+67
-4
lines changed

7 files changed

+67
-4
lines changed

.github/last_commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9a3ba4fbaa4d0b2d6dcff910256db11b3c909166
1+
1fcb42722e6f8e953c7d1e30a142713f0a7b1544

include/ydb-cpp-sdk/client/import/import.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class ListObjectsInS3ExportResult;
1010
}
1111

1212
namespace NYdb::inline V3 {
13+
14+
class TProtoAccessor;
15+
1316
namespace NImport {
1417

1518
/// Common
@@ -99,6 +102,8 @@ struct TListObjectsInS3ExportSettings : public TOperationRequestSettings<TListOb
99102
};
100103

101104
class TListObjectsInS3ExportResult : public TStatus {
105+
friend class NYdb::TProtoAccessor;
106+
102107
public:
103108
struct TItem {
104109
// S3 object prefix
@@ -110,16 +115,26 @@ class TListObjectsInS3ExportResult : public TStatus {
110115
void Out(IOutputStream& out) const;
111116
};
112117

113-
TListObjectsInS3ExportResult(TStatus&& status, const ::Ydb::Import::ListObjectsInS3ExportResult& proto);
118+
TListObjectsInS3ExportResult(TStatus&& status, const Ydb::Import::ListObjectsInS3ExportResult& proto);
119+
TListObjectsInS3ExportResult(TListObjectsInS3ExportResult&&);
120+
TListObjectsInS3ExportResult(const TListObjectsInS3ExportResult&);
121+
~TListObjectsInS3ExportResult();
122+
123+
TListObjectsInS3ExportResult& operator=(TListObjectsInS3ExportResult&&);
124+
TListObjectsInS3ExportResult& operator=(const TListObjectsInS3ExportResult&);
114125

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

118129
void Out(IOutputStream& out) const;
119130

131+
private:
132+
const Ydb::Import::ListObjectsInS3ExportResult& GetProto() const;
133+
120134
private:
121135
std::vector<TItem> Items_;
122136
std::string NextPageToken_;
137+
std::unique_ptr<Ydb::Import::ListObjectsInS3ExportResult> Proto_;
123138
};
124139

125140
using TAsyncListObjectsInS3ExportResult = NThreading::TFuture<TListObjectsInS3ExportResult>;

include/ydb-cpp-sdk/client/proto/accessor.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class TTableDescription;
2929
class TIndexDescription;
3030
}
3131

32+
namespace NImport {
33+
class TListObjectsInS3ExportResult;
34+
}
35+
3236
//! Provides access to raw protobuf values of YDB API entities. It is not recommended to use this
3337
//! class in client applications as it add dependency on API protobuf format which is subject to
3438
//! change. Use functionality provided by YDB SDK classes.
@@ -46,7 +50,8 @@ class TProtoAccessor {
4650
static const Ydb::Topic::DescribeTopicResult& GetProto(const NYdb::NTopic::TTopicDescription& topicDescription);
4751
static const Ydb::Topic::DescribeConsumerResult& GetProto(const NYdb::NTopic::TConsumerDescription& consumerDescription);
4852
static const Ydb::Monitoring::SelfCheckResult& GetProto(const NYdb::NMonitoring::TSelfCheckResult& selfCheckResult);
49-
static const Ydb::Coordination::DescribeNodeResult& GetProto(const NYdb::NCoordination::TNodeDescription &describeNodeResult);
53+
static const Ydb::Coordination::DescribeNodeResult& GetProto(const NYdb::NCoordination::TNodeDescription& describeNodeResult);
54+
static const Ydb::Import::ListObjectsInS3ExportResult& GetProto(const NYdb::NImport::TListObjectsInS3ExportResult& result);
5055
#ifdef YDB_SDK_INTERNAL_CLIENTS
5156
static const Ydb::Replication::DescribeReplicationResult& GetProto(const NYdb::NReplication::TDescribeReplicationResult& desc);
5257
static const Ydb::View::DescribeViewResult& GetProto(const NYdb::NView::TDescribeViewResult& desc);

include/ydb-cpp-sdk/client/query/client.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ struct TClientSettings : public TCommonClientSettingsBase<TClientSettings> {
5353
FLUENT_SETTING(TSessionPoolSettings, SessionPoolSettings);
5454
};
5555

56+
// ! WARNING: Experimental API
57+
// ! This API is currently in experimental state and is a subject for changes.
58+
// ! No backward and/or forward compatibility guarantees are provided.
59+
// ! DO NOT USE for production workloads.
5660
class TQueryClient {
5761
friend class TSession;
5862
friend class NRetry::Async::TRetryContext<TQueryClient, TAsyncExecuteQueryResult>;

src/client/import/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_sources(client-ydb_import
1515
PRIVATE
1616
import.cpp
1717
out.cpp
18+
proto_accessor.cpp
1819
)
1920

2021
generate_enum_serilization(client-ydb_import

src/client/import/import.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ const TImportFromS3Response::TMetadata& TImportFromS3Response::Metadata() const
8787
return Metadata_;
8888
}
8989

90-
TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, const ::Ydb::Import::ListObjectsInS3ExportResult& proto)
90+
TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, const Ydb::Import::ListObjectsInS3ExportResult& proto)
9191
: TStatus(std::move(status))
92+
, Proto_(std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(proto))
9293
{
9394
Items_.reserve(proto.items_size());
9495
for (const auto& item : proto.items()) {
@@ -100,10 +101,36 @@ TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TStatus&& status, con
100101
NextPageToken_ = proto.next_page_token();
101102
}
102103

104+
TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(const TListObjectsInS3ExportResult& result)
105+
: TStatus(result)
106+
, Items_(result.Items_)
107+
, NextPageToken_(result.NextPageToken_)
108+
, Proto_(std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(*result.Proto_))
109+
{
110+
}
111+
112+
TListObjectsInS3ExportResult::TListObjectsInS3ExportResult(TListObjectsInS3ExportResult&&) = default;
113+
114+
TListObjectsInS3ExportResult::~TListObjectsInS3ExportResult() = default;
115+
116+
TListObjectsInS3ExportResult& TListObjectsInS3ExportResult::operator=(TListObjectsInS3ExportResult&&) = default;
117+
118+
TListObjectsInS3ExportResult& TListObjectsInS3ExportResult::operator=(const TListObjectsInS3ExportResult& result) {
119+
TStatus::operator=(result);
120+
Items_ = result.Items_;
121+
NextPageToken_ = result.NextPageToken_;
122+
Proto_ = std::make_unique<Ydb::Import::ListObjectsInS3ExportResult>(*result.Proto_);
123+
return *this;
124+
}
125+
103126
const std::vector<TListObjectsInS3ExportResult::TItem>& TListObjectsInS3ExportResult::GetItems() const {
104127
return Items_;
105128
}
106129

130+
const Ydb::Import::ListObjectsInS3ExportResult& TListObjectsInS3ExportResult::GetProto() const {
131+
return *Proto_;
132+
}
133+
107134
void TListObjectsInS3ExportResult::Out(IOutputStream& out) const {
108135
if (IsSuccess()) {
109136
out << "{ items: [" << JoinSeq(", ", Items_) << "], next_page_token: \"" << NextPageToken_ << "\" }";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <ydb-cpp-sdk/client/proto/accessor.h>
2+
3+
#include <ydb-cpp-sdk/client/import/import.h>
4+
5+
namespace NYdb::inline V3 {
6+
7+
const Ydb::Import::ListObjectsInS3ExportResult& TProtoAccessor::GetProto(const NYdb::NImport::TListObjectsInS3ExportResult& result) {
8+
return result.GetProto();
9+
}
10+
11+
}

0 commit comments

Comments
 (0)