register

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

对外提供 API 用于注册特定 label 对 其他 label 的关系 暂定这个特定 label 的 key 为 "REGISTERED_LABEL".(constant.RegisterLabelKey)

e.g. PUT /dice/eventbox/register/<VALUE> body: {"labels": map[string]string{"<label1>":"<value1>", "<label2>":"<value2>"}}

之后在发送消息的时候,带上 label : {"REGISTERED_LABEL":"<VALUE>"}, 相当于 带上了 上面所注册的所有 labels

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (*registerImpl, error)

Types

type DelRequest

type DelRequest struct {
	Key string `json:"key"`
}

type GetResponseContent

type GetResponseContent map[types.LabelKey]interface{}

type PutRequest

type PutRequest struct {
	Key    string                         `json:"key"`
	Labels map[types.LabelKey]interface{} `json:"labels"`
}

type Register

type Register interface {
	PrefixGet(key string) map[types.LabelKey]map[types.LabelKey]interface{}
	Put(key string, labels map[types.LabelKey]interface{}) error
	Del(key string) error
}

type RegisterHTTP

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

func NewHTTP

func NewHTTP(register Register) *RegisterHTTP

func (*RegisterHTTP) Del

func (r *RegisterHTTP) Del(ctx context.Context, req *http.Request, vars map[string]string) (stypes.Responser, error)

func (*RegisterHTTP) GetHTTPEndPoints

func (r *RegisterHTTP) GetHTTPEndPoints() []stypes.Endpoint

func (*RegisterHTTP) PrefixGet

func (r *RegisterHTTP) PrefixGet(ctx context.Context, req *http.Request, vars map[string]string) (stypes.Responser, error)

func (*RegisterHTTP) Put

func (r *RegisterHTTP) Put(ctx context.Context, req *http.Request, vars map[string]string) (stypes.Responser, error)

Directories

Path Synopsis
default register labels here
default register labels here

Jump to

Keyboard shortcuts

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