@@ -35,8 +35,8 @@ class TKeyPrefix : public TBuffer
35
35
: Partition(partition)
36
36
{
37
37
Resize (UnmarkedSize ());
38
- * PtrType () = type;
39
- memcpy (PtrPartition (), Sprintf (" %.10" PRIu32, Partition.InternalPartitionId ).data (), 10 );
38
+ SetType ( type) ;
39
+ memcpy (PtrPartition (), Sprintf (" %.10" PRIu32, Partition.InternalPartitionId ).data (), 10 );
40
40
}
41
41
42
42
TKeyPrefix (EType type, const TPartitionId& partition, EMark mark)
@@ -62,25 +62,61 @@ class TKeyPrefix : public TBuffer
62
62
static constexpr ui32 MarkPosition () { return UnmarkedSize (); }
63
63
static constexpr ui32 MarkedSize () { return UnmarkedSize () + 1 ; }
64
64
65
+
65
66
void SetType (EType type) {
66
67
*PtrType () = type;
67
68
}
68
69
70
+
69
71
EType GetType () const {
70
- return EType (*PtrType ());
72
+ switch (*PtrType ()) {
73
+ case TypeNone:
74
+ case ServiceTypeNone:
75
+ return TypeNone;
76
+ case TypeData:
77
+ case ServiceTypeData:
78
+ return TypeData;
79
+ case TypeTmpData:
80
+ case ServiceTypeTmpData:
81
+ return TypeTmpData;
82
+ case TypeInfo:
83
+ case ServiceTypeInfo:
84
+ return TypeInfo;
85
+ case TypeMeta:
86
+ case ServiceTypeMeta:
87
+ return TypeMeta;
88
+ case TypeTxMeta:
89
+ case ServiceTypeTxMeta:
90
+ return TypeTxMeta;
91
+ }
92
+ Y_ABORT ();
93
+ return TypeNone;
71
94
}
72
95
96
+ bool IsServicePartition () const {return Partition.WriteId .Defined ();}
97
+
73
98
const TPartitionId& GetPartition () const { return Partition; }
74
99
75
100
protected:
76
101
static constexpr ui32 UnmarkedSize () { return 1 + 10 ; }
77
102
78
103
void ParsePartition ()
79
104
{
80
- Partition.InternalPartitionId = FromString<ui32>(TStringBuf{PtrPartition (), 10 });
105
+ Partition.OriginalPartitionId = FromString<ui32>(TStringBuf{PtrPartition (), 10 });
106
+ Partition.InternalPartitionId = Partition.OriginalPartitionId ;
81
107
}
82
108
109
+
83
110
private:
111
+ enum EServiceType : char {
112
+ ServiceTypeNone = 1 ,
113
+ ServiceTypeInfo = ' M' ,
114
+ ServiceTypeData = ' D' ,
115
+ ServiceTypeTmpData = ' X' ,
116
+ ServiceTypeMeta = ' J' ,
117
+ ServiceTypeTxMeta = ' K'
118
+ };
119
+
84
120
char * PtrType () { return Data (); }
85
121
char * PtrMark () { return Data () + UnmarkedSize (); }
86
122
char * PtrPartition () { return Data () + 1 ; }
@@ -90,6 +126,7 @@ class TKeyPrefix : public TBuffer
90
126
const char * PtrPartition () const { return Data () + 1 ; }
91
127
92
128
TPartitionId Partition;
129
+
93
130
};
94
131
95
132
// {char type; ui32 partiton; ui64 offset; ui16 partNo; ui32 count, ui16 internalPartsCount}
0 commit comments