Skip to content

Commit e9f2cd7

Browse files
committed
feat ydb: upd topic docs
b15b7b6dccd22dea83a06e91e67adca86412e7ee
1 parent c3d949e commit e9f2cd7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ydb/include/userver/ydb/topic.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
/// @file userver/ydb/topic.hpp
4+
/// @brief YDB Topic client
5+
36
#include <chrono>
47
#include <memory>
58
#include <string>
@@ -15,6 +18,14 @@ class Driver;
1518
struct TopicSettings;
1619
} // namespace impl
1720

21+
/// @brief Read session used to connect to one or more topics for reading
22+
///
23+
/// @see https://ydb.tech/docs/en/reference/ydb-sdk/topic#reading
24+
///
25+
/// ## Example usage:
26+
///
27+
/// @snippet userver/samples/ydb_service/components/topic_reader.hpp Sample
28+
/// Topic reader
1829
class TopicReadSession final {
1930
public:
2031
/// @cond
@@ -23,17 +34,32 @@ class TopicReadSession final {
2334
std::shared_ptr<NYdb::NTopic::IReadSession> read_session);
2435
/// @endcond
2536

37+
/// @brief Get read session events
38+
///
39+
/// Waits until event occurs
40+
/// @param max_events_count maximum events count in batch
41+
/// if not specified, read session chooses event batch size automatically
2642
std::vector<NYdb::NTopic::TReadSessionEvent::TEvent> GetEvents(
2743
std::optional<std::size_t> max_events_count = {});
2844

45+
/// @brief Close read session
46+
///
47+
/// Waits for all commit acknowledgments to arrive.
48+
/// Force close after timeout
2949
bool Close(std::chrono::milliseconds timeout);
3050

51+
/// Get native read session
3152
std::shared_ptr<NYdb::NTopic::IReadSession> GetNativeTopicReadSession();
3253

3354
private:
3455
std::shared_ptr<NYdb::NTopic::IReadSession> read_session_;
3556
};
3657

58+
/// @ingroup userver_clients
59+
///
60+
/// @brief YDB Topic Client
61+
///
62+
/// @see https://ydb.tech/docs/en/concepts/topic
3763
class TopicClient final {
3864
public:
3965
/// @cond
@@ -44,14 +70,18 @@ class TopicClient final {
4470

4571
~TopicClient();
4672

73+
/// Alter topic
4774
void AlterTopic(const std::string& path,
4875
const NYdb::NTopic::TAlterTopicSettings& settings);
4976

77+
/// Describe topic
5078
NYdb::NTopic::TDescribeTopicResult DescribeTopic(const std::string& path);
5179

80+
/// Create read session
5281
TopicReadSession CreateReadSession(
5382
const NYdb::NTopic::TReadSessionSettings& settings);
5483

84+
/// Get native topic client
5585
NYdb::NTopic::TTopicClient& GetNativeTopicClient();
5686

5787
private:

0 commit comments

Comments
 (0)