etcdclient

package
v0.0.0-...-76450e6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EtcdDefaultNode         = "http://127.0.0.1:2379"
	EtcdDefaultConfigPrefix = "/KitexConfig"
	EtcdDefaultTimeout      = 5 * time.Second
	EtcdClientDefaultPath   = "/{{.ClientServiceName}}/{{.ServerServiceName}}"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	String() string
}

type ConfigParser

type ConfigParser interface {
	Decode(data []byte, config *EtcdConfig) error
}

type Connection

type Connection struct {
	Method         string        `mapstructure:"Method"`
	LongConnection IdleConfig    `mapstructure:"LongConnection"`
	MuxConnection  MuxConnection `mapstructure:"MuxConnection"`
}

type EndpointBasicInfo

type EndpointBasicInfo struct {
	ServiceName string            `mapstructure:"ServiceName"`
	Method      string            `mapstructure:"Method"`
	Tags        map[string]string `mapstructure:"Tags"`
}

type EtcdClientSuite

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

func (*EtcdClientSuite) Options

func (s *EtcdClientSuite) Options() []client.Option

Options return a list client.Option

type EtcdConfig

type EtcdConfig struct {
	ClientBasicInfo *EndpointBasicInfo `mapstructure:"ClientBasicInfo"`
	HostPorts       []string           `mapstructure:"HostPorts"`
	DestService     *string            `mapstructure:"DestService"`
	Protocol        *string            `mapstructure:"Protocol"`
	Connection      *Connection        `mapstructure:"Connection"`
	MyConfig        Config             `mapstructure:"MyConfig"`
}

func (*EtcdConfig) String

func (c *EtcdConfig) String() string

type EtcdLoader

type EtcdLoader struct {
	ClientServiceName string
	ServerServiceName string
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(clientServiceName, serverServiceName string, reader *EtcdReader, myTranslators ...Translator) (*EtcdLoader, error)

func (*EtcdLoader) GetSuite

func (l *EtcdLoader) GetSuite() *EtcdClientSuite

func (*EtcdLoader) Load

func (l *EtcdLoader) Load() error

type EtcdReader

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

func NewReader

func NewReader(opts ReaderOptions) (*EtcdReader, error)

func (*EtcdReader) GetConfig

func (r *EtcdReader) GetConfig() (*EtcdConfig, error)

func (*EtcdReader) ReadToConfig

func (r *EtcdReader) ReadToConfig(p *Path) error

func (*EtcdReader) SetDecoder

func (r *EtcdReader) SetDecoder(decoder ConfigParser) error

type IdleConfig

type IdleConfig struct {
	MinIdlePerAddress int    `mapstructure:"MinIdlePerAddress"`
	MaxIdlePerAddress int    `mapstructure:"MaxIdlePerAddress"`
	MaxIdleGlobal     int    `mapstructure:"MaxIdleGlobal"`
	MaxIdleTimeout    string `mapstructure:"MaxIdleTimeout"`
}

type Loader

type Loader interface {
	Load() error
	GetSuite() EtcdClientSuite
}

type MuxConnection

type MuxConnection struct {
	ConnNum int `mapstructure:"ConnNum"`
}

type Path

type Path struct {
	ClientServiceName string
	ServerServiceName string
}

type Protocol

type Protocol int

Protocol indicates the transport protocol.

const (
	PurePayload Protocol = 0

	TTHeader Protocol = 1 << iota
	Framed
	HTTP
	GRPC
	HESSIAN2

	TTHeaderFramed = TTHeader | Framed
)

Predefined transport protocols.

type Reader

type Reader interface {
	SetDecoder(decoder ConfigParser) error
	ReadToConfig(p *Path) error
	GetConfig() (*EtcdConfig, error)
}

type ReaderOptions

type ReaderOptions struct {
	Node         []string
	Prefix       string
	PathFormat   string
	Timeout      time.Duration
	ConfigParser ConfigParser
	MyConfig     Config
}

Options etcd config options. All the fields have default value.

type Translator

type Translator func(config *EtcdConfig) ([]kitexclient.Option, error)

Jump to

Keyboard shortcuts

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