sourcegraph/internal/diskcache/BUILD.bazel
Stefan Hengl c071a715cd
chore(backend): enable diskcache for multi-tenant (#64335)
Unless tenants are enforced, we use the old code path. If they are
enforced:
- zips are stored in `<cache-dir>/tenants/<tenantID>/<key>`
- evict runs globally

I also added another test helper to create tenants with fresh IDs for
every call

## Test plan:
- Updated unit tests
- Manual testing: I verified that unindexed symbol and text search work
and that a `/tenant/1` dir is created in both cache dirs
(`/tmp/searcher-archive` and `/tmp/symbols-cache`).
2024-08-08 13:18:34 +00:00

35 lines
825 B
Python

load("//dev:go_defs.bzl", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "diskcache",
srcs = [
"cache.go",
"context.go",
"observability.go",
"url_mutex.go",
],
importpath = "github.com/sourcegraph/sourcegraph/internal/diskcache",
visibility = ["//:__subpackages__"],
deps = [
"//internal/metrics",
"//internal/observation",
"//internal/tenant",
"//internal/trace",
"//lib/errors",
"@io_opentelemetry_go_otel//attribute",
],
)
go_test(
name = "diskcache_test",
timeout = "short",
srcs = ["cache_test.go"],
embed = [":diskcache"],
deps = [
"//internal/observation",
"//internal/tenant",
"@com_github_stretchr_testify//require",
],
)