cluster

package
v1.0.0-preview.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultHost = "localhost"
	DefaultPort = 5701
)

Variables

View Source
var ErrConfigInvalidClusterName = errors.New("invalid cluster name")
View Source
var ErrConfigInvalidConnectionTimeout = errors.New("invalid connection timeout")
View Source
var ErrConfigInvalidHeartbeatInterval = errors.New("invalid heartbeat interval")
View Source
var ErrConfigInvalidHeartbeatTimeout = errors.New("invalid heartbeat timeout")
View Source
var ErrConfigInvalidInvocationTimeout = errors.New("invalid invocation timeout")

Functions

This section is empty.

Types

type Address

type Address interface {
	// TODO: remove this interface
	fmt.Stringer
	Host() string
	Port() int
	Clone() Address
}

type AddressImpl

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

func NewAddress

func NewAddress(host string, port int32) *AddressImpl

func NewAddressWithHostPort

func NewAddressWithHostPort(host string, port int) *AddressImpl

TODO: merge this one with NewAddress

func (AddressImpl) Clone

func (a AddressImpl) Clone() Address

func (AddressImpl) Host

func (a AddressImpl) Host() string

func (AddressImpl) Port

func (a AddressImpl) Port() int

func (AddressImpl) String

func (a AddressImpl) String() string

type Config

type Config struct {
	SecurityConfig    SecurityConfig
	Name              string
	SSLConfig         SSLConfig
	Addrs             []string
	HeartbeatInterval time.Duration
	HeartbeatTimeout  time.Duration
	InvocationTimeout time.Duration
	ConnectionTimeout time.Duration
	RedoOperation     bool
	SmartRouting      bool
}

func NewConfig

func NewConfig() Config

func (*Config) Clone

func (c *Config) Clone() Config

func (*Config) SetAddress

func (c *Config) SetAddress(addrs ...string) error

SetAddress sets the candidate address list that client will use to establish initial connection. Other members of the cluster will be discovered when the client starts.

func (*Config) Validate

func (c *Config) Validate() error

type EndpointQualifier

type EndpointQualifier struct {
	Identifier string
	Type       int32
}

type Member

type Member interface {
	fmt.Stringer
	// Addr returns the address of this member.
	Address() Address

	// UUID returns the uuid of this member.
	UUID() types.UUID

	// IsLiteMember returns true if this member is a lite member.
	LiteMember() bool

	// Attributes returns configured attributes for this member.
	Attributes() map[string]string
}

Member represents a member in the cluster with its address, uuid, lite member status and attributes.

type MemberInfo

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

MemberInfo represents a member in the cluster with its address, uuid, lite member status, attributes and version.

func NewMemberInfo

func NewMemberInfo(address Address, uuid types.UUID, attributes map[string]string, liteMember bool, version MemberVersion,
	isAddressMapExists bool, addressMap interface{}) MemberInfo

func (MemberInfo) Address

func (mi MemberInfo) Address() Address

func (MemberInfo) AddressMap

func (mi MemberInfo) AddressMap() map[EndpointQualifier]Address

func (MemberInfo) Attributes

func (mi MemberInfo) Attributes() map[string]string

func (MemberInfo) LiteMember

func (mi MemberInfo) LiteMember() bool

func (MemberInfo) String

func (mi MemberInfo) String() string

func (MemberInfo) UUID

func (mi MemberInfo) UUID() types.UUID

func (MemberInfo) Version

func (mi MemberInfo) Version() MemberVersion

type MemberVersion

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

MemberVersion

func NewMemberVersion

func NewMemberVersion(major, minor, patch byte) MemberVersion

func (MemberVersion) Major

func (memberVersion MemberVersion) Major() byte

func (MemberVersion) Minor

func (memberVersion MemberVersion) Minor() byte

func (MemberVersion) Patch

func (memberVersion MemberVersion) Patch() byte

type MembershipState

type MembershipState int
const (
	MembershipStateAdded MembershipState = iota
	MembershipStateRemoved
)

type MembershipStateChangeHandler

type MembershipStateChangeHandler func(event MembershipStateChanged)

type MembershipStateChanged

type MembershipStateChanged struct {
	Member Member
	State  MembershipState
}

func (*MembershipStateChanged) EventName

func (e *MembershipStateChanged) EventName() string

type SSLConfig

type SSLConfig struct {
	TLSConfig *tls.Config
	Enabled   bool
}

SSLConfig is SSL configuration for client. SSLConfig has tls.Config embedded in it so that users can set any field of tls config as they wish. SSL config also has some helpers such as SetCaPath, AddClientCertAndKeyPath to make configuration easier for users.

func NewSSLConfig

func NewSSLConfig() SSLConfig

func (*SSLConfig) AddClientCertAndEncryptedKeyPath

func (c *SSLConfig) AddClientCertAndEncryptedKeyPath(certPath string, privateKeyPath string, password string) error

AddClientCertAndEncryptedKeyPath decrypts the keyfile with the given password and adds client certificate path and the decrypted client private key to tls config. The files in the given paths must contain PEM encoded data. The key file should have a DEK-info header otherwise an error will be returned. In order to add multiple client certificate-key pairs one should call this function for each of them. If certificates is empty then no certificate will be sent to the server. If this is unacceptable to the server then it may abort the handshake. For mutual authentication at least one client certificate should be added. It returns an error if any of files cannot be loaded.

func (*SSLConfig) AddClientCertAndKeyPath

func (c *SSLConfig) AddClientCertAndKeyPath(clientCertPath string, clientPrivateKeyPath string) error

AddClientCertAndKeyPath adds client certificate path and client private key path to tls config. The files in the given paths must contain PEM encoded data. In order to add multiple client certificate-key pairs one should call this function for each of them. If certificates is empty then no certificate will be sent to the server. If this is unacceptable to the server then it may abort the handshake. For mutual authentication at least one client certificate should be added. It returns an error if any of files cannot be loaded.

func (*SSLConfig) Clone

func (c *SSLConfig) Clone() SSLConfig

func (*SSLConfig) ResetTLSConfig

func (c *SSLConfig) ResetTLSConfig(tlsConfig *tls.Config)

func (*SSLConfig) SetCAPath

func (c *SSLConfig) SetCAPath(path string) error

SetCAPath sets CA file path.

func (*SSLConfig) Validate

func (c *SSLConfig) Validate() error

type SecurityConfig

type SecurityConfig struct {
	Username string
	Password string
}

func NewSecurityConfig

func NewSecurityConfig() SecurityConfig

func (SecurityConfig) Clone

func (c SecurityConfig) Clone() SecurityConfig

func (SecurityConfig) Validate

func (c SecurityConfig) Validate() error

Jump to

Keyboard shortcuts

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