avroturf

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

avroturf-go

avroturf-go is a library for the Apache Avro serialization format. This library is intended to be a very partial port of AvroTurf.

Usage

Please refer integration_test.go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTPClient httpClient
View Source
var Logger *log.Logger

Functions

This section is empty.

Types

type CachedConfluentSchemaRegistry

type CachedConfluentSchemaRegistry struct {
	Upstream *ConfluentSchemaRegistry
	Cache    *InMemoryCache
}

func (*CachedConfluentSchemaRegistry) FetchSchema

func (r *CachedConfluentSchemaRegistry) FetchSchema(schemaID uint32) (avro.Schema, error)

func (*CachedConfluentSchemaRegistry) Register

func (r *CachedConfluentSchemaRegistry) Register(subject string, schema avro.Schema) (uint32, error)

type ConfluentSchemaRegistry

type ConfluentSchemaRegistry struct {
	RegistryURL string
}

func (*ConfluentSchemaRegistry) FetchSchema

func (r *ConfluentSchemaRegistry) FetchSchema(schemaID uint32) (avro.Schema, error)

func (*ConfluentSchemaRegistry) Register

func (r *ConfluentSchemaRegistry) Register(subject string, schema avro.Schema) (uint32, error)

type InMemoryCache

type InMemoryCache struct {
	SchemasByID             map[uint32]avro.Schema
	IdsBySchema             map[string]uint32
	SchemasBySubjectVersion map[string]avro.Schema
}

func NewInMemoryCache

func NewInMemoryCache() *InMemoryCache

func (*InMemoryCache) LookupIdBySchema

func (c *InMemoryCache) LookupIdBySchema(subject string, schema avro.Schema) uint32

func (*InMemoryCache) LookupSchemaByID

func (c *InMemoryCache) LookupSchemaByID(schemaID uint32) avro.Schema

func (*InMemoryCache) StoreIdBySchema

func (c *InMemoryCache) StoreIdBySchema(subject string, schema avro.Schema, schemaID uint32) uint32

func (*InMemoryCache) StoreSchemaByID

func (c *InMemoryCache) StoreSchemaByID(schemaID uint32, schema avro.Schema) avro.Schema

type Messaging

type Messaging struct {
	sync.Mutex
	NameSpace   string
	SchemaStore *SchemaStore
	Registry    SchemaRegistry
	SchemasByID map[uint32]avro.Schema
}

func NewMessaging

func NewMessaging(namespace string, path string, registryURL string) *Messaging

func (*Messaging) Decode

func (m *Messaging) Decode(data []byte, obj interface{}) error

func (*Messaging) DecodeByLocalSchema

func (m *Messaging) DecodeByLocalSchema(data []byte, obj interface{}, schemaName string, namespace string) error

func (*Messaging) Encode

func (m *Messaging) Encode(obj interface{}, subject string, schemaName string, namespace string) ([]byte, error)

func (*Messaging) EncodeByLocalSchema

func (m *Messaging) EncodeByLocalSchema(obj interface{}, schemaName string, namespace string, schemaID uint32) ([]byte, error)

func (*Messaging) GetRecordSchema

func (m *Messaging) GetRecordSchema(data []byte) (*avro.RecordSchema, error)

func (*Messaging) GetSchema

func (m *Messaging) GetSchema(data []byte) (avro.Schema, error)

func (*Messaging) RegisterSchema

func (m *Messaging) RegisterSchema(subject string, schemaName string, namespace string) (uint32, avro.Schema, error)

type SchemaRegistry

type SchemaRegistry interface {
	FetchSchema(schemaID uint32) (avro.Schema, error)
	Register(subject string, schema avro.Schema) (uint32, error)
}

type SchemaStore

type SchemaStore struct {
	sync.Mutex
	Path string
	// contains filtered or unexported fields
}

func NewSchemaStore

func NewSchemaStore(path string) *SchemaStore

func (*SchemaStore) Find

func (store *SchemaStore) Find(schemaName string, namespace string) (avro.Schema, error)

Directories

Path Synopsis
Package mock_avroturf is a generated GoMock package.
Package mock_avroturf is a generated GoMock package.

Jump to

Keyboard shortcuts

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