etcdv3

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/24
  • Time: 下午3:41

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/26
  • Time: 下午7:34

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/25
  • Time: 下午8:44

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2020/5/20
  • Time: 4:01 下午

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/18
  • Time: 下午4:32

*

  • @api post etcdservice. *
  • User: yunshengzhu
  • Date: 2019-07-24
  • Time: 21:39

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/19
  • Time: 上午11:08

*

  • @api post etcdservice. *
  • User: yunshengzhu
  • Date: 2019-07-31
  • Time: 15:45

*

  • @api post etcdservice. *
  • User: yunshengzhu
  • Date: 2019-07-31
  • Time: 14:36

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2022/7/23
  • Time: 16:58

*

  • @api post etcdv3. *
  • User: yunshengzhu
  • Date: 2021/12/25
  • Time: 下午5:41

Index

Constants

View Source
const (
	BasePath      = "/etcd-v3"
	NamespacePath = "namespace"
	Registry      = "registry"
	ConfigPath    = "config"
	KvDataPath    = "kv-data"
)

Variables

View Source
var Namespace string

Functions

func Del added in v0.0.17

func Del(etcd *Etcd, key string) (err error)

func Get added in v0.0.17

func Get(etcd *Etcd, key string) (*mvccpb.KeyValue, error)

func KvDel

func KvDel(etcd *Etcd, key string) (err error)

func KvGet

func KvGet(etcd *Etcd, key string) (response *clientv3.GetResponse, err error)

func KvPut

func KvPut(etcd *Etcd, key, val string) error

func LoadConfig

func LoadConfig(etcd *Etcd, key string, fn func([]byte)) error

func NewResolver

func NewResolver(etcd *Etcd, service string) resolver.Builder

func NewRpcConn added in v0.0.9

func NewRpcConn(ctx context.Context, scheme, service string, opts []grpc.DialOption) (*grpc.ClientConn, error)

func Put added in v0.0.17

func Put(etcd *Etcd, key, val string, ttl int64) error

Types

type Application added in v0.0.17

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

func NewApplication added in v0.0.17

func NewApplication(etcd *Etcd, namespace string) Application

func (*Application) Gets added in v0.0.17

func (c *Application) Gets(key string) ([]ApplicationData, error)

func (*Application) LastKey added in v0.0.17

func (c *Application) LastKey(str string) string

func (*Application) LastTwoKey added in v0.0.17

func (c *Application) LastTwoKey(str string) string

type ApplicationAsc added in v0.0.56

type ApplicationAsc []ApplicationData

func (ApplicationAsc) Len added in v0.0.56

func (I ApplicationAsc) Len() int

func (ApplicationAsc) Less added in v0.0.56

func (I ApplicationAsc) Less(i, j int) bool

func (ApplicationAsc) Swap added in v0.0.56

func (I ApplicationAsc) Swap(i, j int)

type ApplicationData added in v0.0.17

type ApplicationData struct {
	Name string `json:"name"`
	Num  int    `json:"num"`
	List []Node `json:"list"`
}

type Auth added in v0.0.22

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

func NewAuth added in v0.0.22

func NewAuth(etcd *Etcd) *Auth

func (*Auth) AuthSetupRoot added in v0.0.22

func (a *Auth) AuthSetupRoot(user User) error

func (*Auth) CloseAuth added in v0.0.46

func (a *Auth) CloseAuth() error

func (*Auth) CreateUserRole added in v0.0.22

func (a *Auth) CreateUserRole(username, password string) error

func (*Auth) DelUserRole added in v0.0.23

func (a *Auth) DelUserRole(username string) error

func (*Auth) OpenAuth added in v0.0.46

func (a *Auth) OpenAuth() error

type AuthorizedPath added in v0.0.22

type AuthorizedPath struct {
	Path    string
	PathEnd string
	Type    clientv3.PermissionType
}

func GetAuthPaths added in v0.0.22

func GetAuthPaths(namespace string) []AuthorizedPath

type Config added in v0.0.17

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

func NewConfig added in v0.0.17

func NewConfig(etcd *Etcd, namespace string) Config

func (*Config) Del added in v0.0.17

func (c *Config) Del(key string) error

func (*Config) Get added in v0.0.17

func (c *Config) Get(key string) (ConfigData, error)

func (*Config) Gets added in v0.0.17

func (c *Config) Gets(key string) ([]ConfigData, error)

func (*Config) Set added in v0.0.17

func (c *Config) Set(key, val, desc string) error

type ConfigData added in v0.0.17

type ConfigData struct {
	Key        string `json:"key"`
	Val        string `json:"val"`
	UpdateTime string `json:"updateTime"`
	Desc       string `json:"desc"`
}

