MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / HandleClientScan

Function HandleClientScan

src/cmd/fedb.cc:4196–4241  ·  view source on GitHub ↗

the input format like scan tid pid pk st et

Source from the content-addressed store, hash-verified

4194
4195// the input format like scan tid pid pk st et
4196void HandleClientScan(const std::vector<std::string>& parts,
4197 ::fedb::client::TabletClient* client) {
4198 if (parts.size() < 6) {
4199 std::cout << "Bad scan format! eg. scan tid pid pk start_time end_time "
4200 "[limit]"
4201 << std::endl;
4202 return;
4203 }
4204 try {
4205 uint32_t limit = 0;
4206 if (parts.size() > 6) {
4207 limit = boost::lexical_cast<uint32_t>(parts[6]);
4208 }
4209 std::string msg;
4210 ::fedb::base::KvIterator* it = client->Scan(
4211 boost::lexical_cast<uint32_t>(parts[1]),
4212 boost::lexical_cast<uint32_t>(parts[2]), parts[3],
4213 boost::lexical_cast<uint64_t>(parts[4]),
4214 boost::lexical_cast<uint64_t>(parts[5]), limit, 0, msg);
4215 if (it == NULL) {
4216 std::cout << "Fail to scan table. error msg: " << msg << std::endl;
4217 } else {
4218 bool print = true;
4219 if (parts.size() >= 7) {
4220 if (parts[6] == "false") {
4221 print = false;
4222 }
4223 }
4224 std::cout << "#\tTime\tData" << std::endl;
4225 uint32_t index = 1;
4226 while (it->Valid()) {
4227 if (print) {
4228 std::cout << index << "\t" << it->GetKey() << "\t"
4229 << it->GetValue().ToString() << std::endl;
4230 }
4231 index++;
4232 it->Next();
4233 }
4234 delete it;
4235 }
4236 } catch (std::exception const& e) {
4237 std::cout << "Invalid args, tid pid should be uint32_t, st and et "
4238 "should be uint64_t"
4239 << std::endl;
4240 }
4241}
4242
4243void HandleClientBenchmarkPut(uint32_t tid, uint32_t pid, uint32_t val_size,
4244 uint32_t run_times, uint32_t ns,

Callers 1

StartClientFunction · 0.85

Calls 7

sizeMethod · 0.45
ScanMethod · 0.45
ValidMethod · 0.45
GetKeyMethod · 0.45
ToStringMethod · 0.45
GetValueMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected