api

package
v0.0.0-...-e0f38f0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deregister

func Deregister(req *DeregisterReq) error

Deregister 注销实例

func Register

func Register(req *RegisterReq) error

Register 服务注册

func Renew

func Renew(req *RenewReq) error

Renew 服务刷新

Types

type DeregisterReq

type DeregisterReq struct {
	Token       string `json:"token"`        // Token 令牌
	Namespace   string `json:"namespace"`    // 命名空间
	ServiceName string `json:"service_name"` // 服务名称
	IP          string `json:"ip"`           // 实例IP
}

DeregisterReq 服务注销

type FetchResp

type FetchResp struct {
	Retcode int             `json:"retcode"`
	Errmsg  string          `json:"errmsg"`
	Data    []*InstanceNode `json:"data"`
}

type InstanceNode

type InstanceNode struct {
	IP       string `json:"ip"`       // 实例IP
	Port     int    `json:"port"`     // 端口
	Weight   int    `json:"weight"`   // 权重
	Metadata string `json:"metadata"` // 元数据
}

func Fetch

func Fetch(ns, sname string) ([]*InstanceNode, error)

Fetch 获取服务实例

func Poll

func Poll(ns, sname string) ([]*InstanceNode, error)

Poll 获取服务实例(长轮询)

type RegisterReq

type RegisterReq struct {
	Token       string        `json:"token"`        // Token 令牌
	Namespace   string        `json:"namespace"`    // 命名空间
	ServiceName string        `json:"service_name"` // 服务名称
	Node        *InstanceNode `json:"node"`         // 实例节点
}

RegisterReq 服务注册

type RenewReq

type RenewReq struct {
	Token       string `json:"token"`        // Token 令牌
	Namespace   string `json:"namespace"`    // 命名空间
	ServiceName string `json:"service_name"` // 服务名称
	IP          string `json:"ip"`           // 实例IP
}

RenewReq 服务更新

Jump to

Keyboard shortcuts

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