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

Configure Feed

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

at main 699 B View raw
1// Package systemtenant exports UnsafeCtx which allows to access shards across 2// all tenants. This must only be used for tasks that are not request specific. 3package systemtenant 4 5import ( 6 "context" 7) 8 9type contextKey int 10 11const systemTenantKey contextKey = iota 12 13// WithUnsafeContext taints the context to allow queries across all tenants. 14// Never use this for user requests. 15func WithUnsafeContext(ctx context.Context) context.Context { 16 return context.WithValue(ctx, systemTenantKey, systemTenantKey) 17} 18 19// Is returns true if the context has been marked to allow queries across all 20// tenants. 21func Is(ctx context.Context) bool { 22 _, ok := ctx.Value(systemTenantKey).(contextKey) 23 return ok 24}