1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
Willi Goesgens 2015-02-12 17:27:27 +01:00
commit 2022df6aad
29 changed files with 385 additions and 126 deletions

View File

@ -82,7 +82,7 @@
host = host.split(":");
if (host === 'localhost') {
host = '127.0.0.1'
host = '127.0.0.1';
}
param.hostname = host[0];
@ -93,7 +93,7 @@
param.hostname = window.location.hostname;
if (param.hostname === 'localhost') {
param.hostname = '127.0.0.1'
param.hostname = '127.0.0.1';
}
param.port = window.location.port;

View File

@ -319,32 +319,54 @@ function outboundExpander (config, vertex, path) {
var datasource = config.datasource;
var connections = [ ];
var outEdges = datasource.getOutEdges(vertex);
var edgeIterator;
if (outEdges.length > 1 && config.sort) {
outEdges.sort(config.sort);
}
outEdges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getInVertex(edge);
}
else {
// optimization to save vertex lookups
v = { _id: datasource.getEdgeTo(edge) };
v._key = v._id.split("/")[1];
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getInVertex(edge);
connections.push({ edge: edge, vertex: v });
}
catch (e) {
// continue even in the face of non-existing documents
}
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getInVertex(edge);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeTo(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeTo(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
outEdges.forEach(edgeIterator);
return connections;
}
@ -361,27 +383,50 @@ function inboundExpander (config, vertex, path) {
if (inEdges.length > 1 && config.sort) {
inEdges.sort(config.sort);
}
var edgeIterator;
inEdges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getOutVertex(edge);
}
else {
// optimization to save vertex lookups
v = { _id: datasource.getEdgeFrom(edge) };
v._key = v._id.split("/")[1];
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getOutVertex(edge);
connections.push({ edge: edge, vertex: v });
}
catch (e) {
// continue even in the face of non-existing documents
}
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getOutVertex(edge);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
inEdges.forEach(edgeIterator);
return connections;
}
@ -399,34 +444,55 @@ function anyExpander (config, vertex, path) {
edges.sort(config.sort);
}
edges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getPeerVertex(edge, vertex);
}
else {
// optimization to save vertex lookups
v = { };
if (datasource.getEdgeFrom(edge) === vertex._id) {
v._id = datasource.getEdgeTo(edge);
v._key = v._id.split("/")[1];
var edgeIterator;
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getPeerVertex(edge);
connections.push({ edge: edge, vertex: v });
}
else if (datasource.getEdgeTo(edge) === vertex._id) {
v._id = datasource.getEdgeFrom(edge);
v._key = v._id.split("/")[1];
catch (e) {
// continue even in the face of non-existing documents
}
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getPeerVertex(edge);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
if (id === vertex._id) {
id = datasource.getEdgeTo(edge);
}
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
if (id === vertex._id) {
id = datasource.getEdgeTo(edge);
}
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
edges.forEach(edgeIterator);
return connections;
}
@ -1307,7 +1373,7 @@ ArangoTraverser = function (config) {
filter: null,
expander: outboundExpander,
datasource: null,
maxIterations: 1000000,
maxIterations: 10000000,
minDepth: 0,
maxDepth: 256,
buildVertices: true

View File

@ -318,32 +318,54 @@ function outboundExpander (config, vertex, path) {
var datasource = config.datasource;
var connections = [ ];
var outEdges = datasource.getOutEdges(vertex);
var edgeIterator;
if (outEdges.length > 1 && config.sort) {
outEdges.sort(config.sort);
}
outEdges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getInVertex(edge);
}
else {
// optimization to save vertex lookups
v = { _id: datasource.getEdgeTo(edge) };
v._key = v._id.split("/")[1];
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getInVertex(edge);
connections.push({ edge: edge, vertex: v });
}
catch (e) {
// continue even in the face of non-existing documents
}
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getInVertex(edge);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeTo(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeTo(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
outEdges.forEach(edgeIterator);
return connections;
}
@ -360,27 +382,50 @@ function inboundExpander (config, vertex, path) {
if (inEdges.length > 1 && config.sort) {
inEdges.sort(config.sort);
}
var edgeIterator;
inEdges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getOutVertex(edge);
}
else {
// optimization to save vertex lookups
v = { _id: datasource.getEdgeFrom(edge) };
v._key = v._id.split("/")[1];
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getOutVertex(edge);
connections.push({ edge: edge, vertex: v });
}
catch (e) {
// continue even in the face of non-existing documents
}
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getOutVertex(edge);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
inEdges.forEach(edgeIterator);
return connections;
}
@ -398,34 +443,55 @@ function anyExpander (config, vertex, path) {
edges.sort(config.sort);
}
edges.forEach(function (edge) {
try {
var v;
if (config.buildVertices) {
v = datasource.getPeerVertex(edge, vertex);
}
else {
// optimization to save vertex lookups
v = { };
if (datasource.getEdgeFrom(edge) === vertex._id) {
v._id = datasource.getEdgeTo(edge);
v._key = v._id.split("/")[1];
var edgeIterator;
if (config.buildVertices) {
if (!config.expandFilter) {
edgeIterator = function(edge) {
try {
var v = datasource.getPeerVertex(edge, vertex);
connections.push({ edge: edge, vertex: v });
}
else if (datasource.getEdgeTo(edge) === vertex._id) {
v._id = datasource.getEdgeFrom(edge);
v._key = v._id.split("/")[1];
catch (e) {
// continue even in the face of non-existing documents
}
}
if (! config.expandFilter || config.expandFilter(config, v, edge, path)) {
};
} else {
edgeIterator = function(edge) {
try {
var v = datasource.getPeerVertex(edge, vertex);
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
}
catch (e) {
// continue even in the face of non-existing documents
}
};
}
} else {
if (!config.expandFilter) {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
if (id === vertex._id) {
id = datasource.getEdgeTo(edge);
}
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
connections.push({ edge: edge, vertex: v });
}
};
} else {
edgeIterator = function(edge) {
var id = datasource.getEdgeFrom(edge);
if (id === vertex._id) {
id = datasource.getEdgeTo(edge);
}
var v = { _id: id, _key: id.substr(id.indexOf("/") + 1)};
if (config.expandFilter(config, v, edge, path)) {
connections.push({ edge: edge, vertex: v });
}
};
}
catch (e) {
// continue even in the face of non-existing documents
}
});
}
edges.forEach(edgeIterator);
return connections;
}
@ -1306,7 +1372,7 @@ ArangoTraverser = function (config) {
filter: null,
expander: outboundExpander,
datasource: null,
maxIterations: 1000000,
maxIterations: 10000000,
minDepth: 0,
maxDepth: 256,
buildVertices: true

View File

@ -0,0 +1,3 @@
'use strict';
throw new Error('This is an error from the controller.');

View File

@ -0,0 +1,7 @@
{
"name": "broken-controller-file",
"version": "0.0.0",
"controllers": {
"/": "broken-controller.js"
}
}

View File

@ -0,0 +1,3 @@
'use strict';
throw new Error('This is an error from the exports.');

View File

@ -0,0 +1,7 @@
{
"name": "broken-exports-file",
"version": "0.0.0",
"exports": {
"broken": "broken-exports.js"
}
}

View File

@ -0,0 +1,3 @@
'use strict';
throw new Error('This is an error from the setup.');

View File

@ -0,0 +1,5 @@
{
"name": "broken-setup-file",
"version": "0.0.0",
"setup": "broken-setup.js"
}

View File

@ -0,0 +1,3 @@
{
"missing required fields": "name and version"
}

View File

@ -0,0 +1,3 @@
'use strict';
syntax error

View File

@ -0,0 +1,7 @@
{
"name": "malformed-controller-file",
"version": "0.0.0",
"controllers": {
"/": "broken-controller.js"
}
}

View File

@ -0,0 +1,3 @@
'use strict';
// this space left blank

View File

@ -0,0 +1,7 @@
{
"name": "malformed-controller-name",
"version": "0.0.0",
"controllers": {
"?": "controller.js"
}
}

View File

@ -0,0 +1,7 @@
{
"name": "malformed-controller-path",
"version": "0.0.0",
"controllers": {
"/": "/illegal/file/name/"
}
}

View File

@ -0,0 +1,3 @@
'use strict';
syntax error

View File

@ -0,0 +1,7 @@
{
"name": "malformed-exports-file",
"version": "0.0.0",
"exports": {
"broken": "broken-exports.js"
}
}

View File

@ -0,0 +1,7 @@
{
"name": "malformed-exports-path",
"version": "0.0.0",
"exports": {
"broken": "/illegal/file/name/"
}
}

View File

@ -0,0 +1,5 @@
{
"name": "malformed-manifest",
"version": "0.0.0",
"there is a syntax error here": sic!
}

View File

@ -0,0 +1,4 @@
{
"name": "/malformed/name/",
"version": "0.0.0"
}

View File

@ -0,0 +1,3 @@
'use strict';
syntax error

View File

@ -0,0 +1,5 @@
{
"name": "malformed-setup-file",
"version": "0.0.0",
"setup": "broken-setup.js"
}

View File

@ -0,0 +1,5 @@
{
"name": "malformed-setup-path",
"version": "0.0.0",
"setup": "/illegal/file/name/"
}

View File

@ -0,0 +1,4 @@
{
"name": "malformed-version",
"version": "0/0/0"
}

View File

@ -0,0 +1,4 @@
{
"name": "minimal-working-manifest",
"version": "0.0.0"
}

View File

@ -0,0 +1,7 @@
{
"name": "missing-controller-file",
"version": "0.0.0",
"controllers": {
"/": "does-not-exist.js"
}
}

View File

@ -0,0 +1,7 @@
{
"name": "missing-exports-file",
"version": "0.0.0",
"exports": {
"nope": "no-such-file.js"
}
}

View File

@ -0,0 +1,5 @@
{
"name": "missing-setup-file",
"version": "0.0.0",
"setup": "this-file-is-missing.js"
}

View File

@ -0,0 +1,3 @@
{
"manifest": "missing"
}