aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/client_method_options.h
blob: b5f0f1e34e29a00e7e5d4ddc42fb498f9384b76e (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
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
#pragma once

///
/// @file yt/cpp/mapreduce/interface/client_method_options.h
///
/// Header containing options for @ref NYT::IClient methods.

#include "common.h"
#include "config.h"
#include "format.h"
#include "public.h"
#include "retry_policy.h"

#include <util/datetime/base.h>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

/// Type of the cypress node.
enum ENodeType : int
{
    NT_STRING               /* "string_node" */,
    NT_INT64                /* "int64_node" */,
    NT_UINT64               /* "uint64_node" */,
    NT_DOUBLE               /* "double_node" */,
    NT_BOOLEAN              /* "boolean_node" */,
    NT_MAP                  /* "map_node" */,
    NT_LIST                 /* "list_node" */,
    NT_FILE                 /* "file" */,
    NT_TABLE                /* "table" */,
    NT_DOCUMENT             /* "document" */,
    NT_REPLICATED_TABLE     /* "replicated_table" */,
    NT_TABLE_REPLICA        /* "table_replica" */,
    NT_USER                 /* "user" */,
    NT_SCHEDULER_POOL       /* "scheduler_pool" */,
    NT_LINK                 /* "link" */,
    NT_GROUP                /* "group" */,
    NT_PORTAL               /* "portal_entrance" */,
};

///
/// @brief Mode of composite type representation in yson.
///
/// @see https://ytsaurus.tech/docs/en/user-guide/storage/data-types#yson
enum class EComplexTypeMode : int
{
    Named /* "named" */,
    Positional /* "positional" */,
};

///
/// @brief Options for @ref NYT::ICypressClient::Create
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#create
struct TCreateOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TCreateOptions;
    /// @endcond

    /// Create missing parent directories if required.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    ///
    /// @brief Do not raise error if node already exists.
    ///
    /// Node is not recreated.
    /// Force and IgnoreExisting MUST NOT be used simultaneously.
    FLUENT_FIELD_DEFAULT(bool, IgnoreExisting, false);

    ///
    /// @brief Recreate node if it exists.
    ///
    /// Force and IgnoreExisting MUST NOT be used simultaneously.
    FLUENT_FIELD_DEFAULT(bool, Force, false);

    /// @brief Set node attributes.
    FLUENT_FIELD_OPTION(TNode, Attributes);
};

///
/// @brief Options for @ref NYT::ICypressClient::Remove
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#remove
struct TRemoveOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TRemoveOptions;
    /// @endcond

    ///
    /// @brief Remove whole tree when removing composite cypress node (e.g. `map_node`).
    ///
    /// Without this option removing nonempty composite node will fail.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    /// @brief Do not fail if removing node doesn't exist.
    FLUENT_FIELD_DEFAULT(bool, Force, false);
};

/// Base class for options for operations that read from master.
template <typename TDerived>
struct TMasterReadOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TDerived;
    /// @endcond

    /// @brief Where to read from.
    FLUENT_FIELD_OPTION(EMasterReadKind, ReadFrom);
};

///
/// @brief Options for @ref NYT::ICypressClient::Exists
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#exists
struct TExistsOptions
    : public TMasterReadOptions<TExistsOptions>
{
};

///
/// @brief Options for @ref NYT::ICypressClient::Get
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#get
struct TGetOptions
    : public TMasterReadOptions<TGetOptions>
{
    /// @brief Attributes that should be fetched with each node.
    FLUENT_FIELD_OPTION(TAttributeFilter, AttributeFilter);

    /// @brief Limit for the number of children node.
    FLUENT_FIELD_OPTION(i64, MaxSize);
};

///
/// @brief Options for @ref NYT::ICypressClient::Set
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#set
struct TSetOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TSetOptions;
    /// @endcond

    /// Create missing parent directories if required.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    /// Allow setting any nodes, not only attribute and document ones.
    FLUENT_FIELD_OPTION(bool, Force);
};

///
/// @brief Options for @ref NYT::ICypressClient::MultisetAttributes
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#multiset_attributes
struct TMultisetAttributesOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TMultisetAttributesOptions;
    /// @endcond

    FLUENT_FIELD_OPTION(bool, Force);
};

///
/// @brief Options for @ref NYT::ICypressClient::List
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#list
struct TListOptions
    : public TMasterReadOptions<TListOptions>
{
    /// @cond Doxygen_Suppress
    using TSelf = TListOptions;
    /// @endcond

    /// Attributes that should be fetched for each node.
    FLUENT_FIELD_OPTION(TAttributeFilter, AttributeFilter);

    /// Limit for the number of children that will be fetched.
    FLUENT_FIELD_OPTION(i64, MaxSize);
};

///
/// @brief Options for @ref NYT::ICypressClient::Copy
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#copy
struct TCopyOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TCopyOptions;
    /// @endcond

    /// Create missing directories in destination path if required.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    /// Allows to use existing node as destination, it will be overwritten.
    FLUENT_FIELD_DEFAULT(bool, Force, false);

    /// Whether to preserves account of source node.
    FLUENT_FIELD_DEFAULT(bool, PreserveAccount, false);

    /// Whether to preserve `expiration_time` attribute of source node.
    FLUENT_FIELD_OPTION(bool, PreserveExpirationTime);
};

