| 56 | SchedulerMgr::~SchedulerMgr() {} |
| 57 | |
| 58 | comm::RetCode SchedulerMgr::Init() { |
| 59 | comm::SchedulerMgrBP::GetThreadInstance()->OnInit(); |
| 60 | |
| 61 | impl_->rwlock = new pthread_rwlock_t; |
| 62 | pthread_rwlock_init(impl_->rwlock, nullptr); |
| 63 | QLVerb("init rwlock"); |
| 64 | |
| 65 | // hrw |
| 66 | //hrwhash_ = new HRWHash(store_cli_conf->GetEndpointConfig()); |
| 67 | |
| 68 | // consistent hashing |
| 69 | //conhash_ = new ConHash(); |
| 70 | //conhash_->InitHash(store_cli_conf->GetEndpointConfig()->GetList()); |
| 71 | |
| 72 | const uint64_t now{comm::utils::Time::GetSteadyClockMS()}; |
| 73 | comm::RetCode ret{LoadBalance(now)}; |
| 74 | if (comm::RetCode::RET_OK != ret) { |
| 75 | QLErr("LoadBalance err %d", ret); |
| 76 | |
| 77 | return ret; |
| 78 | } |
| 79 | |
| 80 | return comm::RetCode::RET_OK; |
| 81 | } |
| 82 | |
| 83 | comm::RetCode SchedulerMgr::Dispose() { |
| 84 | comm::SchedulerMgrBP::GetThreadInstance()->OnDispose(); |