Beispiel #1
0
int CommandProc::proc_scan(const Link &link, const Request &req, Response *resp){
	if(req.size() < 4){
		resp->push_back("client_error");
	}else{
		int limit = req[3].Int();
		KIterator *it = ssdb->scan(req[1], req[2], limit);
		resp->push_back("ok");
		while(it->next()){
			resp->push_back(it->key);
			resp->push_back(it->val);
		}
		delete it;
	}
	return 0;
}
Beispiel #2
0
static int proc_rscan(Server *serv, Link *link, const Request &req, Response *resp){
	if(req.size() < 4){
		resp->push_back("client_error");
	}else{
		uint64_t limit = req[3].Uint64();
		KIterator *it = serv->ssdb->rscan(req[1], req[2], limit);
		resp->push_back("ok");
		while(it->next()){
			resp->push_back(it->key);
			resp->push_back(it->val);
		}
		delete it;
	}
	return 0;
}
Beispiel #3
0
int proc_rscan(NetworkServer *net, Link *link, const Request &req, Response *resp){
	SSDBServer *serv = (SSDBServer *)net->data;
	CHECK_NUM_PARAMS(4);
	CHECK_KEY_RANGE(1);

	uint64_t limit = req[3].Uint64();
	KIterator *it = serv->ssdb->rscan(req[1], req[2], limit);
	resp->push_back("ok");
	uint64_t size = 0;
	while(it->next()){
		size += it->key.size() + it->val.size();
		CHECK_SCAN_OUTPUT_LIMIT(size);
		resp->push_back(it->key);
		resp->push_back(it->val);
	}
	delete it;
	return 0;
}