///
/// @brief Options for @ref NYT::ICypressClient::Move
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#move
struct TMoveOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TMoveOptions;
    /// @endcond

    /// Create missing directories in destination path if required.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    /// Allows to use existing node as destination, it will be overwritten.
    FLUENT_FIELD_DEFAULT(bool, Force, false);

    /// Whether to preserves account of source node.
    FLUENT_FIELD_DEFAULT(bool, PreserveAccount, false);

    /// Whether to preserve `expiration_time` attribute of source node.
    FLUENT_FIELD_OPTION(bool, PreserveExpirationTime);
};

///
/// @brief Options for @ref NYT::ICypressClient::Link
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#link
struct TLinkOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TLinkOptions;
    /// @endcond

    /// Create parent directories of destination if they don't exist.
    FLUENT_FIELD_DEFAULT(bool, Recursive, false);

    /// Do not raise error if link already exists.
    FLUENT_FIELD_DEFAULT(bool, IgnoreExisting, false);

    /// Force rewrite target node.
    FLUENT_FIELD_DEFAULT(bool, Force, false);

    /// Attributes of created link.
    FLUENT_FIELD_OPTION(TNode, Attributes);
};

///
/// @brief Options for @ref NYT::ICypressClient::Concatenate
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#concatenate
struct TConcatenateOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TConcatenateOptions;
    /// @endcond

    /// Whether we should append to destination or rewrite it.
    FLUENT_FIELD_OPTION(bool, Append);
};

///
/// @brief Options for @ref NYT::IIOClient::CreateBlobTableReader
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#read_blob_table
struct TBlobTableReaderOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TBlobTableReaderOptions;
    /// @endcond

    /// Name of the part index column. By default it is "part_index".
    FLUENT_FIELD_OPTION(TString, PartIndexColumnName);

    /// Name of the data column. By default it is "data".
    FLUENT_FIELD_OPTION(TString, DataColumnName);

    ///
    /// @brief Size of each part.
    ///
    /// All blob parts except the last part of the blob must be of this size
    /// otherwise blob table reader emits error.
    FLUENT_FIELD_DEFAULT(ui64, PartSize, 4 * 1024 * 1024);

    /// @brief Offset from which to start reading
    FLUENT_FIELD_DEFAULT(i64, Offset, 0);
};

///
/// @brief Resource limits for operation (or pool)
///
/// @see https://ytsaurus.tech/docs/en/user-guide/data-processing/scheduler/scheduler-and-pools#resursy
/// @see NYT::TUpdateOperationParametersOptions
struct TResourceLimits
{
    /// @cond Doxygen_Suppress
    using TSelf = TResourceLimits;
    /// @endcond

    /// Number of slots for user jobs.
    FLUENT_FIELD_OPTION(i64, UserSlots);

    /// Number of cpu cores.
    FLUENT_FIELD_OPTION(double, Cpu);

    /// Network usage. Doesn't have precise physical unit.
    FLUENT_FIELD_OPTION(i64, Network);

    /// Memory in bytes.
    FLUENT_FIELD_OPTION(i64, Memory);
};

///
/// @brief Scheduling options for single pool tree.
///
/// @see NYT::TUpdateOperationParametersOptions
struct TSchedulingOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TSchedulingOptions;
    /// @endcond

    ///
    /// @brief Pool to switch operation to.
    ///
    /// @note Switching is currently disabled on the server (will induce an exception).
    FLUENT_FIELD_OPTION(TString, Pool);

    /// @brief Operation weight.
    FLUENT_FIELD_OPTION(double, Weight);

    /// @brief Operation resource limits.
    FLUENT_FIELD_OPTION(TResourceLimits, ResourceLimits);
};

///
/// @brief Collection of scheduling options for multiple pool trees.
///
/// @see NYT::TUpdateOperationParametersOptions
struct TSchedulingOptionsPerPoolTree
{
    /// @cond Doxygen_Suppress
    using TSelf = TSchedulingOptionsPerPoolTree;
    /// @endcond

    TSchedulingOptionsPerPoolTree(const THashMap<TString, TSchedulingOptions>& options = {})
        : Options_(options)
    { }

    /// Add scheduling options for pool tree.
    TSelf& Add(TStringBuf poolTreeName, const TSchedulingOptions& schedulingOptions)
    {
        Y_ENSURE(Options_.emplace(poolTreeName, schedulingOptions).second);
        return *this;
    }

    THashMap<TString, TSchedulingOptions> Options_;
};

///
/// @brief Options for @ref NYT::IOperation::SuspendOperation
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#suspend_operation
struct TSuspendOperationOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TSuspendOperationOptions;
    /// @endcond

    ///
    /// @brief Whether to abort already running jobs.
    ///
    /// By default running jobs are not aborted.
    FLUENT_FIELD_OPTION(bool, AbortRunningJobs);
};

///
/// @brief Options for @ref NYT::IOperation::ResumeOperation
///
/// @note They are empty for now but options might appear in the future.
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#resume_operation
struct TResumeOperationOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TResumeOperationOptions;
    /// @endcond
};

///
/// @brief Options for @ref NYT::IOperation::UpdateParameters
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#update_operation_parameters
struct TUpdateOperationParametersOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TUpdateOperationParametersOptions;
    /// @endcond

    /// New owners of the operation.
    FLUENT_VECTOR_FIELD(TString, Owner);

    /// Pool to switch operation to (for all pool trees it is running in).
    FLUENT_FIELD_OPTION(TString, Pool);

    /// New operation weight (for all pool trees it is running in).
    FLUENT_FIELD_OPTION(double, Weight);

    /// Scheduling options for each pool tree the operation is running in.
    FLUENT_FIELD_OPTION(TSchedulingOptionsPerPoolTree, SchedulingOptionsPerPoolTree);
};

///
/// @brief Base class for many options related to IO.
///
/// @ref NYT::TFileWriterOptions
/// @ref NYT::TFileReaderOptions
/// @ref NYT::TTableReaderOptions
/// @ref NYT::TTableWriterOptions
template <class TDerived>
struct TIOOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TDerived;
    /// @endcond

    ///
    /// @brief Advanced options for reader/writer.
    ///
    /// Readers/writers have many options not of all of them are supported by library.
    /// If you need such unsupported option, you might use `Config` option until
    /// option is supported.
    ///
    /// Example:
    ///
    ///     TTableWriterOptions().Config(TNode()("max_row_weight", 64 << 20)))
    ///
    /// @note We encourage you to ask yt@ to add native C++ support of required options
    /// and use `Config` only as temporary solution while native support is not ready.
    FLUENT_FIELD_OPTION(TNode, Config);

    ///
    /// @brief Whether to create internal client transaction for reading / writing table.
    ///
    /// This is advanced option.
    ///
    /// If `CreateTransaction` is set to `false`  reader/writer doesn't create internal transaction
    /// and doesn't lock table. This option is overridden (effectively `false`) for writers by
    /// @ref NYT::TTableWriterOptions::SingleHttpRequest
    ///
    /// WARNING: if `CreateTransaction` is `false`, read/write might become non-atomic.
    /// Change ONLY if you are sure what you are doing!
    FLUENT_FIELD_DEFAULT(bool, CreateTransaction, true);
};

/// @brief Options for reading file from YT.
struct TFileReaderOptions
    : public TIOOptions<TFileReaderOptions>
{
    ///
    /// @brief Offset to start reading from.
    ///
    /// By default reading is started from the beginning of the file.
    FLUENT_FIELD_OPTION(i64, Offset);

    ///
    /// @brief Maximum length to read.
    ///
    /// By default file is read until the end.
    FLUENT_FIELD_OPTION(i64, Length);
};

/// @brief Options that control how server side of YT stores data.
struct TWriterOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TWriterOptions;
    /// @endcond

    ///
    /// @brief Whether to wait all replicas to be written.
    ///
    /// When set to true upload will be considered successful as soon as
    /// @ref NYT::TWriterOptions::MinUploadReplicationFactor number of replicas are created.
    FLUENT_FIELD_OPTION(bool, EnableEarlyFinish);

    /// Number of replicas to be created.
    FLUENT_FIELD_OPTION(ui64, UploadReplicationFactor);

    ///
    /// Min number of created replicas needed to consider upload successful.
    ///
    /// @see NYT::TWriterOptions::EnableEarlyFinish
    FLUENT_FIELD_OPTION(ui64, MinUploadReplicationFactor);

    ///
    /// @brief Desired size of a chunk.
    ///
    /// @see @ref NYT::TWriterOptions::RetryBlockSize
    FLUENT_FIELD_OPTION(ui64, DesiredChunkSize);

    ///
    /// @brief Size of data block accumulated in memory to provide retries.
    ///
    /// Data is accumulated in memory buffer so in case error occurs data could be resended.
    ///
    /// If `RetryBlockSize` is not set buffer size is set to `DesiredChunkSize`.
    /// If neither `RetryBlockSize` nor `DesiredChunkSize` is set size of buffer is 64MB.
    ///
    /// @note Written chunks cannot be larger than size of this memory buffer.
    ///
    /// Since DesiredChunkSize is compared against data already compressed with compression codec
    /// it makes sense to set `RetryBlockSize = DesiredChunkSize / ExpectedCompressionRatio`
    ///
    /// @see @ref NYT::TWriterOptions::DesiredChunkSize
    /// @see @ref NYT::TTableWriterOptions::SingleHttpRequest
    FLUENT_FIELD_OPTION(size_t, RetryBlockSize);
};

///
/// @brief Options for writing file
///
/// @see NYT::IIOClient::CreateFileWriter
struct TFileWriterOptions
    : public TIOOptions<TFileWriterOptions>
{
    ///
    /// @brief Whether to compute MD5 sum of written file.
    ///
    /// If ComputeMD5 is set to `true` and we are appending to an existing file
    /// the `md5` attribute must be set (i.e. it was previously written only with `ComputeMD5 == true`).
    FLUENT_FIELD_OPTION(bool, ComputeMD5);

    ///
    /// @brief Options to control how YT server side writes data.
    ///
    /// @see NYT::TWriterOptions
    FLUENT_FIELD_OPTION(TWriterOptions, WriterOptions);
};

class TSkiffRowHints {
public:
    /// @cond Doxygen_Suppress
    using TSelf = TSkiffRowHints;
    /// @endcond

    ///
    /// @brief Library doesn't interpret it, only pass it to CreateSkiffParser<...>() and GetSkiffSchema<...>() functions.
    ///
    /// You can set something in it to pass necessary information to CreateSkiffParser<...>() and GetSkiffSchema<...>() functions.
    FLUENT_FIELD_OPTION(TNode, Attributes);
};

/// Options that control how C++ objects represent table rows when reading or writing a table.
class TFormatHints
{
public:
    /// @cond Doxygen_Suppress
    using TSelf = TFormatHints;
    /// @endcond

    ///
    /// @brief Whether to skip null values.
    ///
    /// When set to true TNode doesn't contain null column values
    /// (e.g. corresponding keys will be missing instead of containing null value).
    ///
    /// Only meaningful for TNode representation.
    ///
    /// Useful for sparse tables which have many columns in schema
    /// but only few columns are set in any row.
    FLUENT_FIELD_DEFAULT(bool, SkipNullValuesForTNode, false);

    ///
    /// @brief Whether to convert string to numeric and boolean types (e.g. "42u" -> 42u, "false" -> %false)
    /// when writing to schemaful table.
    FLUENT_FIELD_OPTION(bool, EnableStringToAllConversion);

    ///
    /// @brief Whether to convert numeric and boolean types to string (e.g., 3.14 -> "3.14", %true -> "true")
    /// when writing to schemaful table.
    FLUENT_FIELD_OPTION(bool, EnableAllToStringConversion);

    ///
    /// @brief Whether to convert uint64 <-> int64 when writing to schemaful table.
    ///
    /// On overflow the corresponding error with be raised.
    ///
    /// This options is enabled by default.
    FLUENT_FIELD_OPTION(bool, EnableIntegralTypeConversion);

    /// Whether to convert uint64 and int64 to double (e.g. 42 -> 42.0) when writing to schemaful table.
    FLUENT_FIELD_OPTION(bool, EnableIntegralToDoubleConversion);

    /// Shortcut for enabling all type conversions.
    FLUENT_FIELD_OPTION(bool, EnableTypeConversion);

    ///
    /// @brief Controls how complex types are represented in TNode or yson-strings.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/storage/data-types#yson
    FLUENT_FIELD_OPTION(EComplexTypeMode, ComplexTypeMode);

    ///
    /// @brief Allow to use any meta-information for creating skiff schema and parser for reading ISkiffRow.
    FLUENT_FIELD_OPTION(TSkiffRowHints, SkiffRowHints);

    ///
    /// @brief Apply the patch to the fields.
    ///
    /// Non-default and non-empty values replace the default and empty ones.
    void Merge(const TFormatHints& patch);
};

/// Options that control which control attributes (like row_index) are added to rows during read.
class TControlAttributes
{
public:
    /// @cond Doxygen_Suppress
    using TSelf = TControlAttributes;
    /// @endcond

    ///
    /// @brief Whether to add "row_index" attribute to rows read.
    FLUENT_FIELD_DEFAULT(bool, EnableRowIndex, true);

    ///
    /// @brief Whether to add "range_index" attribute to rows read.
    FLUENT_FIELD_DEFAULT(bool, EnableRangeIndex, true);
};

/// Options for @ref NYT::IClient::CreateTableReader
struct TTableReaderOptions
    : public TIOOptions<TTableReaderOptions>
{
    /// @deprecated Size of internal client buffer.
    FLUENT_FIELD_DEFAULT(size_t, SizeLimit, 4 << 20);

    ///
    /// @brief Allows to fine tune format that is used for reading tables.
    ///
    /// Has no effect when used with raw-reader.
    FLUENT_FIELD_OPTION(TFormatHints, FormatHints);

    ///
    /// @brief Allows to tune which attributes are added to rows while reading tables.
    ///
    FLUENT_FIELD_DEFAULT(TControlAttributes, ControlAttributes, TControlAttributes());
};

/// Options for @ref NYT::IClient::CreateTableWriter
struct TTableWriterOptions
    : public TIOOptions<TTableWriterOptions>
{
    ///
    /// @brief Enable or disable retryful writing.
    ///
    /// If set to true no retry is made but we also make less requests to master.
    /// If set to false writer can make up to `TConfig::RetryCount` attempts to send each block of data.
    ///
    /// @note Writers' methods might throw strange exceptions that might look like network error
    /// when `SingleHttpRequest == true` and YT node encounters an error
    /// (due to limitations of HTTP protocol YT node have no chance to report error
    /// before it reads the whole input so it just drops the connection).
    FLUENT_FIELD_DEFAULT(bool, SingleHttpRequest, false);

    ///
    /// @brief Allows to change the size of locally buffered rows before flushing to yt.
    ///
    /// Used only with @ref NYT::TTableWriterOptions::SingleHttpRequest
    FLUENT_FIELD_DEFAULT(size_t, BufferSize, 64 << 20);

    ///
    /// @brief Allows to fine tune format that is used for writing tables.
    ///
    /// Has no effect when used with raw-writer.
    FLUENT_FIELD_OPTION(TFormatHints, FormatHints);

    /// @brief Try to infer schema of inexistent table from the type of written rows.
    ///
    /// @note Default values for this option may differ depending on the row type.
    /// For protobuf it's currently false by default.
    FLUENT_FIELD_OPTION(bool, InferSchema);

    ///
    /// @brief Options to control how YT server side writes data.
    ///
    /// @see NYT::TWriterOptions
    FLUENT_FIELD_OPTION(TWriterOptions, WriterOptions);
};

