mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/AvocadoDB into devel
Conflicts: js/common/modules/graph.js
This commit is contained in:
commit
402e49f8cc
|
@ -57,9 +57,9 @@ ERROR_AVOCADO_CORRUPTED_COLLECTION,1102,"corrupted collection","Will be raised w
|
|||
ERROR_AVOCADO_MMAP_FAILED,1103,"mmap failed","Will be raised when the system call mmap failed."
|
||||
ERROR_AVOCADO_FILESYSTEM_FULL,1104,"filesystem full","Will be raised when the filesystem is full."
|
||||
ERROR_AVOCADO_NO_JOURNAL,1105,"no journal","Will be raised when a journal cannot be created."
|
||||
ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS,1106,"cannot create/rename datafile because it ready exists","Will be raised when the datafile cannot be created or renamed because a file of the same name already exists."
|
||||
ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS,1106,"cannot create/rename datafile because it already exists","Will be raised when the datafile cannot be created or renamed because a file of the same name already exists."
|
||||
ERROR_AVOCADO_DATABASE_LOCKED,1107,"database is locked","Will be raised when the database is locked by a different process."
|
||||
ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS,1108,"cannot create/rename collection because directory ready exists","Will be raised when the collection cannot be created because a directory of the same name already exists."
|
||||
ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS,1108,"cannot create/rename collection because directory already exists","Will be raised when the collection cannot be created because a directory of the same name already exists."
|
||||
|
||||
################################################################################
|
||||
## AvocadoDB storage errors
|
||||
|
|
|
@ -42,9 +42,9 @@ void TRI_InitialiseErrorMessages (void) {
|
|||
REG_ERROR(ERROR_AVOCADO_MMAP_FAILED, "mmap failed");
|
||||
REG_ERROR(ERROR_AVOCADO_FILESYSTEM_FULL, "filesystem full");
|
||||
REG_ERROR(ERROR_AVOCADO_NO_JOURNAL, "no journal");
|
||||
REG_ERROR(ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS, "cannot create/rename datafile because it ready exists");
|
||||
REG_ERROR(ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS, "cannot create/rename datafile because it already exists");
|
||||
REG_ERROR(ERROR_AVOCADO_DATABASE_LOCKED, "database is locked");
|
||||
REG_ERROR(ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS, "cannot create/rename collection because directory ready exists");
|
||||
REG_ERROR(ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS, "cannot create/rename collection because directory already exists");
|
||||
REG_ERROR(ERROR_AVOCADO_CONFLICT, "conflict");
|
||||
REG_ERROR(ERROR_AVOCADO_WRONG_VOCBASE_PATH, "wrong path for database");
|
||||
REG_ERROR(ERROR_AVOCADO_DOCUMENT_NOT_FOUND, "document not found");
|
||||
|
|
|
@ -77,12 +77,12 @@ extern "C" {
|
|||
/// Will be raised when the filesystem is full.
|
||||
/// - 1105: @CODE{no journal}
|
||||
/// Will be raised when a journal cannot be created.
|
||||
/// - 1106: @CODE{cannot create/rename datafile because it ready exists}
|
||||
/// - 1106: @CODE{cannot create/rename datafile because it already exists}
|
||||
/// Will be raised when the datafile cannot be created or renamed because a
|
||||
/// file of the same name already exists.
|
||||
/// - 1107: @CODE{database is locked}
|
||||
/// Will be raised when the database is locked by a different process.
|
||||
/// - 1108: @CODE{cannot create/rename collection because directory ready exists}
|
||||
/// - 1108: @CODE{cannot create/rename collection because directory already exists}
|
||||
/// Will be raised when the collection cannot be created because a directory
|
||||
/// of the same name already exists.
|
||||
/// - 1200: @CODE{conflict}
|
||||
|
@ -597,7 +597,7 @@ void TRI_InitialiseErrorMessages (void);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1106: ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS
|
||||
///
|
||||
/// cannot create/rename datafile because it ready exists
|
||||
/// cannot create/rename datafile because it already exists
|
||||
///
|
||||
/// Will be raised when the datafile cannot be created or renamed because a
|
||||
/// file of the same name already exists.
|
||||
|
@ -618,7 +618,7 @@ void TRI_InitialiseErrorMessages (void);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1108: ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS
|
||||
///
|
||||
/// cannot create/rename collection because directory ready exists
|
||||
/// cannot create/rename collection because directory already exists
|
||||
///
|
||||
/// Will be raised when the collection cannot be created because a directory of
|
||||
/// the same name already exists.
|
||||
|
|
|
@ -257,7 +257,7 @@ function getVertex(req, res) {
|
|||
var v = g.getVertex(id);
|
||||
|
||||
if (v == undefined || v._properties == undefined) {
|
||||
throw "no vertex found";
|
||||
throw "no vertex found for: " + id;
|
||||
}
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { "vertex" : v._properties} );
|
||||
|
@ -296,7 +296,7 @@ function deleteVertex(req, res) {
|
|||
var v = g.getVertex(id);
|
||||
|
||||
if (v == undefined || v._properties == undefined) {
|
||||
throw "no vertex found";
|
||||
throw "no vertex found for: " + id;
|
||||
}
|
||||
|
||||
g.removeVertex(v);
|
||||
|
@ -483,10 +483,11 @@ function getEdge(req, res) {
|
|||
id += "/" + req.suffix[1];
|
||||
}
|
||||
|
||||
var e = g.getVertex(id);
|
||||
|
||||
var e = new graph.Edge(g, id);
|
||||
|
||||
if (e == undefined || e._properties == undefined) {
|
||||
throw "no edge found";
|
||||
throw "no edge found for: " + id + " " + e;
|
||||
}
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { "edge" : e._properties} );
|
||||
|
|
|
@ -36,9 +36,9 @@ ModuleCache["/internal"].exports.errors = {
|
|||
"ERROR_AVOCADO_MMAP_FAILED" : { "code" : 1103, "message" : "mmap failed" },
|
||||
"ERROR_AVOCADO_FILESYSTEM_FULL" : { "code" : 1104, "message" : "filesystem full" },
|
||||
"ERROR_AVOCADO_NO_JOURNAL" : { "code" : 1105, "message" : "no journal" },
|
||||
"ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS" : { "code" : 1106, "message" : "cannot create/rename datafile because it ready exists" },
|
||||
"ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS" : { "code" : 1106, "message" : "cannot create/rename datafile because it already exists" },
|
||||
"ERROR_AVOCADO_DATABASE_LOCKED" : { "code" : 1107, "message" : "database is locked" },
|
||||
"ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS" : { "code" : 1108, "message" : "cannot create/rename collection because directory ready exists" },
|
||||
"ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS" : { "code" : 1108, "message" : "cannot create/rename collection because directory already exists" },
|
||||
"ERROR_AVOCADO_CONFLICT" : { "code" : 1200, "message" : "conflict" },
|
||||
"ERROR_AVOCADO_WRONG_VOCBASE_PATH" : { "code" : 1201, "message" : "wrong path for database" },
|
||||
"ERROR_AVOCADO_DOCUMENT_NOT_FOUND" : { "code" : 1202, "message" : "document not found" },
|
||||
|
|
|
@ -37,9 +37,9 @@ static string JS_common_bootstrap_errors =
|
|||
" \"ERROR_AVOCADO_MMAP_FAILED\" : { \"code\" : 1103, \"message\" : \"mmap failed\" }, \n"
|
||||
" \"ERROR_AVOCADO_FILESYSTEM_FULL\" : { \"code\" : 1104, \"message\" : \"filesystem full\" }, \n"
|
||||
" \"ERROR_AVOCADO_NO_JOURNAL\" : { \"code\" : 1105, \"message\" : \"no journal\" }, \n"
|
||||
" \"ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS\" : { \"code\" : 1106, \"message\" : \"cannot create/rename datafile because it ready exists\" }, \n"
|
||||
" \"ERROR_AVOCADO_DATAFILE_ALREADY_EXISTS\" : { \"code\" : 1106, \"message\" : \"cannot create/rename datafile because it already exists\" }, \n"
|
||||
" \"ERROR_AVOCADO_DATABASE_LOCKED\" : { \"code\" : 1107, \"message\" : \"database is locked\" }, \n"
|
||||
" \"ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS\" : { \"code\" : 1108, \"message\" : \"cannot create/rename collection because directory ready exists\" }, \n"
|
||||
" \"ERROR_AVOCADO_COLLECTION_DIRECTORY_ALREADY_EXISTS\" : { \"code\" : 1108, \"message\" : \"cannot create/rename collection because directory already exists\" }, \n"
|
||||
" \"ERROR_AVOCADO_CONFLICT\" : { \"code\" : 1200, \"message\" : \"conflict\" }, \n"
|
||||
" \"ERROR_AVOCADO_WRONG_VOCBASE_PATH\" : { \"code\" : 1201, \"message\" : \"wrong path for database\" }, \n"
|
||||
" \"ERROR_AVOCADO_DOCUMENT_NOT_FOUND\" : { \"code\" : 1202, \"message\" : \"document not found\" }, \n"
|
||||
|
|
|
@ -98,7 +98,8 @@ findOrCreateCollectionByName = function (name) {
|
|||
|
||||
if (col === null) {
|
||||
col = internal.db._create(name);
|
||||
} else if (!(col instanceof AvocadoCollection)) {
|
||||
}
|
||||
else if (!(col instanceof AvocadoCollection)) {
|
||||
throw "<" + name + "> must be a document collection";
|
||||
}
|
||||
|
||||
|
@ -118,7 +119,8 @@ findOrCreateEdgeCollectionByName = function (name) {
|
|||
|
||||
if (col === null) {
|
||||
col = internal.edges._create(name);
|
||||
} else if (!(col instanceof AvocadoEdgesCollection)) {
|
||||
}
|
||||
else if (!(col instanceof AvocadoEdgesCollection)) {
|
||||
throw "<" + name + "> must be a document collection";
|
||||
}
|
||||
|
||||
|
@ -162,7 +164,8 @@ function Edge(graph, id) {
|
|||
if (props) {
|
||||
// extract the custom identifier, label, edges
|
||||
this._properties = props;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// deleted
|
||||
throw "accessing a deleted edge";
|
||||
}
|
||||
|
@ -354,13 +357,16 @@ Edge.prototype._PRINT = function (seen, path, names) {
|
|||
|
||||
if (!this._id) {
|
||||
internal.output("[deleted Edge]");
|
||||
} else if (this._properties.$id !== undefined) {
|
||||
}
|
||||
else if (this._properties.$id !== undefined) {
|
||||
if (typeof this._properties.$id === "string") {
|
||||
internal.output("Edge(\"", this._properties.$id, "\")");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
internal.output("Edge(", this._properties.$id, ")");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
internal.output("Edge(<", this._id, ">)");
|
||||
}
|
||||
};
|
||||
|
@ -397,7 +403,8 @@ function Vertex(graph, id) {
|
|||
if (props) {
|
||||
// extract the custom identifier
|
||||
this._properties = props;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// deleted
|
||||
throw "accessing a deleted edge";
|
||||
}
|
||||
|
@ -544,7 +551,8 @@ Vertex.prototype.getInEdges = function () {
|
|||
|
||||
if (arguments.length === 0) {
|
||||
result = this.inbound();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
labels = {};
|
||||
|
||||
for (i = 0; i < arguments.length; ++i) {
|
||||
|
@ -583,7 +591,8 @@ Vertex.prototype.getOutEdges = function () {
|
|||
|
||||
if (arguments.length === 0) {
|
||||
result = this.outbound();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
labels = {};
|
||||
for (i = 0; i < arguments.length; ++i) {
|
||||
labels[arguments[i]] = true;
|
||||
|
@ -766,13 +775,16 @@ Vertex.prototype._PRINT = function (seen, path, names) {
|
|||
|
||||
if (!this._id) {
|
||||
internal.output("[deleted Vertex]");
|
||||
} else if (this._properties.$id !== undefined) {
|
||||
}
|
||||
else if (this._properties.$id !== undefined) {
|
||||
if (typeof this._properties.$id === "string") {
|
||||
internal.output("Vertex(\"", this._properties.$id, "\")");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
internal.output("Vertex(", this._properties.$id, ")");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
internal.output("Vertex(<", this._id, ">)");
|
||||
}
|
||||
};
|
||||
|
@ -862,11 +874,14 @@ function Graph(name, vertices, edges) {
|
|||
if (edges === null) {
|
||||
throw "edge collection '" + graphProperties.edges + "' has vanished";
|
||||
}
|
||||
} else if (typeof vertices !== "string" || vertices === "") {
|
||||
}
|
||||
else if (typeof vertices !== "string" || vertices === "") {
|
||||
throw "<vertices> must be a string or null";
|
||||
} else if (typeof edges !== "string" || edges === "") {
|
||||
}
|
||||
else if (typeof edges !== "string" || edges === "") {
|
||||
throw "<edges> must be a string or null";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Create a new graph or get an existing graph
|
||||
vertices = findOrCreateCollectionByName(vertices);
|
||||
edges = findOrCreateEdgeCollectionByName(edges);
|
||||
|
@ -895,10 +910,12 @@ function Graph(name, vertices, edges) {
|
|||
'name' : name });
|
||||
|
||||
graphProperties = gdb.document(graphPropertiesId);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw "found graph but has different <name>";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (graphProperties.vertices !== vertices._id) {
|
||||
throw "found graph but has different <vertices>";
|
||||
}
|
||||
|
@ -1081,6 +1098,9 @@ Graph.prototype.getVertex = function (id) {
|
|||
catch (e) {
|
||||
vertex = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
vertex = null;
|
||||
}
|
||||
|
||||
return vertex;
|
||||
|
@ -1326,6 +1346,5 @@ exports.Vertex = Vertex;
|
|||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp:
|
||||
// "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// End:
|
||||
|
|
Loading…
Reference in New Issue