gfdiscov

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LeaseTTL int64 = 10

Functions

func BuildEtcdTarget

func BuildEtcdTarget(endpoints []string, key string) string

BuildEtcdTarget returns a string that represents the given endpoints with etcd schema.

Types

type EtcdClient

type EtcdClient interface {
	ActiveConnection() *grpc.ClientConn
	Close() error
	Ctx() context.Context
	Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
	Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error)
	KeepAlive(ctx context.Context, id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)
	Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
	Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan
}

EtcdClient interface represents an etcd client.

func NewEtcdCli

func NewEtcdCli(endpoints []string) (EtcdClient, error)

type EtcdConf

type EtcdConf struct {
	Hosts              []string
	Key                string
	ID                 int64  `json:",optional"`
	User               string `json:",optional"`
	Pass               string `json:",optional"`
	CertFile           string `json:",optional"`
	CertKeyFile        string `json:",optional=CertFile"`
	CACertFile         string `json:",optional=CertFile"`
	InsecureSkipVerify bool   `json:",optional"`
}

EtcdConf is the config item with the given key on etcd.

func (EtcdConf) HasAccount

func (c EtcdConf) HasAccount() bool

HasAccount returns if account provided.

func (EtcdConf) HasID

func (c EtcdConf) HasID() bool

HasID returns if ID provided.

func (EtcdConf) HasTLS

func (c EtcdConf) HasTLS() bool

HasTLS returns if TLS CertFile/CertKeyFile/CACertFile are provided.

func (EtcdConf) Validate

func (c EtcdConf) Validate() error

Validate validates c.

type EtcdRegistry

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

func NewEtcdRegistry

func NewEtcdRegistry(etcdConf EtcdConf, listenOn string) *EtcdRegistry

func (*EtcdRegistry) Register

func (e *EtcdRegistry) Register() error

type EtcdResolver

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

func NewEtcdResolver

func NewEtcdResolver() *EtcdResolver

func (*EtcdResolver) Build

func (*EtcdResolver) Scheme

func (e *EtcdResolver) Scheme() string

Jump to

Keyboard shortcuts

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