1
0
Fork 0

Prepare creation of a document in the coordinator.

This commit is contained in:
Max Neunhoeffer 2014-01-22 23:57:41 +01:00
parent 27276205c4
commit 3887303a82
2 changed files with 37 additions and 0 deletions

View File

@ -37,6 +37,12 @@
#include "VocBase/vocbase.h"
#include "Utils/Barrier.h"
#ifdef TRI_ENABLE_CLUSTER
#include "Cluster/ServerState.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterComm.h"
#endif
using namespace std;
using namespace triagens::basics;
using namespace triagens::rest;
@ -317,6 +323,12 @@ bool RestDocumentHandler::createDocument () {
return false;
}
#ifdef TRI_ENABLE_CLUSTER
if (ServerState::instance()->isCoordinator()) {
return createDocumentCoordinator(collection, waitForSync, json);
}
#endif
if (! checkCreateCollection(collection, getCollectionType())) {
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
return false;
@ -384,6 +396,23 @@ bool RestDocumentHandler::createDocument () {
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a document, coordinator case in a cluster
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_ENABLE_CLUSTER
bool RestDocumentHandler::createDocumentCoordinator (char const* collection,
bool waitForSync,
TRI_json_t* json) {
// Find collectionID from collection, which is the name
// ask ClusterInfo for the responsible shard
// send a synchronous request to that shard using ClusterComm
// if not successful prepare error and return false
// prepare successful answer (created or accepted depending on waitForSync)
return true;
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief reads a single or all documents
///

View File

@ -113,6 +113,14 @@ namespace triagens {
return TRI_COL_TYPE_DOCUMENT;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a document, coordinator case in a cluster
////////////////////////////////////////////////////////////////////////////////
bool createDocumentCoordinator (char const* collection,
bool waitForSync,
TRI_json_t* json);
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a document
////////////////////////////////////////////////////////////////////////////////