Documentation ¶
Index ¶
- type Client
- func (c *Client) Check(ctx context.Context) error
- func (c *Client) CreateSchema(ctx context.Context, subject string, schema sr.Schema) (sr.SubjectSchema, error)
- func (c *Client) SchemaByID(ctx context.Context, id int) (sr.Schema, error)
- func (c *Client) SchemaBySubjectVersion(ctx context.Context, subject string, version int) (sr.SubjectSchema, error)
- type Registry
- type RegistryWithCheck
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. The client caches schemas by ID, their subject/fingerprint and subject/version. Fingerprints are calculated using the Rabin algorithm.
func NewClient ¶
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 ¶
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.