Changeset View
Changeset View
Standalone View
Standalone View
docs/api.rst
Show All 24 Lines | - ``swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35`` the PID of a node of | ||||
type revision corresponding to the commit in Linux that merged the | type revision corresponding to the commit in Linux that merged the | ||||
'x86/urgent' branch on 31 December 2017. | 'x86/urgent' branch on 31 December 2017. | ||||
- ``"dir:dir,dir:cnt"`` node types allowing edges from directories to | - ``"dir:dir,dir:cnt"`` node types allowing edges from directories to | ||||
directories nodes, or directories to contents nodes. | directories nodes, or directories to contents nodes. | ||||
- ``"rev:rev,dir:*"`` node types allowing edges from revisions to revisions | - ``"rev:rev,dir:*"`` node types allowing edges from revisions to revisions | ||||
nodes, or from directories nodes. | nodes, or from directories nodes. | ||||
- ``"*:rel"`` node types allowing all edges to releases. | - ``"*:rel"`` node types allowing all edges to releases. | ||||
Timings | |||||
~~~~~~~ | |||||
When configured to do so (see the server's README), the server can provide | |||||
timings metadata in addition to the result: | |||||
- ``traversal``: time in seconds to do the actual graph traversal. | |||||
- ``pid2node``: time in seconds to convert input PID to node id. | |||||
- ``node2pid``: time in seconds to convert output node ids to PIDs. | |||||
Leaves | Leaves | ||||
------ | ------ | ||||
.. http:get:: /graph/leaves/:src | .. http:get:: /graph/leaves/:src | ||||
Performs a graph traversal and returns the leaves of the subgraph rooted at | Performs a graph traversal and returns the leaves of the subgraph rooted at | ||||
the specified source node. | the specified source node. | ||||
:param string src: source node specified as a SWH PID | :param string src: source node specified as a SWH PID | ||||
:query string edges: edges types the traversal can follow; default to | :query string edges: edges types the traversal can follow; default to | ||||
``"*"`` | ``"*"`` | ||||
:query string direction: direction in which graph edges will be followed; | :query string direction: direction in which graph edges will be followed; | ||||
can be either ``forward`` or ``backward``, default to ``forward`` | can be either ``forward`` or ``backward``, default to ``forward`` | ||||
:statuscode 200: success | :statuscode 200: success | ||||
:statuscode 400: invalid query string provided | :statuscode 400: invalid query string provided | ||||
:statuscode 404: starting node cannot be found | :statuscode 404: starting node cannot be found | ||||
.. sourcecode:: http | .. sourcecode:: http | ||||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||||
Content-Type: application/json | Content-Type: application/json | ||||
[ | { | ||||
"result": [ | |||||
"swh:1:cnt:669ac7c32292798644b21dbb5a0dc657125f444d", | "swh:1:cnt:669ac7c32292798644b21dbb5a0dc657125f444d", | ||||
"swh:1:cnt:da4cb28febe66172a9fdf1a235525ae6c00cde1d", | "swh:1:cnt:da4cb28febe66172a9fdf1a235525ae6c00cde1d", | ||||
... | ... | ||||
] | ], | ||||
"meta": { | |||||
"timings": { | |||||
"traversal": 0.002942681, | |||||
"pid2node": 0.000178051, | |||||
"node2pid": 0.000956569 | |||||
} | |||||
} | |||||
} | |||||
Neighbors | Neighbors | ||||
--------- | --------- | ||||
.. http:get:: /graph/neighbors/:src | .. http:get:: /graph/neighbors/:src | ||||
Returns node direct neighbors (linked with exactly one edge) in the graph. | Returns node direct neighbors (linked with exactly one edge) in the graph. | ||||
:param string src: source node specified as a SWH PID | :param string src: source node specified as a SWH PID | ||||
:query string edges: edges types allowed to be listed as neighbors; default | :query string edges: edges types allowed to be listed as neighbors; default | ||||
to ``"*"`` | to ``"*"`` | ||||
:query string direction: direction in which graph edges will be followed; | :query string direction: direction in which graph edges will be followed; | ||||
can be either ``forward`` or ``backward``, default to ``forward`` | can be either ``forward`` or ``backward``, default to ``forward`` | ||||
:statuscode 200: success | :statuscode 200: success | ||||
:statuscode 400: invalid query string provided | :statuscode 400: invalid query string provided | ||||
:statuscode 404: starting node cannot be found | :statuscode 404: starting node cannot be found | ||||
.. sourcecode:: http | .. sourcecode:: http | ||||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||||
Content-Type: application/json | Content-Type: application/json | ||||
[ | { | ||||
"result": [ | |||||
"swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2", | "swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2", | ||||
"swh:1:dir:d198bc9d7a6bcf6db04f476d29314f157507d505", | "swh:1:dir:d198bc9d7a6bcf6db04f476d29314f157507d505", | ||||
... | ... | ||||
] | ], | ||||
"meta": { | |||||
"timings": { | |||||
"traversal": 0.002942681, | |||||
"pid2node": 0.000178051, | |||||
"node2pid": 0.000956569 | |||||
} | |||||
} | |||||
} | |||||
Walk | Walk | ||||
---- | ---- | ||||
.. http:get:: /graph/walk/:src/:dst | .. http:get:: /graph/walk/:src/:dst | ||||
Performs a graph traversal and returns the first found path from source to | Performs a graph traversal and returns the first found path from source to | ||||
destination (final destination node included). | destination (final destination node included). | ||||
Show All 14 Lines | .. http:get:: /graph/walk/:src/:dst | ||||
:statuscode 400: invalid query string provided | :statuscode 400: invalid query string provided | ||||
:statuscode 404: starting node cannot be found | :statuscode 404: starting node cannot be found | ||||
.. sourcecode:: http | .. sourcecode:: http | ||||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||||
Content-Type: application/json | Content-Type: application/json | ||||
[ | { | ||||
"result": [ | |||||
"swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | "swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | ||||
"swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | "swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | ||||
"swh:1:rev:cea92e843e40452c08ba313abc39f59efbb4c29c", | "swh:1:rev:cea92e843e40452c08ba313abc39f59efbb4c29c", | ||||
"swh:1:rev:8d517bdfb57154b8a11d7f1682ecc0f79abf8e02", | "swh:1:rev:8d517bdfb57154b8a11d7f1682ecc0f79abf8e02", | ||||
... | ... | ||||
] | ], | ||||
"meta": { | |||||
"timings": { | |||||
"traversal": 0.002942681, | |||||
"pid2node": 0.000178051, | |||||
"node2pid": 0.000956569 | |||||
} | |||||
} | |||||
} | |||||
Visit | Visit | ||||
----- | ----- | ||||
.. http:get:: /graph/visit/nodes/:src | .. http:get:: /graph/visit/nodes/:src | ||||
.. http:get:: /graph/visit/paths/:src | .. http:get:: /graph/visit/paths/:src | ||||
Performs a graph traversal and returns explored nodes or paths (in the order | Performs a graph traversal and returns explored nodes or paths (in the order | ||||
Show All 11 Lines | .. http:get:: /graph/visit/paths/:src | ||||
:statuscode 404: starting node cannot be found | :statuscode 404: starting node cannot be found | ||||
.. sourcecode:: http | .. sourcecode:: http | ||||
GET /graph/visit/nodes/ | GET /graph/visit/nodes/ | ||||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||||
Content-Type: application/json | Content-Type: application/json | ||||
[ | { | ||||
"result": [ | |||||
"swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | "swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | ||||
"swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | "swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | ||||
... | ... | ||||
"swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961", | "swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961", | ||||
... | ... | ||||
] | ], | ||||
"meta": { | |||||
"timings": { | |||||
"traversal": 0.002942681, | |||||
"pid2node": 0.000178051, | |||||
"node2pid": 0.000956569 | |||||
} | |||||
} | |||||
} | |||||
.. sourcecode:: http | .. sourcecode:: http | ||||
GET /graph/visit/paths/ | GET /graph/visit/paths/ | ||||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||||
Content-Type: application/json | Content-Type: application/json | ||||
[ | { | ||||
"result": [ | |||||
[ | [ | ||||
"swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | "swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | ||||
"swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | "swh:1:rev:52c90f2d32bfa7d6eccd66a56c44ace1f78fbadd", | ||||
... | ... | ||||
], | ], | ||||
[ | [ | ||||
"swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | "swh:1:rev:f39d7d78b70e0f39facb1e4fab77ad3df5c52a35", | ||||
"swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961", | "swh:1:rev:a31e58e129f73ab5b04016330b13ed51fde7a961", | ||||
... | ... | ||||
], | ], | ||||
... | ... | ||||
] | ], | ||||
"meta": { | |||||
"timings" : { | |||||
"traversal": 0.002942681, | |||||
"pid2node": 0.000178051, | |||||
"node2pid": 0.000956569 | |||||
} | |||||
} | |||||
} | |||||
Stats | Stats | ||||
----- | ----- | ||||
.. http:get:: /graph/stats | .. http:get:: /graph/stats | ||||
Returns statistics on the compressed graph. | Returns statistics on the compressed graph. | ||||
Show All 29 Lines |