///
/// @brief Options for @ref NYT::IClient::StartTransaction
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#start_tx
struct TStartTransactionOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TStartTransactionOptions;
    /// @endcond

    FLUENT_FIELD_DEFAULT(bool, PingAncestors, false);

    ///
    /// @brief How long transaction lives after last ping.
    ///
    /// If server doesn't receive any pings for transaction for this time
    /// transaction will be aborted. By default timeout is 15 seconds.
    FLUENT_FIELD_OPTION(TDuration, Timeout);

    ///
    /// @brief Moment in the future when transaction is aborted.
    FLUENT_FIELD_OPTION(TInstant, Deadline);

    ///
    /// @brief Whether to ping created transaction automatically.
    ///
    /// When set to true library creates a thread that pings transaction.
    /// When set to false library doesn't ping transaction and it's user responsibility to ping it.
    FLUENT_FIELD_DEFAULT(bool, AutoPingable, true);

    ///
    /// @brief Set the title attribute of transaction.
    ///
    /// If title was not specified
    /// neither using this option nor using @ref NYT::TStartTransactionOptions::Attributes option
    /// library will generate default title for transaction.
    /// Such default title includes machine name, pid, user name and some other useful info.
    FLUENT_FIELD_OPTION(TString, Title);

    ///
    /// @brief Set custom transaction attributes
    ///
    /// @note @ref NYT::TStartTransactionOptions::Title option overrides `"title"` attribute.
    FLUENT_FIELD_OPTION(TNode, Attributes);
};

///
/// @brief Options for attaching transaction.
///
/// @see NYT::IClient::AttachTransaction
struct TAttachTransactionOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TAttachTransactionOptions;
    /// @endcond

    ///
    /// @brief Ping transaction automatically.
    ///
    /// When set to |true| library creates a thread that pings transaction.
    /// When set to |false| library doesn't ping transaction and
    /// it's user responsibility to ping it.
    FLUENT_FIELD_DEFAULT(bool, AutoPingable, false);

    ///
    /// @brief Abort transaction on program termination.
    ///
    /// Should the transaction be aborted on program termination
    /// (either normal or by a signal or uncaught exception -- two latter
    /// only if @ref TInitializeOptions::CleanupOnTermination is set).
    FLUENT_FIELD_DEFAULT(bool, AbortOnTermination, false);
};

///
/// @brief Type of the lock.
///
/// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locking_mode
/// @see NYT::ITransaction::Lock
enum ELockMode : int
{
    /// Exclusive lock.
    LM_EXCLUSIVE    /* "exclusive" */,

    /// Shared lock.
    LM_SHARED       /* "shared" */,

    /// Snapshot lock.
    LM_SNAPSHOT     /* "snapshot" */,
};

///
/// @brief Options for locking cypress node
///
/// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locks
/// @see NYT::ITransaction::Lock
struct TLockOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TLockOptions;
    /// @endcond

    ///
    /// @brief Whether to wait already locked node to be unlocked.
    ///
    /// If `Waitable' is set to true Lock method will create
    /// waitable lock, that will be taken once other transactions
    /// that hold lock to that node are committed / aborted.
    ///
    /// @note Lock method DOES NOT wait until lock is actually acquired.
    /// Waiting should be done using corresponding methods of ILock.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locking_queue
    FLUENT_FIELD_DEFAULT(bool, Waitable, false);

    ///
    /// @brief Also take attribute_key lock.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locks_compatibility
    FLUENT_FIELD_OPTION(TString, AttributeKey);

    ///
    /// @brief Also take child_key lock.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locks_compatibility
    FLUENT_FIELD_OPTION(TString, ChildKey);
};

///
/// @brief Options for @ref NYT::ITransaction::Unlock
///
/// @note They are empty for now but options might appear in the future.
///
/// @see https://ytsaurus.tech/docs/en/user-guide/storage/transactions#locks_compatibility
struct TUnlockOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TUnlockOptions;
    /// @endcond
};

/// Base class for options that deal with tablets.
template <class TDerived>
struct TTabletOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TDerived;
    /// @endcond

    /// Index of a first tablet to deal with.
    FLUENT_FIELD_OPTION(i64, FirstTabletIndex);

    /// Index of a last tablet to deal with.
    FLUENT_FIELD_OPTION(i64, LastTabletIndex);
};

///
/// @brief Options for @ref NYT::IClient::MountTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#mount_table
struct TMountTableOptions
    : public TTabletOptions<TMountTableOptions>
{
    /// @cond Doxygen_Suppress
    using TSelf = TMountTableOptions;
    /// @endcond

    /// If specified table will be mounted to this cell.
    FLUENT_FIELD_OPTION(TTabletCellId, CellId);

    /// If set to true tablets will be mounted in freezed state.
    FLUENT_FIELD_DEFAULT(bool, Freeze, false);
};

///
/// @brief Options for @ref NYT::IClient::UnmountTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#unmount_table
struct TUnmountTableOptions
    : public TTabletOptions<TUnmountTableOptions>
{
    /// @cond Doxygen_Suppress
    using TSelf = TUnmountTableOptions;
    /// @endcond

    /// Advanced option, don't use unless yt team told you so.
    FLUENT_FIELD_DEFAULT(bool, Force, false);
};

///
/// @brief Options for @ref NYT::IClient::RemountTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#remount_table
struct TRemountTableOptions
    : public TTabletOptions<TRemountTableOptions>
{ };

///
/// @brief Options for @ref NYT::IClient::ReshardTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#reshard_table
struct TReshardTableOptions
    : public TTabletOptions<TReshardTableOptions>
{ };

///
/// @brief Options for @ref NYT::IClient::FreezeTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#freeze_table
struct TFreezeTableOptions
    : public TTabletOptions<TFreezeTableOptions>
{ };

///
/// @brief Options for @ref NYT::IClient::UnfreezeTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#unfreeze_table
struct TUnfreezeTableOptions
    : public TTabletOptions<TUnfreezeTableOptions>
{ };

///
/// @brief Options for @ref NYT::IClient::AlterTable
///
/// @see https://ytsaurus.tech/docs/en/api/commands#alter_table
struct TAlterTableOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TAlterTableOptions;
    /// @endcond

    /// Change table schema.
    FLUENT_FIELD_OPTION(TTableSchema, Schema);

    /// Alter table between static and dynamic mode.
    FLUENT_FIELD_OPTION(bool, Dynamic);

    ///
    /// @brief Changes id of upstream replica on metacluster.
    ///
    /// @see https://ytsaurus.tech/docs/en/description/dynamic_tables/replicated_dynamic_tables
    FLUENT_FIELD_OPTION(TReplicaId, UpstreamReplicaId);
};

///
/// @brief Options for @ref NYT::IClient::LookupRows
///
/// @see https://ytsaurus.tech/docs/en/api/commands#lookup_rows
struct TLookupRowsOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TLookupRowsOptions;
    /// @endcond

    /// Timeout for operation.
    FLUENT_FIELD_OPTION(TDuration, Timeout);

    /// Column names to return.
    FLUENT_FIELD_OPTION(TColumnNames, Columns);

    ///
    /// @brief Whether to return rows that were not found in table.
    ///
    /// If set to true List returned by LookupRows method will have same
    /// length as list of keys. If row is not found in table corresponding item in list
    /// will have null value.
    FLUENT_FIELD_DEFAULT(bool, KeepMissingRows, false);

    /// If set to true returned values will have "timestamp" attribute.
    FLUENT_FIELD_OPTION(bool, Versioned);
};

///
/// @brief Options for @ref NYT::IClient::SelectRows
///
/// @see https://ytsaurus.tech/docs/en/api/commands#select_rows
struct TSelectRowsOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TSelectRowsOptions;
    /// @endcond

    /// Timeout for operation.
    FLUENT_FIELD_OPTION(TDuration, Timeout);

    ///
    /// @brief Limitation for number of rows read by single node.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/dyn-query-language#query-complexity-limits-options
    FLUENT_FIELD_OPTION(i64, InputRowLimit);

    ///
    /// @brief Limitation for number of output rows on single cluster node.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/dyn-query-language#query-complexity-limits-options
    FLUENT_FIELD_OPTION(i64, OutputRowLimit);

    ///
    /// @brief Maximum row ranges derived from WHERE clause.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/dyn-query-language#query-complexity-limits-options
    FLUENT_FIELD_DEFAULT(ui64, RangeExpansionLimit, 1000);

    ///
    /// @brief Whether to fail if InputRowLimit or OutputRowLimit is exceeded.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/dyn-query-language#query-complexity-limits-options
    FLUENT_FIELD_DEFAULT(bool, FailOnIncompleteResult, true);

    /// @brief Enable verbose logging on server side.
    FLUENT_FIELD_DEFAULT(bool, VerboseLogging, false);

    FLUENT_FIELD_DEFAULT(bool, EnableCodeCache, true);
};

/// Options for NYT::CreateClient;
struct TCreateClientOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TCreateClientOptions;
    /// @endcond

    /// @brief Impersonated user name.
    ///
    /// If authenticated user is allowed to impersonate other YT users (e.g. yql_agent), this field may be used to override user name.
    FLUENT_FIELD_OPTION(TString, ImpersonationUser);

    /// @brief User token.
    ///
    /// @see NYT::TCreateClientOptions::TokenPath
    FLUENT_FIELD(TString, Token);

    /// @brief Path to the file where user token is stored.
    ///
    /// Token is looked in these places in following order:
    ///   - @ref NYT::TCreateClientOptions::Token
    ///   - @ref NYT::TCreateClientOptions::TokenPath
    ///   - `TConfig::Get()->Token` option.
    ///   - `YT_TOKEN` environment variable
    ///   - `YT_SECURE_VAULT_YT_TOKEN` environment variable
    ///   - File specified in `YT_TOKEN_PATH` environment variable
    ///   - `$HOME/.yt/token` file.
    FLUENT_FIELD(TString, TokenPath);

    /// @brief TVM service ticket producer.
    ///
    /// We store a wrapper of NYT::TIntrusivePtr here (not a NYT::TIntrusivePtr),
    /// because otherwise other projects will have build problems
    /// because of visibility of two different `TIntrusivePtr`-s (::TInstrusivePtr and NYT::TInstrusivePtr).
    ///
    /// @see NYT::NAuth::TServiceTicketClientAuth
    /// {@
    NAuth::IServiceTicketAuthPtrWrapperPtr ServiceTicketAuth_ = nullptr;
    TSelf& ServiceTicketAuth(const NAuth::IServiceTicketAuthPtrWrapper& wrapper);
    /// @}

    /// @brief Use tvm-only endpoints in cluster connection.
    FLUENT_FIELD_DEFAULT(bool, TvmOnly, false);

    /// @brief Use HTTPs (use HTTP client from yt/yt/core always).
    ///
    /// @see UseCoreHttpClient
    FLUENT_FIELD_OPTION(bool, UseTLS);

    /// @brief Use HTTP client from yt/yt/core.
    FLUENT_FIELD_DEFAULT(bool, UseCoreHttpClient, false);

    ///
    /// @brief RetryConfig provider allows to fine tune request retries.
    ///
    /// E.g. set total timeout for all retries.
    FLUENT_FIELD_DEFAULT(IRetryConfigProviderPtr, RetryConfigProvider, nullptr);

    /// @brief Override global config for the client.
    ///
    /// The config contains implementation parameters such as connection timeouts,
    /// access token, api version and more.
    /// @see NYT::TConfig
    FLUENT_FIELD_DEFAULT(TConfigPtr, Config, nullptr);

    /// @brief Proxy Address to be used for connection
    FLUENT_FIELD_OPTION(TString, ProxyAddress);
};

///
/// @brief Options for @ref NYT::IBatchRequest::ExecuteBatch
///
/// @see https://ytsaurus.tech/docs/en/api/commands#execute_batch
struct TExecuteBatchOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TExecuteBatchOptions;
    /// @endcond

    ///
    /// @brief How many requests will be executed in parallel on the cluster.
    ///
    /// This parameter could be used to avoid RequestLimitExceeded errors.
    FLUENT_FIELD_OPTION(ui64, Concurrency);

    ///
    /// @brief Maximum size of batch sent in one request to server.
    ///
    /// Huge batches are executed using multiple requests.
    /// BatchPartMaxSize is maximum size of single request that goes to server
    /// If not specified it is set to `Concurrency * 5'
    FLUENT_FIELD_OPTION(ui64, BatchPartMaxSize);
};

///
/// @brief Durability mode.
///
/// @see NYT::TTabletTransactionOptions::TDurability
/// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/sorted-dynamic-tables
enum class EDurability
{
    /// Sync mode (default).
    Sync    /* "sync" */,

    /// Async mode (might reduce latency of write requests, but less reliable).
    Async   /* "async" */,
};

///
/// @brief Atomicity mode.
///
/// @see NYT::TTabletTransactionOptions::TDurability
/// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/sorted-dynamic-tables
enum class EAtomicity
{
    /// Transactions are non atomic (might reduce latency of write requests).
    None    /* "none" */,

    /// Transactions are atomic (default).
    Full    /* "full" */,
};

///
/// @brief Table replica mode.
///
/// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/replicated-dynamic-tables#attributes
enum class ETableReplicaMode
{
    Sync    /* "sync" */,
    Async   /* "async" */,
};

/// Base class for options dealing with io to dynamic tables.
template <typename TDerived>
struct TTabletTransactionOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TDerived;
    /// @endcond

    ///
    /// @brief Atomicity mode of operation
    ///
    /// Setting to NYT::EAtomicity::None allows to improve latency of operations
    /// at the cost of weakening contracts.
    ///
    /// @note Use with care.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/sorted-dynamic-tables
    FLUENT_FIELD_OPTION(EAtomicity, Atomicity);

    ///
    /// @brief Durability mode of operation
    ///
    /// Setting to NYT::EDurability::Async allows to improve latency of operations
    /// at the cost of weakening contracts.
    ///
    /// @note Use with care.
    ///
    /// @see https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/sorted-dynamic-tables
    FLUENT_FIELD_OPTION(EDurability, Durability);
};

///
/// @brief Options for NYT::IClient::InsertRows
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#insert_rows
struct TInsertRowsOptions
    : public TTabletTransactionOptions<TInsertRowsOptions>
{
    ///
    /// @brief Whether to overwrite missing columns with nulls.
    ///
    /// By default all columns missing in input data are set to Null and overwrite currently stored value.
    /// If `Update' is set to true currently stored value will not be overwritten for columns that are missing in input data.
    FLUENT_FIELD_OPTION(bool, Update);

    ///
    /// @brief Whether to overwrite or aggregate aggregated columns.
    ///
    /// Used with aggregating columns.
    /// By default value in aggregating column will be overwritten.
    /// If `Aggregate' is set to true row will be considered as delta and it will be aggregated with currently stored value.
    FLUENT_FIELD_OPTION(bool, Aggregate);

    ///
    /// @brief Whether to fail when inserting to table without sync replica.
    ///
    /// Used for insert operation for tables without sync replica.
    /// https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/replicated-dynamic-tables#write
    /// Default value is 'false'. So insertion into table without sync replicas fails.
    FLUENT_FIELD_OPTION(bool, RequireSyncReplica);
};

///
/// @brief Options for NYT::IClient::DeleteRows
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#delete_rows
struct TDeleteRowsOptions
    : public TTabletTransactionOptions<TDeleteRowsOptions>
{
    ///
    /// @brief Whether to fail when deleting from table without sync replica.
    ///
    // Used for delete operation for tables without sync replica.
    /// https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/replicated-dynamic-tables#write
    // Default value is 'false'. So deletion into table without sync replicas fails.
    FLUENT_FIELD_OPTION(bool, RequireSyncReplica);
};

///
/// @brief Options for NYT::IClient::TrimRows
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#trim_rows
struct TTrimRowsOptions
    : public TTabletTransactionOptions<TTrimRowsOptions>
{ };

/// @brief Options for NYT::IClient::AlterTableReplica
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#alter_table_replica
/// https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/replicated-dynamic-tables
struct TAlterTableReplicaOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TAlterTableReplicaOptions;
    /// @endcond

    ///
    /// @brief Whether to enable or disable replica.
    ///
    /// Doesn't change state of replica if `Enabled' is not set.
    FLUENT_FIELD_OPTION(bool, Enabled);

    ///
    /// @brief Change replica mode.
    ///
    /// Doesn't change replica mode if `Mode` is not set.
    FLUENT_FIELD_OPTION(ETableReplicaMode, Mode);
};

///
/// @brief Options for @ref NYT::IClient::GetFileFromCache
///
/// @note They are empty for now but options might appear in the future.
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#get_file_from_cache
struct TGetFileFromCacheOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TGetFileFromCacheOptions;
    /// @endcond
};

