schema

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const EventTypeSchemaChange = "SCHEMA_CHANGE_EVENT"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(interface{}) (interface{}, bool)
	Set(interface{}, interface{}, int64) bool
}

type ChangeDetectorService added in v0.8.0

type ChangeDetectorService interface {
	IdentifySchemaChange(ctx context.Context, request *changedetector.ChangeRequest) (*stencilv1beta2.SchemaChangedEvent, error)
}

type CompatibilityFn

type CompatibilityFn func(ParsedSchema, []ParsedSchema) error

type Metadata

type Metadata struct {
	Authority     string
	Format        string
	Compatibility string
}

type NamespaceService

type NamespaceService interface {
	Get(ctx context.Context, name string) (namespace.Namespace, error)
}

type NotificationEventRepository added in v0.8.0

type NotificationEventRepository interface {
	Create(ctx context.Context, event changedetector.NotificationEvent) (changedetector.NotificationEvent, error)
	Update(ctx context.Context, Id string, success bool) (changedetector.NotificationEvent, error)
	GetByNameSpaceSchemaVersionAndSuccess(ctx context.Context, namespace string, schemaID int32, versionID string, success bool) (changedetector.NotificationEvent, error)
}

type ParsedSchema

type ParsedSchema interface {
	IsBackwardCompatible(ParsedSchema) error
	IsForwardCompatible(ParsedSchema) error
	IsFullCompatible(ParsedSchema) error
	Format() string
	GetCanonicalValue() *SchemaFile
}

type Producer added in v0.8.0

type Producer interface {
	Write(topic string, protoMessage proto.Message) error
}

type Provider

type Provider interface {
	ParseSchema(format string, data []byte) (ParsedSchema, error)
}

type Repository

type Repository interface {
	Create(ctx context.Context, namespace string, schema string, metadata *Metadata, versionID string, schemaFile *SchemaFile) (version int32, err error)
	List(context.Context, string) ([]Schema, error)
	ListVersions(context.Context, string, string) ([]int32, error)
	Get(context.Context, string, string, int32) ([]byte, error)
	GetLatestVersion(context.Context, string, string) (int32, error)
	GetMetadata(context.Context, string, string) (*Metadata, error)
	UpdateMetadata(context.Context, string, string, *Metadata) (*Metadata, error)
	Delete(context.Context, string, string) error
	DeleteVersion(context.Context, string, string, int32) error
	GetSchemaID(ctx context.Context, ns string, sc string) (int32, error)
}

type Schema

type Schema struct {
	Name          string
	Format        string
	Compatibility string
	Authority     string
}

type SchemaFile

type SchemaFile struct {
	ID     string
	Types  []string
	Fields []string
	Data   []byte
}

type SchemaInfo

type SchemaInfo struct {
	ID       string `json:"id"`
	Version  int32  `json:"version"`
	Location string `json:"location"`
}

type Service

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

func NewService

func NewService(repo Repository, provider Provider, nsSvc NamespaceService,
	cache Cache, nr newrelic.Service, cds ChangeDetectorService,
	producer Producer, config *config.Config, notificationEventRepo NotificationEventRepository) *Service

func (*Service) CheckCompatibility

func (s *Service) CheckCompatibility(ctx context.Context, nsName, schemaName, compatibility string, data []byte) error

func (*Service) Create

func (s *Service) Create(ctx context.Context, nsName string, schemaName string, metadata *Metadata, data []byte) (SchemaInfo, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, namespace string, schemaName string) error

func (*Service) DeleteVersion

func (s *Service) DeleteVersion(ctx context.Context, namespace string, schemaName string, version int32) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, namespace string, schemaName string, version int32) (*Metadata, []byte, error)

func (*Service) GetLatest

func (s *Service) GetLatest(ctx context.Context, namespace string, schemaName string) (*Metadata, []byte, error)

func (*Service) GetMetadata

func (s *Service) GetMetadata(ctx context.Context, namespace, schemaName string) (*Metadata, error)

func (*Service) List

func (s *Service) List(ctx context.Context, namespaceID string) ([]Schema, error)

func (*Service) ListVersions

func (s *Service) ListVersions(ctx context.Context, namespaceID string, schemaName string) ([]int32, error)

func (*Service) UpdateMetadata

func (s *Service) UpdateMetadata(ctx context.Context, namespace, schemaName string, meta *Metadata) (*Metadata, error)

type ValidationStrategy

type ValidationStrategy func(ParsedSchema, ParsedSchema) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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