1
0
Fork 0

Remove *Delegate functions from ClusterComm library.

They do not make sense since we usually come from JavaScript
and have to take apart the JS objects anyway. Also, the requests
are usually quite small.
This commit is contained in:
Max Neunhoeffer 2013-12-30 16:36:27 +01:00
parent 52e5258a8a
commit b8ddcfef82
2 changed files with 0 additions and 108 deletions

View File

@ -363,70 +363,6 @@ ClusterCommResult* ClusterComm::asyncRequest (
return res;
}
ClusterCommResult* ClusterComm::asyncDelegate (
rest::HttpRequest const& req,
CoordTransactionID const coordTransactionID,
ShardID const shardID,
string const path,
map<string, string>& extraHeaderFields,
ClusterCommCallback* callback,
ClusterCommTimeout timeout) {
ClusterCommOperation* op = new ClusterCommOperation();
op->clientTransactionID = string(req.header("clienttransactionid"));
op->coordTransactionID = coordTransactionID;
do {
op->operationID = getOperationID();
} while (op->operationID == 0); // just to make sure
op->shardID = shardID;
op->serverID = ClusterState::instance()->getResponsibleServer(
shardID);
op->status = CL_COMM_SUBMITTED;
op->reqtype = req.requestType();
op->path = path;
if (0 != req.bodySize()) {
op->body = req.body();
op->bodyLength = req.bodySize();
}
else {
op->body = 0;
op->bodyLength = 0;
}
op->headerFields = new map<string, string>;
map<string, string> origHeaders = req.headers();
map<string, string>::iterator i;
for (i = origHeaders.begin(); i != origHeaders.end(); ++i) {
op->headerFields->insert(*i);
}
for (i = extraHeaderFields.begin(); i != extraHeaderFields.end(); ++i) {
op->headerFields->insert(*i);
}
// Add the header fields for asynchronous mode:
(*op->headerFields)["X-Arango-Async"] = "store";
(*op->headerFields)["X-Arango-Coordinator"]
= ServerState::instance()->getId() +
":" + basics::StringUtils::itoa(op->operationID) +
":" + op->clientTransactionID + ":" +
basics::StringUtils::itoa(coordTransactionID);
op->callback = callback;
op->endTime = timeout == 0.0 ? now()+24*60*60.0 : now()+timeout;
ClusterCommResult* res = new ClusterCommResult();
*res = *static_cast<ClusterCommResult*>(op);
{
basics::ConditionLocker locker(&somethingToSend);
toSend.push_back(op);
list<ClusterCommOperation*>::iterator i = toSend.end();
toSendByOpID[op->operationID] = --i;
}
LOG_TRACE("In asyncDelegate, put into queue %ld", op->operationID);
somethingToSend.signal();
return res;
}
bool ClusterComm::match (
ClientTransactionID const& clientTransactionID,
CoordTransactionID const coordTransactionID,

View File

@ -274,50 +274,6 @@ void ClusterCommRestCallback(string& coordinator, rest::HttpResponse* response);
map<string, string> const& headerFields,
ClusterCommTimeout timeout);
////////////////////////////////////////////////////////////////////////////////
/// @brief forward an HTTP request we got from the client on to a shard
/// asynchronously.
///
/// This behaves as @ref asyncRequest except that the actual request is
/// taken from `req`. We have to add a few headers and can use callback
/// and timeout. The caller has to delete the result. The ClusterComm
/// library copies the map from the `req` object and adds (and possibly
/// overwrites previous values) from `extraHeaderFields`. The library
/// takes ownerships of the pointer `callback` and
/// releases the memory when the operation has been completed.
/// Note that ClusterComm does not create a copy of the body of `req`,
/// therefore it is the responsibility of the caller to ensure that `req`
/// lives until the operation has been completed and that `req` is deleted
/// afterwards.
////////////////////////////////////////////////////////////////////////////////
ClusterCommResult* asyncDelegate (
rest::HttpRequest const& req,
CoordTransactionID const coordTransactionID,
ShardID const shardID,
string const path,
map<string, string>& extraHeaderFields,
ClusterCommCallback* callback,
ClusterCommTimeout timeout);
////////////////////////////////////////////////////////////////////////////////
/// @brief forward an HTTP request we got from the client on to a shard
/// synchronously.
///
/// This behaves as @ref syncRequest except that the actual request is
/// taken from `req`. We have to add a few headers and can use callback
/// and timeout. The caller has to delete the result.
////////////////////////////////////////////////////////////////////////////////
ClusterCommResult* syncDelegate (
rest::HttpRequest const& req,
CoordTransactionID const coordTransactionID,
ShardID const& shardID,
const string& path,
const map<string, string>& headerFields,
ClusterCommTimeout timeout);
////////////////////////////////////////////////////////////////////////////////
/// @brief check on the status of an operation
///