///
/// @brief Options for @ref NYT::IClient::GetTableColumnarStatistics
///
/// @note They are empty for now but options might appear in the future.
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#put_file_to_cache
struct TPutFileToCacheOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TPutFileToCacheOptions;
    /// @endcond

    /// Whether to preserve `expiration_timeout` attribute of source node.
    FLUENT_FIELD_OPTION(bool, PreserveExpirationTimeout);
};

///
/// Type of permission used in ACL.
///
/// @see https://ytsaurus.tech/docs/en/user-guide/storage/access-control
enum class EPermission : int
{
    /// Applies to: all objects.
    Read         /* "read" */,

    /// Applies to: all objects.
    Write        /* "write" */,

    /// Applies to: accounts / pools.
    Use          /* "use" */,

    /// Applies to: all objects.
    Administer   /* "administer" */,

    /// Applies to: schemas.
    Create       /* "create" */,

    /// Applies to: all objects.
    Remove       /* "remove" */,

    /// Applies to: tables.
    Mount        /* "mount" */,

    /// Applies to: operations.
    Manage       /* "manage" */,
};

/// Whether permission is granted or denied.
enum class ESecurityAction : int
{
    /// Permission is granted.
    Allow /* "allow" */,

    /// Permission is denied.
    Deny  /* "deny" */,
};

///
/// @brief Options for @ref NYT::IClient::CheckPermission
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#check_permission
struct TCheckPermissionOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TCheckPermissionOptions;
    /// @endcond

    /// Columns to check permission to (for tables only).
    FLUENT_VECTOR_FIELD(TString, Column);
};

///
/// @brief Columnar statistics fetching mode.
///
/// @ref NYT::TGetTableColumnarStatisticsOptions::FetcherMode
enum class EColumnarStatisticsFetcherMode
{
    /// Slow mode for fetching precise columnar statistics.
    FromNodes /* "from_nodes" */,

    ///
    /// @brief Fast mode for fetching lightweight columnar statistics.
    ///
    /// Relative precision is 1 / 256.
    ///
    /// @note Might be unavailable for old tables in that case some upper bound is returned.
    FromMaster /* "from_master" */,

    /// Use lightweight columnar statistics (FromMaster) if available otherwise switch to slow but precise mode (FromNodes).
    Fallback /* "fallback" */,
};

///
/// @brief Options for @ref NYT::IClient::GetTableColumnarStatistics
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#get_table_columnar_statistics
struct TGetTableColumnarStatisticsOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TGetTableColumnarStatisticsOptions;
    /// @endcond

    ///
    /// @brief Mode of statistics fetching.
    ///
    /// @ref NYT::EColumnarStatisticsFetcherMode
    FLUENT_FIELD_OPTION(EColumnarStatisticsFetcherMode, FetcherMode);
};

///
/// @brief Table partitioning mode.
///
/// @ref NYT::TGetTablePartitionsOptions::PartitionMode
enum class ETablePartitionMode
{
    ///
    /// @brief Ignores the order of input tables and their chunk and sorting orders.
    ///
    Unordered /* "unordered" */,

    ///
    /// @brief The order of table ranges inside each partition obey the order of input tables and their chunk orders.
    ///
    Ordered /* "ordered" */,
};

///
/// @brief Options for @ref NYT::IClient::GetTablePartitions
///
struct TGetTablePartitionsOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TGetTablePartitionsOptions;
    /// @endcond

    ///
    /// @brief Table partitioning mode.
    ///
    /// @ref NYT::ETablePartitionMode
    FLUENT_FIELD(ETablePartitionMode, PartitionMode);

    ///
    /// @brief Approximate data weight of each output partition.
    ///
    FLUENT_FIELD(i64, DataWeightPerPartition);

    ///
    /// @brief Maximum output partition count.
    ///
    /// Consider the situation when the `MaxPartitionCount` is given
    /// and the total data weight exceeds `MaxPartitionCount * DataWeightPerPartition`.
    /// If `AdjustDataWeightPerPartition` is |true|
    /// `GetTablePartitions` will yield partitions exceeding the `DataWeightPerPartition`.
    /// If `AdjustDataWeightPerPartition` is |false|
    /// the partitioning will be aborted as soon as the output partition count exceeds this limit.
    FLUENT_FIELD_OPTION(int, MaxPartitionCount);

    ///
    /// @brief Allow the data weight per partition to exceed `DataWeightPerPartition` when `MaxPartitionCount` is set.
    ///
    /// |True| by default.
    FLUENT_FIELD_DEFAULT(bool, AdjustDataWeightPerPartition, true);
};

///
/// @brief Options for @ref NYT::IClient::GetTabletInfos
///
/// @note They are empty for now but options might appear in the future.
///
/// @see https://ytsaurus.tech/docs/en/api/commands.html#get_tablet_infos
struct TGetTabletInfosOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TGetTabletInfosOptions;
    /// @endcond
};

/// Options for @ref NYT::IClient::SkyShareTable
struct TSkyShareTableOptions
{
    /// @cond Doxygen_Suppress
    using TSelf = TSkyShareTableOptions;
    /// @endcond

    ///
    /// @brief Key columns that are used to group files in a table into torrents.
    ///
    /// One torrent is created for each value of `KeyColumns` columns.
    /// If not specified, all files go into single torrent.
    FLUENT_FIELD_OPTION(TColumnNames, KeyColumns);

    /// @brief Allow skynet manager to return fastbone links to skynet. See YT-11437
    FLUENT_FIELD_OPTION(bool, EnableFastbone);
};

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT