Use DGraph as LSIF storage backend
Created by: felixfbecker
PoC to change the storage backend for LSIF data to DGraph.
To try it out, you need to run DGraph, simply follow https://docs.dgraph.io/get-started/
API stays the same.
I recommend reading a bit in the DGraph docs to understand the concepts, but basically everything is a triple <subject> <predicate> <object>
where object is either a scalar or a reference to another entity. Predicates are strings that are globally unique, which is why I prefix all properties with the type name. For this purpose I generated a JSON schema from the protocol.d.ts and wrote a little schema validator that can resolve types (none exist on npm that do this). Also, processing is done streamed.
DGraph is queried with an extended GraphQL and the client speaks GRPC.
LSIF Edges are mapped to edges, objects are recursively mapped to graph structures (properties are edges).
Two type of vertixes are added by us: repositories and commits.
There's a little script too to manually load an LSIF dump into the DB.
I did my best to document the code :)