sourcegraph-indexserver: add GRPC methods for Index and Delete (#933)
Closes SPLF-913
This only affects Sourcegraph.
This adds Index and Delete methods to
sourcegraph-indexserver's GRPC server.
The methods aren't called yet by Sourcegraph.
Notable differences to our current indexing loop:
- IndexOptions are pushed by the client instead of pulled by Zoekt
- A semaphore restricts concurrency
- New ENV `SRC_STOP_INDEXING` stops the "competing" indexing loop. This is just for
testing and will eventually be removed
- The Index method tries to recover a possibly older index from
`indexDir/.trash` first before starting to index
Review:
I recommend reviewing the `.proto` file first, followed by `main.go`
Test plan:
- I did a bunch of manual testing to test the trash recovery and the
semaphore logic. I successfuly triggered index and delete calls to the
GRPC server. I will put the Insomnia collection I used for testing in the ticket.
- New unit tests