Skip to content

Commit 7581657

Browse files
ildar-khisambeevGazizonoki
authored andcommitted
Moved "separate include targets" commit from ydb repo
1 parent ed6691b commit 7581657

File tree

113 files changed

+3462
-9307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3462
-9307
lines changed

examples/topic_reader/eventloop/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <ydb-cpp-sdk/client/topic/topic.h>
1+
#include <ydb-cpp-sdk/client/topic/client.h>
22

33
#include <src/library/getopt/last_getopt.h>
44

examples/topic_reader/simple/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <ydb-cpp-sdk/client/topic/topic.h>
1+
#include <ydb-cpp-sdk/client/topic/client.h>
22

33
#include <src/library/getopt/last_getopt.h>
44

examples/topic_reader/transaction/application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "options.h"
44

55
#include <ydb-cpp-sdk/client/driver/driver.h>
6-
#include <ydb-cpp-sdk/client/topic/topic.h>
6+
#include <ydb-cpp-sdk/client/topic/client.h>
77
#include <ydb-cpp-sdk/client/table/table.h>
88

99
#include <memory>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <ydb-cpp-sdk/client/topic/topic.h>
3+
#include <ydb-cpp-sdk/client/topic/client.h>
44

55
#include <src/api/protos/ydb_federation_discovery.pb.h>
66

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <ydb-cpp-sdk/client/import/import.h>
1414
#include <ydb-cpp-sdk/client/monitoring/monitoring.h>
1515
#include <ydb-cpp-sdk/client/table/table.h>
16-
#include <ydb-cpp-sdk/client/topic/topic.h>
16+
#include <ydb-cpp-sdk/client/topic/client.h>
1717

1818
namespace NYdb {
1919

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#pragma once
2+
3+
#include "control_plane.h"
4+
#include "read_session.h"
5+
#include "write_session.h"
6+
7+
namespace NYdb::NTopic {
8+
9+
struct TTopicClientSettings : public TCommonClientSettingsBase<TTopicClientSettings> {
10+
using TSelf = TTopicClientSettings;
11+
12+
//! Default executor for compression tasks.
13+
FLUENT_SETTING_DEFAULT(IExecutor::TPtr, DefaultCompressionExecutor, CreateThreadPoolExecutor(2));
14+
15+
//! Default executor for callbacks.
16+
FLUENT_SETTING_DEFAULT(IExecutor::TPtr, DefaultHandlersExecutor, CreateThreadPoolExecutor(1));
17+
};
18+
19+
// Topic client.
20+
class TTopicClient {
21+
public:
22+
class TImpl;
23+
24+
TTopicClient(const TDriver& driver, const TTopicClientSettings& settings = TTopicClientSettings());
25+
26+
void ProvideCodec(ECodec codecId, THolder<ICodec>&& codecImpl);
27+
28+
// Create a new topic.
29+
TAsyncStatus CreateTopic(const std::string& path, const TCreateTopicSettings& settings = {});
30+
31+
// Update a topic.
32+
TAsyncStatus AlterTopic(const std::string& path, const TAlterTopicSettings& settings = {});
33+
34+
// Delete a topic.
35+
TAsyncStatus DropTopic(const std::string& path, const TDropTopicSettings& settings = {});
36+
37+
// Describe a topic.
38+
TAsyncDescribeTopicResult DescribeTopic(const std::string& path, const TDescribeTopicSettings& settings = {});
39+
40+
// Describe a topic consumer.
41+
TAsyncDescribeConsumerResult DescribeConsumer(const std::string& path, const std::string& consumer, const TDescribeConsumerSettings& settings = {});
42+
43+
// Describe a topic partition
44+
TAsyncDescribePartitionResult DescribePartition(const std::string& path, i64 partitionId, const TDescribePartitionSettings& settings = {});
45+
46+
//! Create read session.
47+
std::shared_ptr<IReadSession> CreateReadSession(const TReadSessionSettings& settings);
48+
49+
//! Create write session.
50+
std::shared_ptr<ISimpleBlockingWriteSession> CreateSimpleBlockingWriteSession(const TWriteSessionSettings& settings);
51+
std::shared_ptr<IWriteSession> CreateWriteSession(const TWriteSessionSettings& settings);
52+
53+
// Commit offset
54+
TAsyncStatus CommitOffset(const std::string& path, ui64 partitionId, const std::string& consumerName, ui64 offset,
55+
const TCommitOffsetSettings& settings = {});
56+
57+
protected:
58+
void OverrideCodec(ECodec codecId, THolder<ICodec>&& codecImpl);
59+
60+
private:
61+
std::shared_ptr<TImpl> Impl_;
62+
};
63+
64+
} // namespace NYdb::NTopic

include/ydb-cpp-sdk/client/topic/codecs/codecs.h renamed to include/ydb-cpp-sdk/client/topic/codecs.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ enum class ECodec : ui32 {
2121
CUSTOM = 10000,
2222
};
2323

24+
inline const std::string& GetCodecId(const ECodec codec) {
25+
static std::unordered_map<ECodec, std::string> idByCodec{
26+
{ECodec::RAW, std::string(1, '\0')},
27+
{ECodec::GZIP, "\1"},
28+
{ECodec::LZOP, "\2"},
29+
{ECodec::ZSTD, "\3"}
30+
};
31+
Y_ABORT_UNLESS(idByCodec.contains(codec));
32+
return idByCodec[codec];
33+
}
34+
2435
class ICodec {
2536
public:
2637
virtual ~ICodec() = default;
@@ -122,6 +133,4 @@ class TCodecMap {
122133
TAdaptiveLock Lock;
123134
};
124135

125-
#define CODEC_MAP_ALREADY_PROVIDED
126-
127136
} // namespace NYdb::NTopic

0 commit comments

Comments
 (0)