schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MeasureKeyPrefix = "/measures/"
	TagTypeID        = "id"
)

Variables

View Source
var (
	ErrGRPCInvalidArgument = statusGRPCInvalidArgument.Err()

	ErrGRPCResourceNotFound = statusGRPCResourceNotFound.Err()

	ErrGRPCAlreadyExists = statusGRPCAlreadyExists.Err()

	ErrGRPCDataLoss = statusDataLoss.Err()
)
View Source
var (
	ErrUnexpectedNumberOfEntities = errors.New("unexpected number of entities")
	ErrConcurrentModification     = errors.New("concurrent modification of entities")
)
View Source
var (
	GroupsKeyPrefix  = "/groups/"
	GroupMetadataKey = "/__meta_group__"
)
View Source
var (
	IndexRuleBindingKeyPrefix = "/index-rule-bindings/"
	IndexRuleKeyPrefix        = "/index-rules/"
)
View Source
var (
	ErrUnsupportedEntityType = errors.New("unsupported entity type")
)
View Source
var PropertyKeyPrefix = "/properties/"
View Source
var StreamKeyPrefix = "/streams/"
View Source
var TopNAggregationKeyPrefix = "/topnagg/"

Functions

func BadRequest

func BadRequest(field, desc string) error

BadRequest creates a gRPC error with error details with type BadRequest, which describes violations in a client request.

func IsNotFound

func IsNotFound(err error) bool

Types

type EventHandler

type EventHandler interface {
	OnAddOrUpdate(Metadata)
	OnDelete(Metadata)
}

type Group

type Group interface {
	GetGroup(ctx context.Context, group string) (*commonv1.Group, error)
	ListGroup(ctx context.Context) ([]*commonv1.Group, error)
	// DeleteGroup delete all items belonging to the group
	DeleteGroup(ctx context.Context, group string) (bool, error)
	CreateGroup(ctx context.Context, group *commonv1.Group) error
	UpdateGroup(ctx context.Context, group *commonv1.Group) error
}

type HasMetadata

type HasMetadata interface {
	GetMetadata() *commonv1.Metadata
	proto.Message
}

type IndexRule

type IndexRule interface {
	GetIndexRule(ctx context.Context, metadata *commonv1.Metadata) (*databasev1.IndexRule, error)
	ListIndexRule(ctx context.Context, opt ListOpt) ([]*databasev1.IndexRule, error)
	CreateIndexRule(ctx context.Context, indexRule *databasev1.IndexRule) error
	UpdateIndexRule(ctx context.Context, indexRule *databasev1.IndexRule) error
	DeleteIndexRule(ctx context.Context, metadata *commonv1.Metadata) (bool, error)
}

type IndexRuleBinding

type IndexRuleBinding interface {
	GetIndexRuleBinding(ctx context.Context, metadata *commonv1.Metadata) (*databasev1.IndexRuleBinding, error)
	ListIndexRuleBinding(ctx context.Context, opt ListOpt) ([]*databasev1.IndexRuleBinding, error)
	CreateIndexRuleBinding(ctx context.Context, indexRuleBinding *databasev1.IndexRuleBinding) error
	UpdateIndexRuleBinding(ctx context.Context, indexRuleBinding *databasev1.IndexRuleBinding) error
	DeleteIndexRuleBinding(ctx context.Context, metadata *commonv1.Metadata) (bool, error)
}

type Kind

type Kind int
const (
	KindGroup Kind = 1 << iota
	KindStream
	KindMeasure
	KindIndexRuleBinding
	KindIndexRule
	KindTopNAggregation
	KindProperty
)

type ListOpt

type ListOpt struct {
	Group string
}

type Measure

type Measure interface {
	GetMeasure(ctx context.Context, metadata *commonv1.Metadata) (*databasev1.Measure, error)
	ListMeasure(ctx context.Context, opt ListOpt) ([]*databasev1.Measure, error)
	CreateMeasure(ctx context.Context, measure *databasev1.Measure) error
	UpdateMeasure(ctx context.Context, measure *databasev1.Measure) error
	DeleteMeasure(ctx context.Context, metadata *commonv1.Metadata) (bool, error)
	RegisterHandler(Kind, EventHandler)
}

type Metadata

type Metadata struct {
	TypeMeta

	// Spec holds the configuration object as a protobuf message
	// Or a metadataHolder as a container
	Spec Spec
}

func (Metadata) Equal

func (m Metadata) Equal(other proto.Message) bool

func (Metadata) Key

func (m Metadata) Key() (string, error)

type Property

type Property interface {
	GetProperty(ctx context.Context, metadata *propertyv1.Metadata) (*propertyv1.Property, error)
	ListProperty(ctx context.Context, container *commonv1.Metadata) ([]*propertyv1.Property, error)
	CreateProperty(ctx context.Context, property *propertyv1.Property) error
	UpdateProperty(ctx context.Context, property *propertyv1.Property) error
	DeleteProperty(ctx context.Context, metadata *propertyv1.Metadata) (bool, error)
}

type Registry

type Registry interface {
	io.Closer
	ReadyNotify() <-chan struct{}
	StopNotify() <-chan struct{}
	StoppingNotify() <-chan struct{}
	Stream
	IndexRule
	IndexRuleBinding
	Measure
	Group
	TopNAggregation
	Property
}

func NewEtcdSchemaRegistry

func NewEtcdSchemaRegistry(options ...RegistryOption) (Registry, error)

type RegistryOption

type RegistryOption func(*etcdSchemaRegistryConfig)

func ConfigureListener

func ConfigureListener(lc, lp string) RegistryOption

func LoggerLevel

func LoggerLevel(loggerLevel string) RegistryOption

func RootDir

func RootDir(rootDir string) RegistryOption

type Spec

type Spec interface {
}

type Stream

type Stream interface {
	GetStream(ctx context.Context, metadata *commonv1.Metadata) (*databasev1.Stream, error)
	ListStream(ctx context.Context, opt ListOpt) ([]*databasev1.Stream, error)
	CreateStream(ctx context.Context, stream *databasev1.Stream) error
	UpdateStream(ctx context.Context, stream *databasev1.Stream) error
	DeleteStream(ctx context.Context, metadata *commonv1.Metadata) (bool, error)
	RegisterHandler(Kind, EventHandler)
}

type TopNAggregation

type TopNAggregation interface {
	GetTopNAggregation(ctx context.Context, metadata *commonv1.Metadata) (*databasev1.TopNAggregation, error)
	ListTopNAggregation(ctx context.Context, opt ListOpt) ([]*databasev1.TopNAggregation, error)
	CreateTopNAggregation(ctx context.Context, measure *databasev1.TopNAggregation) error
	UpdateTopNAggregation(ctx context.Context, measure *databasev1.TopNAggregation) error
	DeleteTopNAggregation(ctx context.Context, metadata *commonv1.Metadata) (bool, error)
}

type TypeMeta

type TypeMeta struct {
	Kind  Kind
	Name  string
	Group string
}

func (TypeMeta) Unmarshal

func (tm TypeMeta) Unmarshal(data []byte) (m proto.Message, err error)

Jump to

Keyboard shortcuts

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