Skip to content

blob: Implement new RPC to list blobs via revisions

Patrick Steinhardt requested to merge pks-list-blobs into master

We already have multiple RPCs which request one or more blobs via a revision:

- `GetBlob()` allows to find a single blob via an object ID.

- `GetBlobs()` allows to find blobs via a set of revisions with
  paths. The path is mandatory here, so it's not possible to e.g.
  list all blobs of a given non-treeish object.

- `ListNewBlobs()` is a specialized RPC which lists all blobs
  introduced with a specific revision which were not yet part of the
  repository.

None of these RPCs allow the caller to specify blobs via a set of revisions. This lack of functionality is hurting us in the Rails access checks though: we cannot create a batched check determining all new blobs of all changes at once, but instead need to call ListNewBlobs() for each change separately. Given that it uses --not --all, this is excessively expensive for some repository shapes with lots of references.

In order to not have this access check scale with O(refs * changes), this commit introduces a fourth RPC ListBlobs(). This RPC takes a set of revisions and returns all blobs which are reachable via a graph walk starting from those revisions. In addition to normal revisions, this RPC also allows the pseudo-revisions "--all" and "--not".

This new RPC deprecates ListNewBlobs() given that it's a clear superset of its provided functionality.

Closes #3603 (closed)

Merge request reports