avro

package
Version: v0.0.0-...-95d107b Latest Latest
Warning

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

Go to latest
Published: May 13, 2016 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

README

go-kafka-avro

go-kafka-avro implements Avro encoding and decoding compatible with Confluent Schema Registry.

Installation

Install go 1.4 (or higher) http://golang.org/doc/install

$ go get github.com/elodina/go-kafka-avro

Documentation

Index

Constants

View Source
const (
	GET_SCHEMA_BY_ID             = "/schemas/ids/%d"
	GET_SUBJECTS                 = "/subjects"
	GET_SUBJECT_VERSIONS         = "/subjects/%s/versions"
	GET_SPECIFIC_SUBJECT_VERSION = "/subjects/%s/versions/%s"
	REGISTER_NEW_SCHEMA          = "/subjects/%s/versions"
	CHECK_IS_REGISTERED          = "/subjects/%s"
	TEST_COMPATIBILITY           = "/compatibility/subjects/%s/versions/%s"
	CONFIG                       = "/config"
)
View Source
const (
	SCHEMA_REGISTRY_V1_JSON               = "application/vnd.schemaregistry.v1+json"
	SCHEMA_REGISTRY_V1_JSON_WEIGHTED      = "application/vnd.schemaregistry.v1+json"
	SCHEMA_REGISTRY_MOST_SPECIFIC_DEFAULT = "application/vnd.schemaregistry.v1+json"
	SCHEMA_REGISTRY_DEFAULT_JSON          = "application/vnd.schemaregistry+json"
	SCHEMA_REGISTRY_DEFAULT_JSON_WEIGHTED = "application/vnd.schemaregistry+json qs=0.9"
	JSON                                  = "application/json"
	JSON_WEIGHTED                         = "application/json qs=0.5"
	GENERIC_REQUEST                       = "application/octet-stream"
)

Variables

Functions

This section is empty.

Types

type CachedSchemaRegistryClient

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

func NewCachedSchemaRegistryClient

func NewCachedSchemaRegistryClient(registryURL string) *CachedSchemaRegistryClient

func (*CachedSchemaRegistryClient) GetByID

func (this *CachedSchemaRegistryClient) GetByID(id int32) (avro.Schema, error)

func (*CachedSchemaRegistryClient) GetLatestSchemaMetadata

func (this *CachedSchemaRegistryClient) GetLatestSchemaMetadata(subject string) (*SchemaMetadata, error)

func (*CachedSchemaRegistryClient) GetVersion

func (this *CachedSchemaRegistryClient) GetVersion(subject string, schema avro.Schema) (int32, error)

func (*CachedSchemaRegistryClient) Register

func (this *CachedSchemaRegistryClient) Register(subject string, schema avro.Schema) (int32, error)

type CompatibilityLevel

type CompatibilityLevel string
const (
	BackwardCompatibilityLevel CompatibilityLevel = "BACKWARD"
	ForwardCompatibilityLevel  CompatibilityLevel = "FORWARD"
	FullCompatibilityLevel     CompatibilityLevel = "FULL"
	NoneCompatibilityLevel     CompatibilityLevel = "NONE"
)

type ErrorMessage

type ErrorMessage struct {
	Error_code int32
	Message    string
}

func (*ErrorMessage) Error

func (this *ErrorMessage) Error() string

type GetSchemaResponse

type GetSchemaResponse struct {
	Schema string
}

type GetSubjectVersionResponse

type GetSubjectVersionResponse struct {
	Subject string
	Version int32
	Id      int32
	Schema  string
}

type KafkaAvroDecoder

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

func NewKafkaAvroDecoder

func NewKafkaAvroDecoder(url string) *KafkaAvroDecoder

func (*KafkaAvroDecoder) Decode

func (this *KafkaAvroDecoder) Decode(bytes []byte) (interface{}, error)

func (*KafkaAvroDecoder) DecodeSpecific

func (this *KafkaAvroDecoder) DecodeSpecific(bytes []byte, value interface{}) error

type KafkaAvroEncoder

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

func NewKafkaAvroEncoder

func NewKafkaAvroEncoder(url string) *KafkaAvroEncoder

func (*KafkaAvroEncoder) Encode

func (this *KafkaAvroEncoder) Encode(obj interface{}) ([]byte, error)

type RegisterSchemaResponse

type RegisterSchemaResponse struct {
	Id int32
}

type SchemaMetadata

type SchemaMetadata struct {
	Id      int32
	Version int32
	Schema  string
}

type SchemaRegistryClient

type SchemaRegistryClient interface {
	Register(subject string, schema avro.Schema) (int32, error)
	GetByID(id int32) (avro.Schema, error)
	GetLatestSchemaMetadata(subject string) (*SchemaMetadata, error)
	GetVersion(subject string, schema avro.Schema) (int32, error)
}

Jump to

Keyboard shortcuts

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