register

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 13 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.

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