Documentation
¶
Overview ¶
Package avroregistry provides avro.*Registry implementations that consult an Avro registry through its REST API.
Index ¶
- type Params
- type Registry
- func (r *Registry) Decoder() avro.DecodingRegistry
- func (r *Registry) DeleteSubject(ctx context.Context, subject string) error
- func (r *Registry) Encoder(subject string) avro.EncodingRegistry
- func (r *Registry) Register(ctx context.Context, subject string, schema *avro.Type) (_ int64, err error)
- func (r *Registry) Schema(ctx context.Context, subject, version string) (*Schema, error)
- func (r *Registry) SetCompatibility(ctx context.Context, subject string, mode avro.CompatMode) error
- type Schema
- type UnavailableError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Params ¶
type Params struct { // ServerURL holds the URL of the Avro registry server, for example "http://localhost:8084". ServerURL string // RetryStrategy is used when requests are retried after HTTP errors. // If this is nil, a default exponential-backoff strategy is used. RetryStrategy retry.Strategy // Username and Password hold the basic auth credentials to use. // If Userame is empty, no authentication will be sent. Username string Password string }
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry represents an Avro registry server. It implements avro.EncodingRegistry and avro.DecodingRegistry.
func (*Registry) Decoder ¶
func (r *Registry) Decoder() avro.DecodingRegistry
Decoder returns an avro.DecodingRegistry implementation that can be used to decode messages from the registry.
func (*Registry) DeleteSubject ¶
DeleteSubject deletes the given subject from the registry.
func (*Registry) Encoder ¶
func (r *Registry) Encoder(subject string) avro.EncodingRegistry
Encoder returns an avro.EncodingRegistry implementation that can be used to encode messages with schemas associated with the given subject, which must be non-empty.
func (*Registry) Register ¶
func (r *Registry) Register(ctx context.Context, subject string, schema *avro.Type) (_ int64, err error)
Register registers a schema with the registry associated with the given subject and returns its id.
func (*Registry) Schema ¶ added in v0.3.0
Schema gets a specific version of the schema registered under this subject
func (*Registry) SetCompatibility ¶
func (r *Registry) SetCompatibility(ctx context.Context, subject string, mode avro.CompatMode) error
SetCompatibility sets the compatibility mode for the registry's subject to mode.
See https://docs.confluent.io/current/schema-registry/develop/api.html#put--config-(string-%20subject)
type Schema ¶ added in v0.3.0
type Schema struct { // Subject defines the name this schema is registered under Subject string `json:"subject"` // ID globally unique schema identifier ID int64 `json:"id"` // Version is the version of the schema Version int `json:"version"` // Schema is the actual schema in Avro format Schema string `json:"schema"` }
Schema holds the schema metadata and actual schema stored in a Schema registry
type UnavailableError ¶ added in v0.4.5
type UnavailableError struct {
}UnavailableError reports an error when the schema registry is unavailable.
func (*UnavailableError) Error ¶ added in v0.4.5
func (m *UnavailableError) Error() string
Error implements the error interface.
func (*UnavailableError) Unwrap ¶ added in v0.4.5
func (e *UnavailableError) Unwrap() error
Unwrap unwraps and return Cause error. It is needed to properly handle and compare errors.