schemaregistry

package
v0.7.0-nightly.20230617 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a schema registry client that caches schemas. It is safe for concurrent use.

func NewClient

func NewClient(logger log.CtxLogger, opts ...sr.Opt) (*Client, error)

NewClient creates a new client using the provided logger and schema registry client options.

func (*Client) CreateSchema

func (c *Client) CreateSchema(ctx context.Context, subject string, schema sr.Schema) (sr.SubjectSchema, error)

CreateSchema checks if the schema is already registered in the cache and returns the associated sr.SubjectSchema if it is found. Otherwise, the schema is sent to the schema registry and stored in the cache, if the registration was successful.

func (*Client) SchemaByID

func (c *Client) SchemaByID(ctx context.Context, id int) (sr.Schema, error)

SchemaByID checks if the schema is already registered in the cache and returns the associated sr.Schema if it is found. Otherwise, the schema is retrieved from the schema registry and stored in the cache. Note that the returned schema does not contain a subject and version, so the cache will not have an effect on methods that return a sr.SubjectSchema.

func (*Client) SchemaBySubjectVersion

func (c *Client) SchemaBySubjectVersion(ctx context.Context, subject string, version int) (sr.SubjectSchema, error)

SchemaBySubjectVersion checks if the schema is already registered in the cache and returns the associated sr.SubjectSchema if it is found. Otherwise, the schema is retrieved from the schema registry and stored in the cache.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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