fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

index: inline tenant.SrcPrefix (#955)

It had exactly one call site and the logic was super simple. So I think
it is clearer to just inline the logic here.

Test Plan: mechanical refactor so just CI. In a future PR I will be
adding better test coverage just on this function.

+1 -10
+1 -1
index/builder.go
··· 338 338 339 339 // If tenant enforcement is enabled and we have tenant/repo IDs, use those to generate the prefix 340 340 if o.RepositoryDescription.TenantID != 0 && o.RepositoryDescription.ID != 0 && tenant.EnforceTenant() { 341 - prefix = tenant.SrcPrefix(o.RepositoryDescription.TenantID, o.RepositoryDescription.ID) 341 + prefix = fmt.Sprintf("%09d_%09d", o.RepositoryDescription.TenantID, o.RepositoryDescription.ID) 342 342 } else { 343 343 prefix = o.RepositoryDescription.Name 344 344 }
-9
internal/tenant/shards.go
··· 1 - package tenant 2 - 3 - import "fmt" 4 - 5 - // SrcPrefix returns the Sourcegraph prefix of a shard. We put it here to avoid 6 - // circular dependencies. 7 - func SrcPrefix(tenantID int, repoID uint32) string { 8 - return fmt.Sprintf("%09d_%09d", tenantID, repoID) 9 - }