apiserver

package
v1.13.8 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 4 Imported by: 9

README

API Server

Documentation

Index

Constants

View Source
const (
	DiscoverAccess    string = "discover"
	RegisterAccess    string = "register"
	HealthcheckAccess string = "healthcheck"
)

Variables

View Source
var (
	Slots = make(map[string]Apiserver)
)

Functions

func GetClientOpenMethod

func GetClientOpenMethod(include []string, protocol string) (map[string]bool, error)

GetClientOpenMethod 获取客户端openMethod

func Register

func Register(name string, server Apiserver) error

Register 注册API服务器

Types

type APIConfig

type APIConfig struct {
	Enable  bool
	Include []string
}

APIConfig API配置

type Apiserver

type Apiserver interface {
	// GetProtocol API协议名
	GetProtocol() string
	// GetPort API的监听端口
	GetPort() uint32
	// Initialize API初始化逻辑
	Initialize(ctx context.Context, option map[string]interface{}, api map[string]APIConfig) error
	// Run API服务的主逻辑循环
	Run(errCh chan error)
	// Stop 停止API端口监听
	Stop()
	// Restart 重启API
	Restart(option map[string]interface{}, api map[string]APIConfig, errCh chan error) error
}

Apiserver API服务器接口

type Config

type Config struct {
	Name   string
	Option map[string]interface{}
	API    map[string]APIConfig
}

Config API服务器配置

Jump to

Keyboard shortcuts

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