org

package
v1.42.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package org provides KV-cached org resolution from gateway-supplied X-Org-Id headers. The trust boundary lives in pkg/auth — this package is the lookup-side cache, separate so callers can bind a KV without pulling in the auth middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(kv KVCache)

Bind wires the KV client. nil disables caching.

func Resolve

func Resolve(ctx context.Context, name string) (*organization.Organization, error)

Resolve loads an organization from a gateway-supplied owner name. It reads-through the KV cache and falls back to GetOrCreate, which auto- provisions the org record on first encounter.

Caller is responsible for providing the right context — typically a request-scoped context.WithTimeout from the handler.

Types

type KVCache

type KVCache interface {
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key string, value string, ttl time.Duration) error
	Delete(ctx context.Context, keys ...string) error
}

KVCache is the minimal interface required for org-id caching. *infra.KVClient satisfies it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL