cluster

package
v1.0.0-preview.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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 string

func NewAddress

func NewAddress(host string, port int32) Address

func (Address) String

func (a Address) String() string

type Config

type Config struct {
	SecurityConfig       SecurityConfig
	SSLConfig            SSLConfig
	Name                 string
	HazelcastCloudConfig HazelcastCloudConfig
	Addrs                []string
	InvocationTimeout    time.Duration
	HeartbeatInterval    time.Duration
	HeartbeatTimeout     time.Duration
	ConnectionTimeout    time.Duration
	DiscoveryConfig      DiscoveryConfig
	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 DiscoveryConfig

type DiscoveryConfig struct {
	UsePublicIP bool
}

func NewDiscoveryConfig

func NewDiscoveryConfig() DiscoveryConfig

func (DiscoveryConfig) Clone

func (c DiscoveryConfig) Clone() DiscoveryConfig

func (DiscoveryConfig) Validate

func (c DiscoveryConfig) Validate() error

type EndpointQualifier

type EndpointQualifier struct {
	Identifier string
	Type       EndpointQualifierType
}

type EndpointQualifierType

type EndpointQualifierType int32
const (
	EndpointQualifierTypeMember   EndpointQualifierType = 0
	EndpointQualifierTypeClient   EndpointQualifierType = 1
	EndpointQualifierTypeWan      EndpointQualifierType = 2
	EndpointQualifierTypeRest     EndpointQualifierType = 3
	EndpointQualifierTypeMemCache EndpointQualifierType = 4
)

func (EndpointQualifierType) String

func (t EndpointQualifierType) String() string

type HazelcastCloudConfig

type HazelcastCloudConfig struct {
	Token   string
	Enabled bool
}

func NewHazelcastCloudConfig

func NewHazelcastCloudConfig() HazelcastCloudConfig

func (HazelcastCloudConfig) Clone

func (HazelcastCloudConfig) Validate

func (h HazelcastCloudConfig) Validate() error

type MemberInfo

type MemberInfo struct {
	Attributes map[string]string
	AddressMap map[EndpointQualifier]Address
	Address    Address
	UUID       types.UUID
	Version    MemberVersion
	LiteMember bool
}

MemberInfo represents a member in the cluster.

func (*MemberInfo) PublicAddress

func (mi *MemberInfo) PublicAddress() (addr Address, ok bool)

PublicAddress returns the public address and ok == true if member contains a public address.

func (MemberInfo) String

func (mi MemberInfo) String() string

type MemberVersion

type MemberVersion struct {
	Major byte
	Minor byte
	Patch byte
}

MemberVersion is the version of the member

type MembershipState

type MembershipState int
const (
	MembershipStateAdded MembershipState = iota
	MembershipStateRemoved
)

func (MembershipState) String

func (m MembershipState) String() string

type MembershipStateChangeHandler

type MembershipStateChangeHandler func(event MembershipStateChanged)

type MembershipStateChanged

type MembershipStateChanged struct {
	Member MemberInfo
	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