swh.graph.http_rpc_server module#
A proxy HTTP server for swh-graph, talking to the Rust code via the gRPC API.
- class swh.graph.http_rpc_server.GraphServerApp(*args, middlewares=(), **kwargs)[source]#
- Bases: - Application
- class swh.graph.http_rpc_server.GraphView(*args, **kwargs)[source]#
- Bases: - View- Base class for views working on the graph, with utility functions - get_return_types()[source]#
- Validate HTTP query parameter ‘return types’, i.e, a set of types which we will filter the query results with 
 - get_max_matching_nodes()[source]#
- Validate HTTP query parameter max_matching_nodes, i.e., number of results 
 
- class swh.graph.http_rpc_server.StreamingGraphView(*args, **kwargs)[source]#
- Bases: - GraphView- Base class for views streaming their response line by line. - content_type = 'text/plain'#
 - async prepare_response()[source]#
- This can be overridden with some setup to be run before the response actually starts streaming. 
 
- class swh.graph.http_rpc_server.StatsView(*args, **kwargs)[source]#
- Bases: - GraphView- View showing some statistics on the graph 
- class swh.graph.http_rpc_server.SimpleTraversalView(*args, **kwargs)[source]#
- Bases: - StreamingGraphView- Base class for views of simple traversals 
- class swh.graph.http_rpc_server.LeavesView(*args, **kwargs)[source]#
- Bases: - SimpleTraversalView
- class swh.graph.http_rpc_server.NeighborsView(*args, **kwargs)[source]#
- Bases: - SimpleTraversalView
- class swh.graph.http_rpc_server.VisitNodesView(*args, **kwargs)[source]#
- Bases: - SimpleTraversalView
- class swh.graph.http_rpc_server.VisitEdgesView(*args, **kwargs)[source]#
- Bases: - SimpleTraversalView
- class swh.graph.http_rpc_server.CountView(*args, **kwargs)[source]#
- Bases: - GraphView- Base class for counting views. 
- swh.graph.http_rpc_server.make_app(config=None)[source]#
- Create an aiohttp server for the HTTP RPC frontend to the swh-graph API. - It may either connect to an existing grpc server (cls=”remote”) or spawn a local grpc server (cls=”local”). - configis expected to be a dict like:- graph: cls: "local" grpc_server: port: 50091 http_rpc_server: debug: true - or: - graph: cls: "remote" url: "localhost:50091" http_rpc_server: debug: true - See: - swh.graph.grpc_serverfor more details of the content of the grpc_server section,
- GraphServerAppclass for more details of the content of the http_rpc_server section.