aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/public/lib/yq/yq.cpp
blob: 71d01eb74cae4eea38a8e8a373e1cb8d130f87e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
#include "yq.h"

#define INCLUDE_YDB_INTERNAL_H
#include <ydb/public/sdk/cpp/client/impl/ydb_internal/make_request/make.h> 
#undef INCLUDE_YDB_INTERNAL_H

#include <ydb/public/sdk/cpp/client/ydb_common_client/impl/client.h> 

namespace NYdb::NYq {

using namespace NYdb;

class TClient::TImpl : public TClientImplCommon<TClient::TImpl> {
public:
    TImpl(std::shared_ptr<TGRpcConnectionsImpl>&& connections, const TCommonClientSettings& settings)
        : TClientImplCommon(std::move(connections), settings) {}

    template<class TProtoResult, class TResultWrapper>
    auto MakeResultExtractor(NThreading::TPromise<TResultWrapper> promise) {
        return [promise = std::move(promise)]
            (google::protobuf::Any* any, TPlainStatus status) mutable {
                std::unique_ptr<TProtoResult> result;
                if (any) {
                    result.reset(new TProtoResult);
                    any->UnpackTo(result.get());
                }

                promise.SetValue(
                    TResultWrapper(
                        TStatus(std::move(status)),
                        std::move(result)));
            };
    }

    TAsyncCreateQueryResult CreateQuery(
        const YandexQuery::CreateQueryRequest& protoRequest,
        const TCreateQuerySettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::CreateQueryRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TCreateQueryResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::CreateQueryResult,
            TCreateQueryResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::CreateQueryRequest,
            YandexQuery::CreateQueryResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateQuery,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncListQueriesResult ListQueries(
        const YandexQuery::ListQueriesRequest& protoRequest,
        const TListQueriesSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ListQueriesRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TListQueriesResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ListQueriesResult,
            TListQueriesResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ListQueriesRequest,
            YandexQuery::ListQueriesResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncListQueries,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDescribeQueryResult DescribeQuery(
        const YandexQuery::DescribeQueryRequest& protoRequest,
        const TDescribeQuerySettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DescribeQueryRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDescribeQueryResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DescribeQueryResult,
            TDescribeQueryResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DescribeQueryRequest,
            YandexQuery::DescribeQueryResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeQuery,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncGetQueryStatusResult GetQueryStatus(
        const YandexQuery::GetQueryStatusRequest& protoRequest,
        const TGetQueryStatusSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::GetQueryStatusRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TGetQueryStatusResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::GetQueryStatusResult,
            TGetQueryStatusResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::GetQueryStatusRequest,
            YandexQuery::GetQueryStatusResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncGetQueryStatus,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncModifyQueryResult ModifyQuery(
        const YandexQuery::ModifyQueryRequest& protoRequest,
        const TModifyQuerySettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ModifyQueryRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TModifyQueryResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ModifyQueryResult,
            TModifyQueryResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ModifyQueryRequest,
            YandexQuery::ModifyQueryResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyQuery,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDeleteQueryResult DeleteQuery(
        const YandexQuery::DeleteQueryRequest& protoRequest,
        const TDeleteQuerySettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DeleteQueryRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDeleteQueryResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DeleteQueryResult,
            TDeleteQueryResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DeleteQueryRequest,
            YandexQuery::DeleteQueryResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteQuery,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncControlQueryResult ControlQuery(
        const YandexQuery::ControlQueryRequest& protoRequest,
        const TControlQuerySettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ControlQueryRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TControlQueryResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ControlQueryResult,
            TControlQueryResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ControlQueryRequest,
            YandexQuery::ControlQueryResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncControlQuery,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncGetResultDataResult GetResultData(
        const YandexQuery::GetResultDataRequest& protoRequest,
        const TGetResultDataSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::GetResultDataRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TGetResultDataResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::GetResultDataResult,
            TGetResultDataResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::GetResultDataRequest,
            YandexQuery::GetResultDataResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncGetResultData,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncListJobsResult ListJobs(
        const YandexQuery::ListJobsRequest& protoRequest,
        const TListJobsSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ListJobsRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TListJobsResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ListJobsResult,
            TListJobsResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ListJobsRequest,
            YandexQuery::ListJobsResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncListJobs,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDescribeJobResult DescribeJob(
        const YandexQuery::DescribeJobRequest& protoRequest,
        const TDescribeJobSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DescribeJobRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDescribeJobResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DescribeJobResult,
            TDescribeJobResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DescribeJobRequest,
            YandexQuery::DescribeJobResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeJob,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncCreateConnectionResult CreateConnection(
        const YandexQuery::CreateConnectionRequest& protoRequest,
        const TCreateConnectionSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::CreateConnectionRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TCreateConnectionResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::CreateConnectionResult,
            TCreateConnectionResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::CreateConnectionRequest,
            YandexQuery::CreateConnectionResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateConnection,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncListConnectionsResult ListConnections(
        const YandexQuery::ListConnectionsRequest& protoRequest,
        const TListConnectionsSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ListConnectionsRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TListConnectionsResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ListConnectionsResult,
            TListConnectionsResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ListConnectionsRequest,
            YandexQuery::ListConnectionsResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncListConnections,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDescribeConnectionResult DescribeConnection(
        const YandexQuery::DescribeConnectionRequest& protoRequest,
        const TDescribeConnectionSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DescribeConnectionRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDescribeConnectionResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DescribeConnectionResult,
            TDescribeConnectionResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DescribeConnectionRequest,
            YandexQuery::DescribeConnectionResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeConnection,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncModifyConnectionResult ModifyConnection(
        const YandexQuery::ModifyConnectionRequest& protoRequest,
        const TModifyConnectionSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ModifyConnectionRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TModifyConnectionResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ModifyConnectionResult,
            TModifyConnectionResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ModifyConnectionRequest,
            YandexQuery::ModifyConnectionResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyConnection,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDeleteConnectionResult DeleteConnection(
        const YandexQuery::DeleteConnectionRequest& protoRequest,
        const TDeleteConnectionSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DeleteConnectionRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDeleteConnectionResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DeleteConnectionResult,
            TDeleteConnectionResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DeleteConnectionRequest,
            YandexQuery::DeleteConnectionResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteConnection,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncTestConnectionResult TestConnection( 
        const YandexQuery::TestConnectionRequest& protoRequest, 
        const TTestConnectionSettings& settings) { 
        auto request = MakeOperationRequest<YandexQuery::TestConnectionRequest>(settings); 
        request = protoRequest; 
 
        auto promise = NThreading::NewPromise<TTestConnectionResult>(); 
        auto future = promise.GetFuture(); 
 
        auto extractor = MakeResultExtractor< 
            YandexQuery::TestConnectionResult, 
            TTestConnectionResult>(std::move(promise)); 
 
        Connections_->RunDeferred< 
            YandexQuery::V1::YandexQueryService, 
            YandexQuery::TestConnectionRequest, 
            YandexQuery::TestConnectionResponse>( 
                    std::move(request), 
                    std::move(extractor), 
                    &YandexQuery::V1::YandexQueryService::Stub::AsyncTestConnection, 
                    DbDriverState_, 
                    INITIAL_DEFERRED_CALL_DELAY, 
                    TRpcRequestSettings::Make(settings), 
                    settings.ClientTimeout_); 
 
        return future; 
    } 
 
    TAsyncCreateBindingResult CreateBinding(
        const YandexQuery::CreateBindingRequest& protoRequest,
        const TCreateBindingSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::CreateBindingRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TCreateBindingResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::CreateBindingResult,
            TCreateBindingResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::CreateBindingRequest,
            YandexQuery::CreateBindingResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncCreateBinding,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncListBindingsResult ListBindings(
        const YandexQuery::ListBindingsRequest& protoRequest,
        const TListBindingsSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ListBindingsRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TListBindingsResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ListBindingsResult,
            TListBindingsResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ListBindingsRequest,
            YandexQuery::ListBindingsResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncListBindings,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDescribeBindingResult DescribeBinding(
        const YandexQuery::DescribeBindingRequest& protoRequest,
        const TDescribeBindingSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DescribeBindingRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDescribeBindingResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DescribeBindingResult,
            TDescribeBindingResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DescribeBindingRequest,
            YandexQuery::DescribeBindingResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDescribeBinding,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncModifyBindingResult ModifyBinding(
        const YandexQuery::ModifyBindingRequest& protoRequest,
        const TModifyBindingSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::ModifyBindingRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TModifyBindingResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::ModifyBindingResult,
            TModifyBindingResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::ModifyBindingRequest,
            YandexQuery::ModifyBindingResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncModifyBinding,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }

    TAsyncDeleteBindingResult DeleteBinding(
        const YandexQuery::DeleteBindingRequest& protoRequest,
        const TDeleteBindingSettings& settings) {
        auto request = MakeOperationRequest<YandexQuery::DeleteBindingRequest>(settings);
        request = protoRequest;

        auto promise = NThreading::NewPromise<TDeleteBindingResult>();
        auto future = promise.GetFuture();

        auto extractor = MakeResultExtractor<
            YandexQuery::DeleteBindingResult,
            TDeleteBindingResult>(std::move(promise));

        Connections_->RunDeferred<
            YandexQuery::V1::YandexQueryService,
            YandexQuery::DeleteBindingRequest,
            YandexQuery::DeleteBindingResponse>(
                std::move(request),
                std::move(extractor),
                &YandexQuery::V1::YandexQueryService::Stub::AsyncDeleteBinding,
                DbDriverState_,
                INITIAL_DEFERRED_CALL_DELAY,
                TRpcRequestSettings::Make(settings),
                settings.ClientTimeout_);

        return future;
    }
};

TClient::TClient(const TDriver& driver, const TCommonClientSettings& settings)
    : Impl_(new TImpl(CreateInternalInterface(driver), settings))
{}

TAsyncCreateQueryResult TClient::CreateQuery(
    const YandexQuery::CreateQueryRequest& request,
    const TCreateQuerySettings& settings) {
    return Impl_->CreateQuery(request, settings);
}

TAsyncListQueriesResult TClient::ListQueries(
    const YandexQuery::ListQueriesRequest& request,
    const TListQueriesSettings& settings) {
    return Impl_->ListQueries(request, settings);
}

TAsyncDescribeQueryResult TClient::DescribeQuery(
    const YandexQuery::DescribeQueryRequest& request,
    const TDescribeQuerySettings& settings) {
    return Impl_->DescribeQuery(request, settings);
}

TAsyncGetQueryStatusResult TClient::GetQueryStatus(
    const YandexQuery::GetQueryStatusRequest& request,
    const TGetQueryStatusSettings& settings) {
    return Impl_->GetQueryStatus(request, settings);
}

TAsyncModifyQueryResult TClient::ModifyQuery(
    const YandexQuery::ModifyQueryRequest& request,
    const TModifyQuerySettings& settings) {
    return Impl_->ModifyQuery(request, settings);
}

TAsyncDeleteQueryResult TClient::DeleteQuery(
    const YandexQuery::DeleteQueryRequest& request,
    const TDeleteQuerySettings& settings) {
    return Impl_->DeleteQuery(request, settings);
}

TAsyncControlQueryResult TClient::ControlQuery(
    const YandexQuery::ControlQueryRequest& request,
    const TControlQuerySettings& settings) {
    return Impl_->ControlQuery(request, settings);
}

TAsyncGetResultDataResult TClient::GetResultData(
    const YandexQuery::GetResultDataRequest& request,
    const TGetResultDataSettings& settings) {
    return Impl_->GetResultData(request, settings);
}

TAsyncListJobsResult TClient::ListJobs(
    const YandexQuery::ListJobsRequest& request,
    const TListJobsSettings& settings) {
    return Impl_->ListJobs(request, settings);
}

TAsyncDescribeJobResult TClient::DescribeJob(
    const YandexQuery::DescribeJobRequest& request,
    const TDescribeJobSettings& settings) {
    return Impl_->DescribeJob(request, settings);
}

TAsyncCreateConnectionResult TClient::CreateConnection(
    const YandexQuery::CreateConnectionRequest& request,
    const TCreateConnectionSettings& settings) {
    return Impl_->CreateConnection(request, settings);
}

TAsyncListConnectionsResult TClient::ListConnections(
    const YandexQuery::ListConnectionsRequest& request,
    const TListConnectionsSettings& settings) {
    return Impl_->ListConnections(request, settings);
}

TAsyncDescribeConnectionResult TClient::DescribeConnection(
    const YandexQuery::DescribeConnectionRequest& request,
    const TDescribeConnectionSettings& settings) {
    return Impl_->DescribeConnection(request, settings);
}

TAsyncModifyConnectionResult TClient::ModifyConnection(
    const YandexQuery::ModifyConnectionRequest& request,
    const TModifyConnectionSettings& settings) {
    return Impl_->ModifyConnection(request, settings);
}

TAsyncDeleteConnectionResult TClient::DeleteConnection(
    const YandexQuery::DeleteConnectionRequest& request,
    const TDeleteConnectionSettings& settings) {
    return Impl_->DeleteConnection(request, settings);
}

TAsyncTestConnectionResult TClient::TestConnection( 
    const YandexQuery::TestConnectionRequest& request, 
    const TTestConnectionSettings& settings) { 
    return Impl_->TestConnection(request, settings); 
} 
 
TAsyncCreateBindingResult TClient::CreateBinding(
    const YandexQuery::CreateBindingRequest& request,
    const TCreateBindingSettings& settings) {
    return Impl_->CreateBinding(request, settings);
}

TAsyncListBindingsResult TClient::ListBindings(
    const YandexQuery::ListBindingsRequest& request,
    const TListBindingsSettings& settings) {
    return Impl_->ListBindings(request, settings);
}

TAsyncDescribeBindingResult TClient::DescribeBinding(
    const YandexQuery::DescribeBindingRequest& request,
    const TDescribeBindingSettings& settings) {
    return Impl_->DescribeBinding(request, settings);
}

TAsyncModifyBindingResult TClient::ModifyBinding(
    const YandexQuery::ModifyBindingRequest& request,
    const TModifyBindingSettings& settings) {
    return Impl_->ModifyBinding(request, settings);
}

TAsyncDeleteBindingResult TClient::DeleteBinding(
    const YandexQuery::DeleteBindingRequest& request,
    const TDeleteBindingSettings& settings) {
    return Impl_->DeleteBinding(request, settings);
}

}