MCPcopy Create free account
hub / github.com/baidu/braft / process_runable_rpcs

Method process_runable_rpcs

src/braft/node.cpp:2998–3023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2996}
2997
2998void NodeImpl::AppendEntriesCache::process_runable_rpcs(int64_t local_last_index) {
2999 CHECK(!_rpc_map.empty());
3000 CHECK(!_rpc_queue.empty());
3001 HandleAppendEntriesFromCacheArg* arg = NULL;
3002 for (std::map<int64_t, AppendEntriesRpc*>::iterator it = _rpc_map.begin();
3003 it != _rpc_map.end();) {
3004 AppendEntriesRpc* rpc = it->second;
3005 if (rpc->request->prev_log_index() > local_last_index) {
3006 break;
3007 }
3008 local_last_index = rpc->request->prev_log_index() + rpc->request->entries_size();
3009 _rpc_map.erase(it++);
3010 rpc->RemoveFromList();
3011 if (arg == NULL) {
3012 arg = new HandleAppendEntriesFromCacheArg;
3013 arg->node = _node;
3014 }
3015 arg->rpcs.Append(rpc);
3016 }
3017 if (arg != NULL) {
3018 start_to_handle(arg);
3019 }
3020 if (_rpc_map.empty()) {
3021 stop_timer();
3022 }
3023}
3024
3025void NodeImpl::AppendEntriesCache::clear() {
3026 BRAFT_VLOG << "node " << _node->_group_id << ":" << _node->_server_id

Callers 1

Calls 3

beginMethod · 0.80
endMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected