naming

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

README

naming

项目简介

服务发现、服务注册相关的SDK集合

编译环境

  • 请只用 Golang v1.8.x 以上版本编译执行

依赖包

Documentation

Index

Constants

View Source
const (
	MetaColor   = "color"
	MetaWeight  = "weight"
	MetaCluster = "cluster"
	MetaZone    = "zone"
)

metadata common key

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	Build(id string) Resolver
	Scheme() string
}

Builder resolver builder.

type Instance

type Instance struct {
	// Region bj/sh/gz
	Region string `json:"region"`
	// Zone is IDC.
	Zone string `json:"zone"`
	// Env prod/pre、uat/fat1
	Env string `json:"env"`
	// AppID is mapping servicetree appid.
	AppID string `json:"appid"`
	// Hostname is hostname from docker.
	Hostname string `json:"hostname"`
	// Addrs is the adress of app instance
	// format: scheme://host
	Addrs []string `json:"addrs"`
	// Version is publishing version.
	Version string `json:"version"`
	// LastTs is instance latest updated timestamp
	LastTs int64 `json:"latest_timestamp"`
	// Metadata is the information associated with Addr, which may be used
	// to make load balancing decision.
	Metadata map[string]string `json:"metadata"`
	Status   int64
}

Instance represents a server the client connects to.

type Registry

type Registry interface {
	Register(context.Context, *Instance) (context.CancelFunc, error)
	Close() error
}

Registry Register an instance and renew automatically

type Resolver

type Resolver interface {
	Fetch(context.Context) (map[string][]*Instance, bool)
	//Unwatch(id string)
	Watch() <-chan struct{}
	Close() error
}

Resolver resolve naming service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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