Documentation
¶
Index ¶
- type Cache
- type MemoryCache
- type Options
- func WithAPIKey(apiKey, headerName string) Options
- func WithBasicAuth(username, password string) Options
- func WithBearerToken(token string) Options
- func WithCache(cache Cache) Options
- func WithCacheRefreshDuration(d time.Duration) Options
- func WithCustomHeader(headerName, headerValue string) Options
- func WithTimeout(d time.Duration) Options
- type SchemaRegistry
- func (r *SchemaRegistry) DeleteSchema(ctx context.Context, req schema_registry.DeleteSchemaRequest) error
- func (r *SchemaRegistry) GetSchema(ctx context.Context, req schema_registry.GetSchemaRequest) (*jsonschema.Schema, bool)
- func (r *SchemaRegistry) RegisterSchema(ctx context.Context, req schema_registry.CreateSchemaRequest) error
- func (r *SchemaRegistry) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Get(ctx context.Context, subject string) (*jsonschema.Schema, bool)
Set(ctx context.Context, subject string, schema *jsonschema.Schema)
Delete(ctx context.Context, subject string)
}
Cache stores compiled schemas fetched from the remote registry, keyed by subject name.
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache is a thread-safe in-memory Cache with TTL-based expiry, keyed by subject name.
func NewMemoryCache ¶
func NewMemoryCache(ttl time.Duration) *MemoryCache
func (*MemoryCache) Get ¶
func (m *MemoryCache) Get(_ context.Context, subject string) (*jsonschema.Schema, bool)
func (*MemoryCache) Set ¶
func (m *MemoryCache) Set(_ context.Context, subject string, schema *jsonschema.Schema)
type Options ¶
type Options func(*remoteRegistryConfig)
func WithAPIKey ¶
WithAPIKey configures API key authentication with a custom header name. If headerName is empty, it defaults to "X-API-Key".
func WithBasicAuth ¶
WithBasicAuth configures basic authentication with username and password.
func WithBearerToken ¶
WithBearerToken configures bearer token authentication.
func WithCustomHeader ¶
WithCustomHeader configures a custom header for authentication.
func WithTimeout ¶
type SchemaRegistry ¶
type SchemaRegistry struct {
// contains filtered or unexported fields
}
SchemaRegistry fetches schemas from a remote schema registry service and caches them locally to reduce latency and network calls.
func NewRemoteSchemaRegistry ¶
func (*SchemaRegistry) DeleteSchema ¶
func (r *SchemaRegistry) DeleteSchema(ctx context.Context, req schema_registry.DeleteSchemaRequest) error
func (*SchemaRegistry) GetSchema ¶
func (r *SchemaRegistry) GetSchema(ctx context.Context, req schema_registry.GetSchemaRequest) (*jsonschema.Schema, bool)
func (*SchemaRegistry) RegisterSchema ¶
func (r *SchemaRegistry) RegisterSchema(ctx context.Context, req schema_registry.CreateSchemaRequest) error
func (*SchemaRegistry) Type ¶
func (r *SchemaRegistry) Type() string
Click to show internal directories.
Click to hide internal directories.