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 ¶
const (
// ServiceNamespace the service prefix of ETCD key
ServiceNamespace = "ANT-SRV@"
)
Variables ¶
This section is empty.
Functions ¶
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
ExcludeApi appends apis that must not be registered to etcd.
func (*Service) PostListen ¶ added in v1.1.1
PostListen adds serviceInfo, and starts etcd keep alive.
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