| 47 | } |
| 48 | |
| 49 | ReplicateNode::ReplicateNode(const std::string& point, LogParts* logs, |
| 50 | const std::string& log_path, uint32_t tid, |
| 51 | uint32_t pid, std::atomic<uint64_t>* term, |
| 52 | std::atomic<uint64_t>* leader_log_offset, |
| 53 | bthread::Mutex* mu, bthread::ConditionVariable* cv, |
| 54 | bool rep_follower, |
| 55 | std::atomic<uint64_t>* follower_offset, |
| 56 | const std::string& real_point) |
| 57 | : log_reader_(logs, log_path, false), |
| 58 | cache_(), |
| 59 | endpoint_(point), |
| 60 | last_sync_offset_(0), |
| 61 | log_matched_(false), |
| 62 | tid_(tid), |
| 63 | pid_(pid), |
| 64 | term_(term), |
| 65 | rpc_client_(point), |
| 66 | worker_(), |
| 67 | leader_log_offset_(leader_log_offset), |
| 68 | is_running_(false), |
| 69 | mu_(mu), |
| 70 | cv_(cv), |
| 71 | go_back_cnt_(0), |
| 72 | rep_node_(rep_follower), |
| 73 | follower_offset_(follower_offset) { |
| 74 | if (!real_point.empty()) { |
| 75 | rpc_client_ = fedb::RpcClient<::fedb::api::TabletServer_Stub>(real_point); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | int ReplicateNode::Init() { |
| 80 | int ok = rpc_client_.Init(); |