Documentation ¶
Overview ¶
Package schema implements CRUD schema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGRPCResourceNotFound indicates the resource doesn't exist. ErrGRPCResourceNotFound = statusGRPCResourceNotFound.Err() // ErrClosed indicates the registry is closed. ErrClosed = errors.New("metadata registry is closed") )
Functions ¶
func BadRequest ¶
BadRequest creates a gRPC error with error details with type BadRequest, which describes violations in a client request.
Types ¶
type EventHandler ¶
EventHandler allows receiving and handling the resource change events.
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 }
Group allows CRUD groups which is namespaces of resources.
type HasMetadata ¶
HasMetadata allows getting Metadata.
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) }
IndexRule allows CRUD index rule schemas in a group.
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) }
IndexRuleBinding allows CRUD index rule binding schemas in a group.
type Kind ¶
type Kind int
Kind is the type of a resource.
const ( KindGroup Kind = 1 << iota KindStream KindMeasure KindIndexRuleBinding KindIndexRule KindTopNAggregation KindProperty KindNode KindMask = KindGroup | KindStream | KindMeasure | KindIndexRuleBinding | KindIndexRule | KindTopNAggregation | KindProperty | KindNode KindSize = 9 )
KindMask tends to check whether an event is valid.
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) (int64, error) UpdateMeasure(ctx context.Context, measure *databasev1.Measure) (int64, error) DeleteMeasure(ctx context.Context, metadata *commonv1.Metadata) (bool, error) TopNAggregations(ctx context.Context, metadata *commonv1.Metadata) ([]*databasev1.TopNAggregation, error) }
Measure allows CRUD measure schemas in a group.
type Node ¶ added in v0.5.0
type Node interface { ListNode(ctx context.Context, role databasev1.Role) ([]*databasev1.Node, error) RegisterNode(ctx context.Context, node *databasev1.Node, forced bool) error }
Node allows CRUD node schemas in a group.
type Property ¶
type Property interface { GetProperty(ctx context.Context, metadata *propertyv1.Metadata, tags []string) (*propertyv1.Property, error) ListProperty(ctx context.Context, container *commonv1.Metadata, ids []string, tags []string) ([]*propertyv1.Property, error) ApplyProperty(ctx context.Context, property *propertyv1.Property, strategy propertyv1.ApplyRequest_Strategy) (bool, uint32, int64, error) DeleteProperty(ctx context.Context, metadata *propertyv1.Metadata, tags []string) (bool, uint32, error) KeepAlive(ctx context.Context, leaseID int64) error }
Property allows CRUD properties or tags in group.
type Registry ¶
type Registry interface { io.Closer Stream IndexRule IndexRuleBinding Measure Group TopNAggregation Property Node RegisterHandler(string, Kind, EventHandler) }
Registry allowing depositing resources.
func NewEtcdSchemaRegistry ¶
func NewEtcdSchemaRegistry(options ...RegistryOption) (Registry, error)
NewEtcdSchemaRegistry returns a Registry powered by Etcd.
type RegistryOption ¶
type RegistryOption func(*etcdSchemaRegistryConfig)
RegistryOption is the option to create Registry.
func ConfigureServerEndpoints ¶ added in v0.5.0
func ConfigureServerEndpoints(url []string) RegistryOption
ConfigureServerEndpoints sets a list of the server urls.
func Namespace ¶ added in v0.5.0
func Namespace(namespace string) RegistryOption
Namespace sets the namespace of the registry.
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) (int64, error) UpdateStream(ctx context.Context, stream *databasev1.Stream) (int64, error) DeleteStream(ctx context.Context, metadata *commonv1.Metadata) (bool, error) }
Stream allows CRUD stream schemas in a group.
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) }
TopNAggregation allows CRUD top-n aggregation schemas in a group.