diff options
author | robdrynkin <robdrynkin@yandex-team.com> | 2023-06-12 10:52:35 +0300 |
---|---|---|
committer | robdrynkin <robdrynkin@yandex-team.com> | 2023-06-12 10:52:35 +0300 |
commit | d4d1325a138f2bea1fbb4aa9ef8266382f7a09d1 (patch) | |
tree | 325e185ce471e523420dff780e94ac739269ef0f /ydb/public/sdk/cpp/client/ydb_table/impl/readers.h | |
parent | 90abfcac34c50a1d082fd4e6f6e237a4b56d31c5 (diff) | |
download | ydb-d4d1325a138f2bea1fbb4aa9ef8266382f7a09d1.tar.gz |
Add waiters queue + refactoring
Diffstat (limited to 'ydb/public/sdk/cpp/client/ydb_table/impl/readers.h')
-rw-r--r-- | ydb/public/sdk/cpp/client/ydb_table/impl/readers.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ydb/public/sdk/cpp/client/ydb_table/impl/readers.h b/ydb/public/sdk/cpp/client/ydb_table/impl/readers.h new file mode 100644 index 0000000000..8103ce0925 --- /dev/null +++ b/ydb/public/sdk/cpp/client/ydb_table/impl/readers.h @@ -0,0 +1,66 @@ +#pragma once + +#include <ydb/public/sdk/cpp/client/resources/ydb_resources.h> + +#include <ydb/public/api/grpc/ydb_table_v1.grpc.pb.h> +#include <ydb/public/sdk/cpp/client/ydb_proto/accessor.h> + +#include <util/random/random.h> + +#include "client_session.h" +#include "data_query.h" +#include "request_migrator.h" + + +namespace NYdb { +namespace NTable { + +using namespace NThreading; + + +class TTablePartIterator::TReaderImpl { +public: + using TSelf = TTablePartIterator::TReaderImpl; + using TResponse = Ydb::Table::ReadTableResponse; + using TStreamProcessorPtr = NGrpc::IStreamRequestReadProcessor<TResponse>::TPtr; + using TReadCallback = NGrpc::IStreamRequestReadProcessor<TResponse>::TReadCallback; + using TGRpcStatus = NGrpc::TGrpcStatus; + using TBatchReadResult = std::pair<TResponse, TGRpcStatus>; + + TReaderImpl(TStreamProcessorPtr streamProcessor, const TString& endpoint); + ~TReaderImpl(); + bool IsFinished(); + TAsyncSimpleStreamPart<TResultSet> ReadNext(std::shared_ptr<TSelf> self); + +private: + TStreamProcessorPtr StreamProcessor_; + TResponse Response_; + bool Finished_; + TString Endpoint_; +}; + + +class TScanQueryPartIterator::TReaderImpl { +public: + using TSelf = TScanQueryPartIterator::TReaderImpl; + using TResponse = Ydb::Table::ExecuteScanQueryPartialResponse; + using TStreamProcessorPtr = NGrpc::IStreamRequestReadProcessor<TResponse>::TPtr; + using TReadCallback = NGrpc::IStreamRequestReadProcessor<TResponse>::TReadCallback; + using TGRpcStatus = NGrpc::TGrpcStatus; + using TBatchReadResult = std::pair<TResponse, TGRpcStatus>; + + TReaderImpl(TStreamProcessorPtr streamProcessor, const TString& endpoint); + ~TReaderImpl(); + bool IsFinished() const; + TAsyncScanQueryPart ReadNext(std::shared_ptr<TSelf> self); + +private: + TStreamProcessorPtr StreamProcessor_; + TResponse Response_; + bool Finished_; + TString Endpoint_; +}; + + +} +} |