[pkgsite] internal/api, etc.: paginate GetImportedBy

0 views
Skip to first unread message

Jonathan Amsterdam (Gerrit)

unread,
May 11, 2026, 1:28:47 PM (11 hours ago) May 11
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Hyang-Ah Hana Kim, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, golang-co...@googlegroups.com

Jonathan Amsterdam submitted the change

Change information

Commit message:
internal/api, etc.: paginate GetImportedBy

Paginate the GetImportedBy query on the database.

- Add keyset-based start path and limit parameter constraints
toDataSource.GetImportedBy.
'from_path >= $3' makes use of the existing composite primary key
index (to_path, from_path, from_module_path) on imports_unique.

- Restrict the API limit to a maximum of 1000 to protect database
resources.

- Since the tokens can now be arbitrarily long strings, use a
more general encryption technique supporting multiple blocks
to obfuscate them.

One consequence of this work: because a filter may eliminate every
item on a page, we might serve pages with zero items. This is
documented, and it is a feature (for us) because it lets us bound the
work on each query.
Change-Id: Ie9bf8ecfa395a003417d64028d5d0c311dbef561
Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
kokoro-CI: kokoro <noreply...@google.com>
Files:
  • M internal/api/api.go
  • M internal/api/openapi.yaml
  • M internal/api/token.go
  • M internal/api/token_test.go
  • M internal/datasource.go
  • M internal/fetchdatasource/fetchdatasource.go
  • M internal/frontend/imports.go
  • M internal/interfaces.go
  • M internal/postgres/details.go
  • M internal/postgres/details_test.go
  • M internal/testing/fakedatasource/fakedatasource.go
Change size: L
Delta: 11 files changed, 305 insertions(+), 35 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ie9bf8ecfa395a003417d64028d5d0c311dbef561
Gerrit-Change-Number: 776360
Gerrit-PatchSet: 8
Gerrit-Owner: Jonathan Amsterdam <j...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages