mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of github.com:triAGENS/ArangoDB into sharding
This commit is contained in:
commit
db4a7813cf
|
@ -229,8 +229,7 @@ bool RestEdgeHandler::createDocument () {
|
||||||
#ifdef TRI_ENABLE_CLUSTER
|
#ifdef TRI_ENABLE_CLUSTER
|
||||||
if (ServerState::instance()->isCoordinator()) {
|
if (ServerState::instance()->isCoordinator()) {
|
||||||
// json will be freed inside!
|
// json will be freed inside!
|
||||||
return createDocumentCoordinator(collection, waitForSync, json,
|
return createDocumentCoordinator(collection, waitForSync, json, from, to);
|
||||||
from, to);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7687,6 +7687,24 @@ static v8::Handle<v8::Value> SaveVocbaseColCoordinator (TRI_vocbase_col_t* colle
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief extract a key from a v8 object
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static string GetId (v8::Handle<v8::Value> const& arg) {
|
||||||
|
if (arg->IsObject() && ! arg->IsArray()) {
|
||||||
|
v8::Local<v8::Object> obj = arg->ToObject();
|
||||||
|
|
||||||
|
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
|
||||||
|
|
||||||
|
if (obj->Has(v8g->_IdKey)) {
|
||||||
|
return TRI_ObjectToString(obj->Get(v8g->_IdKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRI_ObjectToString(arg);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief saves an edge, coordinator case in a cluster
|
/// @brief saves an edge, coordinator case in a cluster
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7706,9 +7724,12 @@ static v8::Handle<v8::Value> SaveEdgeColCoordinator (TRI_vocbase_col_t* collecti
|
||||||
if (argv.Length() < 3 || argv.Length() > 4) {
|
if (argv.Length() < 3 || argv.Length() > 4) {
|
||||||
TRI_V8_EXCEPTION_USAGE(scope, "save(<from>, <to>, <data>, [<waitForSync>])");
|
TRI_V8_EXCEPTION_USAGE(scope, "save(<from>, <to>, <data>, [<waitForSync>])");
|
||||||
}
|
}
|
||||||
string _from = TRI_ObjectToString(argv[0]);
|
|
||||||
string _to = TRI_ObjectToString(argv[1]);
|
string _from = GetId(argv[0]);
|
||||||
|
string _to = GetId(argv[1]);
|
||||||
|
|
||||||
TRI_json_t* json = TRI_ObjectToJson(argv[2]);
|
TRI_json_t* json = TRI_ObjectToJson(argv[2]);
|
||||||
|
|
||||||
const bool waitForSync = ExtractForceSync(argv, 3);
|
const bool waitForSync = ExtractForceSync(argv, 3);
|
||||||
if (! TRI_IsArrayJson(json)) {
|
if (! TRI_IsArrayJson(json)) {
|
||||||
if (0 != json) {
|
if (0 != json) {
|
||||||
|
|
Loading…
Reference in New Issue