avroregistry

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package avroregistry provides avro.*Registry implementations that consult an Avro registry through its REST API.

Index

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 New

func New(p Params) (*Registry, error)

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

func (r *Registry) DeleteSubject(ctx context.Context, subject string) error

DeleteSubject deletes the given subject from the registry.

See https://docs.confluent.io/current/schema-registry/develop/api.html#delete--subjects-(string-%20subject)

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.

See https://docs.confluent.io/current/schema-registry/develop/api.html#post--subjects-(string-%20subject)-versions

func (*Registry) Schema

func (r *Registry) Schema(ctx context.Context, subject, version string) (*Schema, error)

Schema gets a specific version of the schema registered under this subject

See https://docs.confluent.io/platform/current/schema-registry/develop/api.html#get--subjects-(string-%20subject)-versions-(versionId-%20version)

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

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

Jump to

Keyboard shortcuts

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