MCPcopy Create free account
hub / github.com/baidu/tera / Init

Method Init

src/observer/executor/scanner_impl.cc:154–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154bool ScannerImpl::Init() {
155 tera::ErrorCode err;
156 if (!tera_client_) {
157 tera_client_.reset(tera::Client::NewClient(FLAGS_flagfile, &err));
158
159 if (tera::ErrorCode::kOK != err.GetType()) {
160 LOG(ERROR) << "init tera client [" << FLAGS_flagfile << "] failed, " << err.ToString();
161 return false;
162 }
163 }
164
165 // init key_selector_
166 // different selector started by different flags
167 if (options_.strategy == ScanStrategy::kRandom) {
168 LOG(INFO) << "random key";
169 key_selector_.reset(new RandomKeySelector());
170 } else if (options_.strategy == ScanStrategy::kTabletBucket) {
171 LOG(INFO) << "tablet bucket key";
172 key_selector_.reset(new TabletBucketKeySelector(options_.bucket_id, options_.bucket_cnt));
173 }
174
175 return true;
176}
177
178bool ScannerImpl::Start() {
179 for (int32_t idx = 0; idx < FLAGS_observer_scanner_thread_num; ++idx) {

Callers 6

OnNotifyTestMethod · 0.45
NonTransactionTestMethod · 0.45
ValidateCellValueTestMethod · 0.45
StartServerMethod · 0.45

Calls 3

resetMethod · 0.45
GetTypeMethod · 0.45
ToStringMethod · 0.45

Tested by 5

OnNotifyTestMethod · 0.36
NonTransactionTestMethod · 0.36
ValidateCellValueTestMethod · 0.36