mirror of https://gitee.com/bigwinds/arangodb
Prepare creation of a document in the coordinator.
This commit is contained in:
parent
27276205c4
commit
3887303a82
|
@ -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
|
||||
///
|
||||
|
|
|
@ -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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue