@@ -46,90 +46,26 @@ bool StoreClient::Init(const std::string& coor_addr) {
46
46
return kv_storage_->Init (store_addrs);
47
47
}
48
48
49
- bool StoreClient::CreateLockTable (const std::string& name) {
49
+ bool StoreClient::CreateMetaTable (const std::string& name) {
50
50
int64_t table_id = 0 ;
51
- KVStorage::TableOption option ;
52
- MetaCodec::GetLockTableRange ( option.start_key , option .end_key ) ;
51
+ Range range = MetaCodec::GetMetaTableRange () ;
52
+ KVStorage::TableOption option = { .start_key = range. start , .end_key = range. end } ;
53
53
auto status = kv_storage_->CreateTable (name, option, table_id);
54
54
if (!status.ok ()) {
55
- DINGO_LOG (ERROR) << fmt::format (" create lock table fail, error: {}." , status.error_str ());
55
+ DINGO_LOG (ERROR) << fmt::format (" create meta table fail, error: {}." , status.error_str ());
56
56
return false ;
57
57
}
58
58
59
- DINGO_LOG (INFO) << fmt::format (" create lock table success, start_key({}), end_key({})." ,
60
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
61
-
62
- return true ;
63
- }
64
-
65
- bool StoreClient::CreateAutoIncrementTable (const std::string& name) {
66
- int64_t table_id = 0 ;
67
- KVStorage::TableOption option;
68
- MetaCodec::GetAutoIncrementTableRange (option.start_key , option.end_key );
69
- auto status = kv_storage_->CreateTable (name, option, table_id);
70
- if (!status.ok ()) {
71
- DINGO_LOG (ERROR) << fmt::format (" create autoincrement table fail, error: {}." , status.error_str ());
72
- return false ;
73
- }
74
-
75
- DINGO_LOG (INFO) << fmt::format (" create autoincrement table success, start_key({}), end_key({})." ,
76
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
77
-
78
- return true ;
79
- }
80
-
81
- bool StoreClient::CreateHeartbeatTable (const std::string& name) {
82
- int64_t table_id = 0 ;
83
- KVStorage::TableOption option;
84
- MetaCodec::GetHeartbeatTableRange (option.start_key , option.end_key );
85
- auto status = kv_storage_->CreateTable (name, option, table_id);
86
- if (!status.ok ()) {
87
- DINGO_LOG (ERROR) << fmt::format (" create heartbeat table fail, error: {}." , status.error_str ());
88
- return false ;
89
- }
90
-
91
- DINGO_LOG (INFO) << fmt::format (" create heartbeat table success, start_key({}), end_key({})." ,
92
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
93
-
94
- return true ;
95
- }
96
-
97
- bool StoreClient::CreateFsTable (const std::string& name) {
98
- int64_t table_id = 0 ;
99
- KVStorage::TableOption option;
100
- MetaCodec::GetFsTableRange (option.start_key , option.end_key );
101
- auto status = kv_storage_->CreateTable (name, option, table_id);
102
- if (!status.ok ()) {
103
- DINGO_LOG (ERROR) << fmt::format (" create fs table fail, error: {}." , status.error_str ());
104
- return false ;
105
- }
106
-
107
- DINGO_LOG (INFO) << fmt::format (" create fs table success, start_key({}), end_key({})." ,
108
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
109
-
110
- return true ;
111
- }
112
-
113
- bool StoreClient::CreateFsQuotaTable (const std::string& name) {
114
- int64_t table_id = 0 ;
115
- KVStorage::TableOption option;
116
- MetaCodec::GetQuotaTableRange (option.start_key , option.end_key );
117
- auto status = kv_storage_->CreateTable (name, option, table_id);
118
- if (!status.ok ()) {
119
- DINGO_LOG (ERROR) << fmt::format (" create fs quota table fail, error: {}." , status.error_str ());
120
- return false ;
121
- }
122
-
123
- DINGO_LOG (INFO) << fmt::format (" create fs quota table success, start_key({}), end_key({})." ,
59
+ DINGO_LOG (INFO) << fmt::format (" create meta table success, start_key({}), end_key({})." ,
124
60
Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
125
61
126
62
return true ;
127
63
}
128
64
129
65
bool StoreClient::CreateFsStatsTable (const std::string& name) {
130
66
int64_t table_id = 0 ;
131
- KVStorage::TableOption option ;
132
- MetaCodec::GetFsStatsTableRange ( option.start_key , option .end_key ) ;
67
+ Range range = MetaCodec::GetFsStatsTableRange () ;
68
+ KVStorage::TableOption option = { .start_key = range. start , .end_key = range. end } ;
133
69
auto status = kv_storage_->CreateTable (name, option, table_id);
134
70
if (!status.ok ()) {
135
71
DINGO_LOG (ERROR) << fmt::format (" create fs stats table fail, error: {}." , status.error_str ());
@@ -142,54 +78,6 @@ bool StoreClient::CreateFsStatsTable(const std::string& name) {
142
78
return true ;
143
79
}
144
80
145
- bool StoreClient::CreateFileSessionTable (const std::string& name) {
146
- int64_t table_id = 0 ;
147
- KVStorage::TableOption option;
148
- MetaCodec::GetFileSessionTableRange (option.start_key , option.end_key );
149
- auto status = kv_storage_->CreateTable (name, option, table_id);
150
- if (!status.ok ()) {
151
- DINGO_LOG (ERROR) << fmt::format (" create file session table fail, error: {}." , status.error_str ());
152
- return false ;
153
- }
154
-
155
- DINGO_LOG (INFO) << fmt::format (" create file session table success, start_key({}), end_key({})." ,
156
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
157
-
158
- return true ;
159
- }
160
-
161
- bool StoreClient::CreateDelSliceTable (const std::string& name) {
162
- int64_t table_id = 0 ;
163
- KVStorage::TableOption option;
164
- MetaCodec::GetDelSliceTableRange (option.start_key , option.end_key );
165
- auto status = kv_storage_->CreateTable (name, option, table_id);
166
- if (!status.ok ()) {
167
- DINGO_LOG (ERROR) << fmt::format (" create trash chunk table fail, error: {}." , status.error_str ());
168
- return false ;
169
- }
170
-
171
- DINGO_LOG (INFO) << fmt::format (" create trash chunk table success, start_key({}), end_key({})." ,
172
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
173
-
174
- return true ;
175
- }
176
-
177
- bool StoreClient::CreateDelFileTable (const std::string& name) {
178
- int64_t table_id = 0 ;
179
- KVStorage::TableOption option;
180
- MetaCodec::GetDelFileTableRange (option.start_key , option.end_key );
181
- auto status = kv_storage_->CreateTable (name, option, table_id);
182
- if (!status.ok ()) {
183
- DINGO_LOG (ERROR) << fmt::format (" create del file table fail, error: {}." , status.error_str ());
184
- return false ;
185
- }
186
-
187
- DINGO_LOG (INFO) << fmt::format (" create del file table success, start_key({}), end_key({})." ,
188
- Helper::StringToHex (option.start_key ), Helper::StringToHex (option.end_key ));
189
-
190
- return true ;
191
- }
192
-
193
81
static std::string FormatTime (uint64_t time_ns) { return Helper::FormatMsTime (time_ns / 1000000 , " %H:%M:%S" ); }
194
82
195
83
static void TraversePrint (FsTreeNode* item, bool is_details, int level) {
0 commit comments