MCPcopy
hub / github.com/redpanda-data/console / CachedClient

Struct CachedClient

backend/pkg/schema/client.go:46–61  ·  view source on GitHub ↗

CachedClient provides schema management with caching for efficient reuse. It retrieves and parses Avro, Protobuf, and JSON schemas from a Schema Registry, utilizing in-memory caches to minimize redundant fetches and compilations.

Source from the content-addressed store, hash-verified

44// It retrieves and parses Avro, Protobuf, and JSON schemas from a Schema Registry,
45// utilizing in-memory caches to minimize redundant fetches and compilations.
46type CachedClient struct {
47 schemaClientFactory schema.ClientFactory
48 // cacheNamespace returns a unique tenant identifier for resource cache isolation.
49 // Used to generate cache keys like "{namespace}/avro-parsed-schemas/ids/{id}" for
50 // multi-tenant environments where compiled schemas must be isolated per tenant.
51 cacheNamespace func(context.Context) (string, error)
52
53 standardImportsResolver func(protocompile.Resolver) protocompile.Resolver
54
55 schemaCache *cache.Cache[string, sr.Schema]
56 subjectSchemaCache *cache.Cache[string, sr.SubjectSchema]
57
58 avroSchemaCache *cache.Cache[string, *avro.Schema]
59 protoSchemaCache *cache.Cache[string, linker.Files]
60 jsonSchemaCache *cache.Cache[string, *jsonschema.Schema]
61}
62
63// Client defines the interface for a schema client implementation.
64type Client interface {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected