1
1
#pragma once
2
2
#include " flat_iterator_ops.h"
3
3
#include " flat_mem_iter.h"
4
- #include " flat_part_iter_multi .h"
4
+ #include " flat_part_iter .h"
5
5
#include " flat_row_remap.h"
6
6
#include " flat_row_state.h"
7
7
#include " flat_range_cache.h"
8
- #include " util_fmt_cell.h"
9
8
10
9
#include < library/cpp/containers/stack_vector/stack_vec.h>
11
10
@@ -22,8 +21,8 @@ enum class ENext {
22
21
Uncommitted,
23
22
};
24
23
25
- template <class TIteratorOps >
26
- class TTableItBase : TNonCopyable {
24
+ template <class TIterOps >
25
+ class TTableIterBase : TNonCopyable {
27
26
enum class EType : ui8 {
28
27
Mem = 0 ,
29
28
Run = 1 ,
@@ -39,10 +38,10 @@ class TTableItBase : TNonCopyable {
39
38
};
40
39
41
40
class TEraseCachingState {
42
- using TOps = typename TIteratorOps ::TEraseCacheOps;
41
+ using TOps = typename TIterOps ::TEraseCacheOps;
43
42
44
43
public:
45
- TEraseCachingState (TTableItBase * it)
44
+ TEraseCachingState (TTableIterBase * it)
46
45
: It(it)
47
46
, Cache(it->ErasedKeysCache.Get())
48
47
{ }
@@ -214,7 +213,7 @@ class TTableItBase : TNonCopyable {
214
213
}
215
214
216
215
private:
217
- TTableItBase * It;
216
+ TTableIterBase * It;
218
217
TOps Cache;
219
218
TKeyRangeCache::const_iterator PrevEntry;
220
219
TKeyRangeCache::const_iterator NextEntry;
@@ -244,13 +243,13 @@ class TTableItBase : TNonCopyable {
244
243
}
245
244
246
245
public:
247
- TTableItBase (
246
+ TTableIterBase (
248
247
const TRowScheme* scheme, TTagsRef tags, ui64 lim = Max<ui64>(),
249
248
TRowVersion snapshot = TRowVersion::Max(),
250
249
NTable::ITransactionMapPtr committedTransactions = nullptr,
251
250
NTable::ITransactionObserverPtr transactionObserver = nullptr);
252
251
253
- ~TTableItBase ();
252
+ ~TTableIterBase ();
254
253
255
254
void Push (TAutoPtr<TMemIter>);
256
255
void Push (TAutoPtr<TRunIter>);
@@ -389,7 +388,7 @@ class TTableItBase : TNonCopyable {
389
388
390
389
int CompareKeys (TArrayRef<const TCell> a, TArrayRef<const TCell> b) const noexcept
391
390
{
392
- return TIteratorOps ::CompareKeys (Types, a, b);
391
+ return TIterOps ::CompareKeys (Types, a, b);
393
392
}
394
393
395
394
bool operator () (const TElement& a, const TElement& b) const noexcept
@@ -458,26 +457,26 @@ class TTableItBase : TNonCopyable {
458
457
class TTableIter ;
459
458
class TTableReverseIter ;
460
459
461
- class TTableIter : public TTableItBase <TTableItOps > {
460
+ class TTableIter : public TTableIterBase <TTableIterOps > {
462
461
public:
463
- using TTableItBase::TTableItBase ;
462
+ using TTableIterBase::TTableIterBase ;
464
463
465
464
typedef TTableReverseIter TReverseType;
466
465
467
466
static constexpr EDirection Direction = EDirection::Forward;
468
467
};
469
468
470
- class TTableReverseIter : public TTableItBase <TTableItReverseOps> {
469
+ class TTableReverseIter : public TTableIterBase <TTableItReverseOps> {
471
470
public:
472
- using TTableItBase::TTableItBase ;
471
+ using TTableIterBase::TTableIterBase ;
473
472
474
473
typedef TTableIter TReverseType;
475
474
476
475
static constexpr EDirection Direction = EDirection::Reverse;
477
476
};
478
477
479
478
template <class TIteratorOps >
480
- inline TTableItBase <TIteratorOps>::TTableItBase (
479
+ inline TTableIterBase <TIteratorOps>::TTableIterBase (
481
480
const TRowScheme* scheme, TTagsRef tags, ui64 limit,
482
481
TRowVersion snapshot,
483
482
NTable::ITransactionMapPtr committedTransactions,
@@ -495,28 +494,28 @@ inline TTableItBase<TIteratorOps>::TTableItBase(
495
494
{}
496
495
497
496
template <class TIteratorOps >
498
- inline TTableItBase <TIteratorOps>::~TTableItBase ()
497
+ inline TTableIterBase <TIteratorOps>::~TTableIterBase ()
499
498
{
500
499
}
501
500
502
501
template <class TIteratorOps >
503
- inline void TTableItBase <TIteratorOps>::AddReadyIterator(TArrayRef<const TCell> key, TIteratorId itId) {
502
+ inline void TTableIterBase <TIteratorOps>::AddReadyIterator(TArrayRef<const TCell> key, TIteratorId itId) {
504
503
Active = Iterators.emplace (Active, TElement ({key, itId}));
505
504
++Active;
506
505
std::push_heap (Iterators.begin (), Active, Comparator);
507
506
Inactive = Active;
508
507
}
509
508
510
509
template <class TIteratorOps >
511
- inline void TTableItBase <TIteratorOps>::AddNotReadyIterator(TIteratorId itId) {
510
+ inline void TTableIterBase <TIteratorOps>::AddNotReadyIterator(TIteratorId itId) {
512
511
size_t actPos = Active - Iterators.begin ();
513
512
Iterators.emplace_back (TElement ({{ }, itId}));
514
513
Active = Iterators.begin () + actPos;
515
514
Inactive = Active;
516
515
}
517
516
518
517
template <class TIteratorOps >
519
- inline void TTableItBase <TIteratorOps>::Push(TAutoPtr<TMemIter> it)
518
+ inline void TTableIterBase <TIteratorOps>::Push(TAutoPtr<TMemIter> it)
520
519
{
521
520
if (it && it->IsValid ()) {
522
521
TIteratorId itId = { EType::Mem, IteratorIndexFromSize (MemIters.size ()), it->MemTable ->Epoch };
@@ -528,7 +527,7 @@ inline void TTableItBase<TIteratorOps>::Push(TAutoPtr<TMemIter> it)
528
527
}
529
528
530
529
template <class TIteratorOps >
531
- inline void TTableItBase <TIteratorOps>::Push(TAutoPtr<TRunIter> it)
530
+ inline void TTableIterBase <TIteratorOps>::Push(TAutoPtr<TRunIter> it)
532
531
{
533
532
TIteratorId itId = { EType::Run, IteratorIndexFromSize (RunIters.size ()), it->Epoch () };
534
533
@@ -544,7 +543,7 @@ inline void TTableItBase<TIteratorOps>::Push(TAutoPtr<TRunIter> it)
544
543
}
545
544
546
545
template <class TIteratorOps >
547
- inline void TTableItBase <TIteratorOps>::StopBefore(TArrayRef<const TCell> key)
546
+ inline void TTableIterBase <TIteratorOps>::StopBefore(TArrayRef<const TCell> key)
548
547
{
549
548
Y_ABORT_UNLESS (!StopKey, " Using multiple stop keys not allowed" );
550
549
@@ -561,7 +560,7 @@ inline void TTableItBase<TIteratorOps>::StopBefore(TArrayRef<const TCell> key)
561
560
}
562
561
563
562
template <class TIteratorOps >
564
- inline void TTableItBase <TIteratorOps>::StopAfter(TArrayRef<const TCell> key)
563
+ inline void TTableIterBase <TIteratorOps>::StopAfter(TArrayRef<const TCell> key)
565
564
{
566
565
Y_ABORT_UNLESS (!StopKey, " Using multiple stop keys not allowed" );
567
566
@@ -578,7 +577,7 @@ inline void TTableItBase<TIteratorOps>::StopAfter(TArrayRef<const TCell> key)
578
577
}
579
578
580
579
template <class TIteratorOps >
581
- inline EReady TTableItBase <TIteratorOps>::Start() noexcept
580
+ inline EReady TTableIterBase <TIteratorOps>::Start() noexcept
582
581
{
583
582
if (Active != Iterators.end ()) {
584
583
return EReady::Page;
@@ -616,7 +615,7 @@ inline EReady TTableItBase<TIteratorOps>::Start() noexcept
616
615
}
617
616
618
617
template <class TIteratorOps >
619
- inline EReady TTableItBase <TIteratorOps>::Turn() noexcept
618
+ inline EReady TTableIterBase <TIteratorOps>::Turn() noexcept
620
619
{
621
620
if (!Limit) {
622
621
// Optimization: avoid calling Next after returning the last row
@@ -684,7 +683,7 @@ inline EReady TTableItBase<TIteratorOps>::Turn() noexcept
684
683
}
685
684
686
685
template <class TIteratorOps >
687
- inline bool TTableItBase <TIteratorOps>::IsUncommitted() const noexcept
686
+ inline bool TTableIterBase <TIteratorOps>::IsUncommitted() const noexcept
688
687
{
689
688
// Must only be called after a fully successful Apply()
690
689
Y_DEBUG_ABORT_UNLESS (Stage == EStage::Done && Ready == EReady::Data);
@@ -696,7 +695,7 @@ inline bool TTableItBase<TIteratorOps>::IsUncommitted() const noexcept
696
695
}
697
696
698
697
template <class TIteratorOps >
699
- inline ui64 TTableItBase <TIteratorOps>::GetUncommittedTxId() const noexcept
698
+ inline ui64 TTableIterBase <TIteratorOps>::GetUncommittedTxId() const noexcept
700
699
{
701
700
// Must only be called after a fully successful Apply()
702
701
Y_DEBUG_ABORT_UNLESS (Stage == EStage::Done && Ready == EReady::Data);
@@ -711,7 +710,7 @@ inline ui64 TTableItBase<TIteratorOps>::GetUncommittedTxId() const noexcept
711
710
}
712
711
713
712
template <class TIteratorOps >
714
- inline EReady TTableItBase <TIteratorOps>::SkipUncommitted() noexcept
713
+ inline EReady TTableIterBase <TIteratorOps>::SkipUncommitted() noexcept
715
714
{
716
715
// Must only be called after successful Apply() or page fault in SkipUncommitted()
717
716
Y_DEBUG_ABORT_UNLESS (Stage == EStage::Done && Ready != EReady::Gone);
@@ -736,7 +735,7 @@ inline EReady TTableItBase<TIteratorOps>::SkipUncommitted() noexcept
736
735
}
737
736
738
737
template <class TIteratorOps >
739
- inline TRowVersion TTableItBase <TIteratorOps>::GetRowVersion() const noexcept
738
+ inline TRowVersion TTableIterBase <TIteratorOps>::GetRowVersion() const noexcept
740
739
{
741
740
// Must only be called after a fully successful Apply()
742
741
Y_DEBUG_ABORT_UNLESS (Stage == EStage::Done && Ready == EReady::Data);
@@ -763,7 +762,7 @@ inline TRowVersion TTableItBase<TIteratorOps>::GetRowVersion() const noexcept
763
762
}
764
763
765
764
template <class TIteratorOps >
766
- inline EReady TTableItBase <TIteratorOps>::SkipToRowVersion(TRowVersion rowVersion) noexcept
765
+ inline EReady TTableIterBase <TIteratorOps>::SkipToRowVersion(TRowVersion rowVersion) noexcept
767
766
{
768
767
// Must only be called after successful Apply()
769
768
Y_DEBUG_ABORT_UNLESS (Stage == EStage::Done && Ready != EReady::Gone);
@@ -783,7 +782,7 @@ inline EReady TTableItBase<TIteratorOps>::SkipToRowVersion(TRowVersion rowVersio
783
782
}
784
783
785
784
template <class TIteratorOps >
786
- inline EReady TTableItBase <TIteratorOps>::Snap() noexcept
785
+ inline EReady TTableIterBase <TIteratorOps>::Snap() noexcept
787
786
{
788
787
Y_DEBUG_ABORT_UNLESS (Active != Inactive);
789
788
@@ -806,7 +805,7 @@ inline EReady TTableItBase<TIteratorOps>::Snap() noexcept
806
805
}
807
806
808
807
template <class TIteratorOps >
809
- inline EReady TTableItBase <TIteratorOps>::Snap(TRowVersion rowVersion) noexcept
808
+ inline EReady TTableIterBase <TIteratorOps>::Snap(TRowVersion rowVersion) noexcept
810
809
{
811
810
for (auto i = TReverseIter (Inactive), e = TReverseIter (Active); i != e; ++i) {
812
811
TIteratorId ai = i->IteratorId ;
@@ -842,7 +841,7 @@ inline EReady TTableItBase<TIteratorOps>::Snap(TRowVersion rowVersion) noexcept
842
841
}
843
842
844
843
template <class TIteratorOps >
845
- inline EReady TTableItBase <TIteratorOps>::DoSkipUncommitted() noexcept
844
+ inline EReady TTableIterBase <TIteratorOps>::DoSkipUncommitted() noexcept
846
845
{
847
846
Y_DEBUG_ABORT_UNLESS (Delta && Uncommitted);
848
847
@@ -885,7 +884,7 @@ inline EReady TTableItBase<TIteratorOps>::DoSkipUncommitted() noexcept
885
884
}
886
885
887
886
template <class TIteratorOps >
888
- inline EReady TTableItBase <TIteratorOps>::Apply() noexcept
887
+ inline EReady TTableIterBase <TIteratorOps>::Apply() noexcept
889
888
{
890
889
State.Reset (Remap.CellDefaults ());
891
890
@@ -958,7 +957,7 @@ inline EReady TTableItBase<TIteratorOps>::Apply() noexcept
958
957
}
959
958
960
959
template <class TIteratorOps >
961
- inline void TTableItBase <TIteratorOps>::InitLastKey(ERowOp op) noexcept
960
+ inline void TTableIterBase <TIteratorOps>::InitLastKey(ERowOp op) noexcept
962
961
{
963
962
TArrayRef<const TCell> key = Iterators.back ().Key ;
964
963
@@ -988,21 +987,21 @@ inline void TTableItBase<TIteratorOps>::InitLastKey(ERowOp op) noexcept
988
987
}
989
988
990
989
template <class TIteratorOps >
991
- inline TDbTupleRef TTableItBase <TIteratorOps>::GetKey() const noexcept
990
+ inline TDbTupleRef TTableIterBase <TIteratorOps>::GetKey() const noexcept
992
991
{
993
992
return { Scheme->Keys ->BasicTypes ().data (), LastKey.data (), static_cast <ui32>(LastKey.size ()) };
994
993
}
995
994
996
995
template <class TIteratorOps >
997
- inline TDbTupleRef TTableItBase <TIteratorOps>::GetValues() const noexcept
996
+ inline TDbTupleRef TTableIterBase <TIteratorOps>::GetValues() const noexcept
998
997
{
999
998
if (State.GetRowState () == ERowOp::Erase)
1000
999
return TDbTupleRef ();
1001
1000
return TDbTupleRef (Remap.Types ().begin (), (*State).begin (), (*State).size ());
1002
1001
}
1003
1002
1004
1003
template <class TIteratorOps >
1005
- inline bool TTableItBase <TIteratorOps>::SeekInternal(TArrayRef<const TCell> key, ESeek seek) noexcept
1004
+ inline bool TTableIterBase <TIteratorOps>::SeekInternal(TArrayRef<const TCell> key, ESeek seek) noexcept
1006
1005
{
1007
1006
Stage = EStage::Seek;
1008
1007
0 commit comments