type Etcd added in v0.0.3

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

func NewEtcd added in v0.0.3

func NewEtcd(endpoints []string, username, password, namespace string, ttl int64, tlsConfig *TlsConfig) (*Etcd, error)

func (*Etcd) Close added in v0.0.3

func (e *Etcd) Close() error

type EtcdMutex

type EtcdMutex struct {
	Ttl int64  //租约时间
	Key string //etcd的key
	// contains filtered or unexported fields
}

func NewEtcdMutex

func NewEtcdMutex(etcd *Etcd, ttl int64, key string) (*EtcdMutex, error)

func (*EtcdMutex) Lock

func (em *EtcdMutex) Lock() error

func (*EtcdMutex) UnLock

func (em *EtcdMutex) UnLock()

type MonitoringApp added in v0.0.70

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

func NewMonitoringApp added in v0.0.70

func NewMonitoringApp(etcd *Etcd, namespace string, fix string, online, offline func([]byte), apps func(string, *clientv3.GetResponse)) *MonitoringApp

func (*MonitoringApp) Watch added in v0.0.70

func (app *MonitoringApp) Watch()

type NamespaceData added in v0.0.18

type NamespaceData struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	Secret    string `json:"secret"`
	DingTalk  struct {
		Token string `json:"token"`
		Key   string `json:"key"`
	} `json:"dingTalk"`
	Services []string `json:"services"`
}

type Namespaces added in v0.0.18

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

func NewNamespace added in v0.0.18

func NewNamespace(etcd *Etcd) *Namespaces

func (*Namespaces) Create added in v0.0.18

func (n *Namespaces) Create(data NamespaceData) error

func (*Namespaces) Del added in v0.0.18

func (n *Namespaces) Del(namespace string) error

func (*Namespaces) Get added in v0.0.74

func (n *Namespaces) Get(namespace string) (r NamespaceData, err error)

func (*Namespaces) List added in v0.0.18

func (n *Namespaces) List() (list []NamespaceData, err error)

type Node added in v0.0.62

type Node struct {
	Address string `json:"address"`
	RegTime string `json:"regTime"`
}

type Resolver

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

func (*Resolver) Build

func (r *Resolver) Build(target resolver.Target, clientConn resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error)

func (*Resolver) Close

func (r *Resolver) Close()

func (*Resolver) ResolveNow

func (r *Resolver) ResolveNow(rn resolver.ResolveNowOptions)

func (*Resolver) Scheme

func (r *Resolver) Scheme() string

type Service added in v0.0.3

type Service struct {
	ServiceInfo ServiceInfo

	Etcd *Etcd
	// contains filtered or unexported fields
}

func NewService added in v0.0.3

func NewService(etcd *Etcd, info ServiceInfo) (service *Service, err error)

func (*Service) Start added in v0.0.3

func (s *Service) Start() (err error)

func (*Service) Stop added in v0.0.3

func (s *Service) Stop()

type ServiceDiscovery added in v0.0.3

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

func NewServiceDiscovery added in v0.0.3

func NewServiceDiscovery(etcd *Etcd) (*ServiceDiscovery, error)

func (*ServiceDiscovery) DelServices added in v0.0.3

func (s *ServiceDiscovery) DelServices(key string)

func (*ServiceDiscovery) GetServices added in v0.0.3

func (s *ServiceDiscovery) GetServices() []string

func (*ServiceDiscovery) SetServices added in v0.0.3

func (s *ServiceDiscovery) SetServices(key, val string)

func (*ServiceDiscovery) WatchService added in v0.0.3

func (s *ServiceDiscovery) WatchService(prefix string) error

type ServiceInfo added in v0.0.3

type ServiceInfo struct {
	Name       string    `json:"name"`
	Address    string    `json:"address"`
	CreateTime time.Time `json:"createTime"`
}

服务信息

type ServiceRegister added in v0.0.3

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

func NewServiceRegister added in v0.0.3

func NewServiceRegister(endpoints []string, key, val string, lease int64, dialTimeout int) (*ServiceRegister, error)

func (*ServiceRegister) Close added in v0.0.3

func (s *ServiceRegister) Close() error

func (*ServiceRegister) ListenLeaseRespChan added in v0.0.3

func (s *ServiceRegister) ListenLeaseRespChan()

type TlsConfig added in v0.0.3

type TlsConfig struct {
	TlsStatus bool
	CertPath  string
	KeyPath   string
	CaPath    string
}

type User added in v0.0.22

type User struct {
	Name     string
	Password string
	Role     string
}

Jump to

Keyboard shortcuts

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