discovery

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

discovery

A service discovery module implemented by ETCD.

Documentation

Overview

Package discovery is the service discovery module implemented by ETCD.

Copyright 2018 HenryLee. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// ServiceNamespace the service prefix of ETCD key
	ServiceNamespace = "ANT-SRV@"
)

Variables

This section is empty.

Functions

func NewLinker

func NewLinker(etcdConfig etcd.EasyConfig) micro.Linker

NewLinker creates a etct service linker. Note: If etcdConfig.DialTimeout<0, it means unlimit; If etcdConfig.DialTimeout=0, use the default value(15s).

func NewLinkerFromEtcd

func NewLinkerFromEtcd(etcdClient *etcd.Client) micro.Linker

NewLinkerFromEtcd creates a etct service linker.

Types

type Node

type Node struct {
	Addr string
	Info *ServiceInfo
	// contains filtered or unexported fields
}

Node a service node info.

type Service added in v1.1.1

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

Service automatically registered api info to etcd

func ServicePlugin

func ServicePlugin(hostport string, etcdConfig etcd.EasyConfig, excludeApis ...string) *Service

ServicePlugin creates a teleport plugin which automatically registered api info to etcd. Note: excludeApis must not be registered to etcd. If etcdConfig.DialTimeout<0, it means unlimit; If etcdConfig.DialTimeout=0, use the default value(15s).

func ServicePluginFromEtcd

func ServicePluginFromEtcd(hostport string, etcdClient *etcd.Client, excludeApis ...string) *Service

ServicePluginFromEtcd creates a teleport plugin which automatically registered api info to etcd. Note: excludeApis must not be registered to etcd.

func (*Service) ExcludeApi added in v1.1.1

func (s *Service) ExcludeApi(excludeApi ...string)

ExcludeApi appends apis that must not be registered to etcd.

func (*Service) Name added in v1.1.1

func (s *Service) Name() string

Name returns name.

func (*Service) PostListen added in v1.1.1

func (s *Service) PostListen() error

PostListen adds serviceInfo, and starts etcd keep alive.

func (*Service) PostReg added in v1.1.1

func (s *Service) PostReg(handler *tp.Handler) error

PostReg registers URI path.

type ServiceInfo

type ServiceInfo struct {
	UriPaths []string `json:"uri_paths"`
	// contains filtered or unexported fields
}

ServiceInfo serivce info

func (*ServiceInfo) Append

func (s *ServiceInfo) Append(uriPath ...string)

Append appends uri path

func (*ServiceInfo) String

func (s *ServiceInfo) String() string

String returns the JSON string.

Directories

Path Synopsis
etcd package is the [ETCD](https://github.com/coreos/etcd) client v3 mirror.
etcd package is the [ETCD](https://github.com/coreos/etcd) client v3 mirror.

Jump to

Keyboard shortcuts

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