Documentation ¶
Index ¶
- Constants
- func NewDefaultAddressTranslator() *defaultAddressTranslator
- func NewDefaultPublicAddressTranslator() *defaultPublicAddressTranslator
- func ParseAddress(addr string) (pubcluster.Address, error)
- type AddrSet
- type AddressProvider
- type AddressTranslator
- type CandidateCluster
- type ChangedCluster
- type Connected
- type ConnectedHandler
- type Connection
- type ConnectionBoundInvocation
- type ConnectionClosed
- type ConnectionClosedHandler
- type ConnectionInvocationFactory
- func (f *ConnectionInvocationFactory) NewConnectionBoundInvocation(message *proto.ClientMessage, conn *Connection, ...) *ConnectionBoundInvocation
- func (f *ConnectionInvocationFactory) NewInvocationOnPartitionOwner(message *proto.ClientMessage, partitionID int32) *invocation.Impl
- func (f *ConnectionInvocationFactory) NewInvocationOnRandomTarget(message *proto.ClientMessage, handler proto.ClientMessageHandler) *invocation.Impl
- func (f *ConnectionInvocationFactory) NewInvocationOnTarget(message *proto.ClientMessage, addr pubcluster.Address) *invocation.Impl
- func (f *ConnectionInvocationFactory) NewMemberBoundInvocation(message *proto.ClientMessage, member *pubcluster.MemberInfo) *MemberBoundInvocation
- type ConnectionInvocationHandler
- type ConnectionInvocationHandlerCreationBundle
- type ConnectionListenerBinder
- type ConnectionManager
- func (m *ConnectionManager) ActiveConnections() []*Connection
- func (m *ConnectionManager) GetConnectionForAddress(addr pubcluster.Address) *Connection
- func (m *ConnectionManager) GetConnectionForPartition(partitionID int32) *Connection
- func (m *ConnectionManager) NextConnectionID() int64
- func (m *ConnectionManager) RandomConnection() *Connection
- func (m *ConnectionManager) Start(ctx context.Context) error
- func (m *ConnectionManager) Stop()
- type ConnectionManagerCreationBundle
- type ConnectionOpened
- type ConnectionOpenedHandler
- type CreationBundle
- type DefaultAddressProvider
- type Disconnected
- type DisconnectedHandler
- type FailoverService
- type Listener
- type MemberBoundInvocation
- type MembersAdded
- type MembersRemoved
- type PartitionService
- func (s *PartitionService) GetPartitionID(keyData *iserialization.Data) (int32, error)
- func (s *PartitionService) GetPartitionOwner(partitionId int32) (types.UUID, bool)
- func (s *PartitionService) PartitionCount() int32
- func (s *PartitionService) Reset()
- func (s *PartitionService) Update(connID int64, partitions []proto.Pair, version int32)
- type PartitionServiceCreationBundle
- type ResponseHandler
- type Service
- func (s *Service) GetMemberByUUID(uuid types.UUID) *pubcluster.MemberInfo
- func (s *Service) MemberAddr(m *pubcluster.MemberInfo) (pubcluster.Address, error)
- func (s *Service) MemberAddrs() []pubcluster.Address
- func (s *Service) RandomDataMember() *pubcluster.MemberInfo
- func (s *Service) RandomDataMemberExcluding(excluded map[pubcluster.Address]struct{}) *pubcluster.MemberInfo
- func (s *Service) RefreshedSeedAddrs(clusterCtx *CandidateCluster) ([]pubcluster.Address, error)
- func (s *Service) Reset()
- type ViewListenerService
Constants ¶
View Source
const ( // EventConnectionOpened is dispatched when a connection to a member is opened. EventConnectionOpened = "internal.cluster.connectionopened" // EventConnectionClosed is dispatched when a connection to a member is closed. EventConnectionClosed = "internal.cluster.connectionclosed" // EventMembersAdded is dispatched when cluster service finds out new members are added to the cluster EventMembersAdded = "internal.cluster.membersadded" // EventMembersAdded is dispatched when cluster service finds out new members are removed from the cluster EventMembersRemoved = "internal.cluster.membersremoved" // EventConnected is dispatched after the very first connection to the cluster or the first connection after client disconnected. EventConnected = "internal.cluster.connected" // EventDisconnected is dispatched when all connections to the cluster are closed. EventDisconnected = "internal.cluster.disconnected" // EventChangedCluster is dispatched when a cluster ID change is detected during reconnection. EventChangedCluster = "internal.cluster.changed" )
Variables ¶
This section is empty.
Functions ¶
func NewDefaultAddressTranslator ¶
func NewDefaultAddressTranslator() *defaultAddressTranslator
func NewDefaultPublicAddressTranslator ¶
func NewDefaultPublicAddressTranslator() *defaultPublicAddressTranslator
func ParseAddress ¶
func ParseAddress(addr string) (pubcluster.Address, error)
Types ¶
type AddrSet ¶
type AddrSet struct {
// contains filtered or unexported fields
}
func NewAddrSet ¶
func NewAddrSet() AddrSet
func (AddrSet) AddAddr ¶
func (a AddrSet) AddAddr(addr pubcluster.Address)
func (AddrSet) AddAddrs ¶
func (a AddrSet) AddAddrs(addrs []pubcluster.Address)
func (AddrSet) Addrs ¶
func (a AddrSet) Addrs() []pubcluster.Address
type AddressProvider ¶
type AddressProvider interface {
Addresses() ([]pubcluster.Address, error)
}
type AddressTranslator ¶
type AddressTranslator interface { // Translate translates the given address to another address Translate(ctx context.Context, address pubcluster.Address) (addr pubcluster.Address, err error) // TranslateMember translates the given member's address to another address TranslateMember(ctx context.Context, member *pubcluster.MemberInfo) (addr pubcluster.Address, err error) }
AddressTranslator is used to resolve private ip address of cloud services.
type CandidateCluster ¶
type CandidateCluster struct { AddressProvider AddressProvider AddressTranslator AddressTranslator Credentials security.Credentials ConnectionStrategy *pubcluster.ConnectionStrategyConfig ClusterName string }
type ChangedCluster ¶
type ChangedCluster struct { }
func NewChangedCluster ¶
func NewChangedCluster() *ChangedCluster
func (*ChangedCluster) EventName ¶
func (c *ChangedCluster) EventName() string
type Connected ¶
type Connected struct {
Addr pubcluster.Address
}
func NewConnected ¶
func NewConnected(addr pubcluster.Address) *Connected
type ConnectedHandler ¶
type ConnectedHandler func(event *Connected)
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) ConnectionID ¶
func (c *Connection) ConnectionID() int64
func (*Connection) Endpoint ¶
func (c *Connection) Endpoint() pubcluster.Address
func (*Connection) LocalAddr ¶
func (c *Connection) LocalAddr() string
func (*Connection) String ¶
func (c *Connection) String() string
type ConnectionBoundInvocation ¶
type ConnectionBoundInvocation struct { *invocation.Impl // contains filtered or unexported fields }
func (*ConnectionBoundInvocation) CanRetry ¶
func (i *ConnectionBoundInvocation) CanRetry(err error) bool
func (*ConnectionBoundInvocation) Connection ¶
func (i *ConnectionBoundInvocation) Connection() *Connection
func (*ConnectionBoundInvocation) SetEventHandler ¶
func (i *ConnectionBoundInvocation) SetEventHandler(handler proto.ClientMessageHandler)
type ConnectionClosed ¶
type ConnectionClosed struct { Conn *Connection Err error }
func NewConnectionClosed ¶
func NewConnectionClosed(conn *Connection, err error) *ConnectionClosed
func (ConnectionClosed) EventName ¶
func (c ConnectionClosed) EventName() string
type ConnectionClosedHandler ¶
type ConnectionClosedHandler func(event *ConnectionClosed)
type ConnectionInvocationFactory ¶
type ConnectionInvocationFactory struct {
// contains filtered or unexported fields
}
func NewConnectionInvocationFactory ¶
func NewConnectionInvocationFactory(config *pubcluster.Config) *ConnectionInvocationFactory
func (*ConnectionInvocationFactory) NewConnectionBoundInvocation ¶
func (f *ConnectionInvocationFactory) NewConnectionBoundInvocation(message *proto.ClientMessage, conn *Connection, handler proto.ClientMessageHandler) *ConnectionBoundInvocation
func (*ConnectionInvocationFactory) NewInvocationOnPartitionOwner ¶
func (f *ConnectionInvocationFactory) NewInvocationOnPartitionOwner(message *proto.ClientMessage, partitionID int32) *invocation.Impl
func (*ConnectionInvocationFactory) NewInvocationOnRandomTarget ¶
func (f *ConnectionInvocationFactory) NewInvocationOnRandomTarget(message *proto.ClientMessage, handler proto.ClientMessageHandler) *invocation.Impl
func (*ConnectionInvocationFactory) NewInvocationOnTarget ¶
func (f *ConnectionInvocationFactory) NewInvocationOnTarget(message *proto.ClientMessage, addr pubcluster.Address) *invocation.Impl
func (*ConnectionInvocationFactory) NewMemberBoundInvocation ¶
func (f *ConnectionInvocationFactory) NewMemberBoundInvocation(message *proto.ClientMessage, member *pubcluster.MemberInfo) *MemberBoundInvocation
type ConnectionInvocationHandler ¶
type ConnectionInvocationHandler struct {
// contains filtered or unexported fields
}
func NewConnectionInvocationHandler ¶
func NewConnectionInvocationHandler(bundle ConnectionInvocationHandlerCreationBundle) *ConnectionInvocationHandler
func (*ConnectionInvocationHandler) Invoke ¶
func (h *ConnectionInvocationHandler) Invoke(inv invocation.Invocation) (int64, error)
type ConnectionInvocationHandlerCreationBundle ¶
type ConnectionInvocationHandlerCreationBundle struct { ConnectionManager *ConnectionManager ClusterService *Service Logger ilogger.Logger Config *pubcluster.Config }
func (ConnectionInvocationHandlerCreationBundle) Check ¶
func (b ConnectionInvocationHandlerCreationBundle) Check()
type ConnectionListenerBinder ¶
type ConnectionListenerBinder struct {
// contains filtered or unexported fields
}
func NewConnectionListenerBinder ¶
func NewConnectionListenerBinder( connManager *ConnectionManager, invocationFactory *ConnectionInvocationFactory, requestCh chan<- invocation.Invocation, removeCh chan<- int64, eventDispatcher *event.DispatchService, logger logger.Logger, smart bool) *ConnectionListenerBinder
func (*ConnectionListenerBinder) Add ¶
func (b *ConnectionListenerBinder) Add(ctx context.Context, id types.UUID, add *proto.ClientMessage, remove *proto.ClientMessage, handler proto.ClientMessageHandler) error
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
func NewConnectionManager ¶
func NewConnectionManager(bundle ConnectionManagerCreationBundle) *ConnectionManager
func (*ConnectionManager) ActiveConnections ¶
func (m *ConnectionManager) ActiveConnections() []*Connection
func (*ConnectionManager) GetConnectionForAddress ¶
func (m *ConnectionManager) GetConnectionForAddress(addr pubcluster.Address) *Connection
func (*ConnectionManager) GetConnectionForPartition ¶
func (m *ConnectionManager) GetConnectionForPartition(partitionID int32) *Connection
func (*ConnectionManager) NextConnectionID ¶
func (m *ConnectionManager) NextConnectionID() int64
func (*ConnectionManager) RandomConnection ¶
func (m *ConnectionManager) RandomConnection() *Connection
func (*ConnectionManager) Stop ¶
func (m *ConnectionManager) Stop()
type ConnectionManagerCreationBundle ¶
type ConnectionManagerCreationBundle struct { Logger ilogger.Logger RequestCh chan<- invocation.Invocation ResponseCh chan<- *proto.ClientMessage PartitionService *PartitionService InvocationFactory *ConnectionInvocationFactory ClusterConfig *pubcluster.Config ClusterService *Service SerializationService *iserialization.Service EventDispatcher *event.DispatchService FailoverService *FailoverService FailoverConfig *pubcluster.FailoverConfig ClientName string Labels []string }
func (ConnectionManagerCreationBundle) Check ¶
func (b ConnectionManagerCreationBundle) Check()
type ConnectionOpened ¶
type ConnectionOpened struct {
Conn *Connection
}
func NewConnectionOpened ¶
func NewConnectionOpened(conn *Connection) *ConnectionOpened
func (ConnectionOpened) EventName ¶
func (c ConnectionOpened) EventName() string
type ConnectionOpenedHandler ¶
type ConnectionOpenedHandler func(event *ConnectionOpened)
type CreationBundle ¶
type CreationBundle struct { Logger ilogger.Logger RequestCh chan<- invocation.Invocation InvocationFactory *ConnectionInvocationFactory EventDispatcher *event.DispatchService PartitionService *PartitionService FailoverService *FailoverService Config *pubcluster.Config }
func (CreationBundle) Check ¶
func (b CreationBundle) Check()
type DefaultAddressProvider ¶
type DefaultAddressProvider struct {
// contains filtered or unexported fields
}
func NewDefaultAddressProvider ¶
func NewDefaultAddressProvider(networkConfig *pubcluster.NetworkConfig) *DefaultAddressProvider
func (DefaultAddressProvider) Addresses ¶
func (p DefaultAddressProvider) Addresses() ([]pubcluster.Address, error)
type Disconnected ¶
type Disconnected struct { }
func NewDisconnected ¶
func NewDisconnected() *Disconnected
func (*Disconnected) EventName ¶
func (c *Disconnected) EventName() string
type DisconnectedHandler ¶
type DisconnectedHandler func(event *Disconnected)
type FailoverService ¶
type FailoverService struct {
// contains filtered or unexported fields
}
FailoverService is responsible for cluster failover state and attempts management.
func NewFailoverService ¶
func NewFailoverService(logger ilogger.Logger, maxTries int, rootConfig pubcluster.Config, foConfigs []pubcluster.Config, addrFn addrFun) *FailoverService
func (*FailoverService) Current ¶
func (s *FailoverService) Current() *CandidateCluster
func (*FailoverService) Next ¶
func (s *FailoverService) Next()
type Listener ¶
type Listener interface { ConnectionOpened(connection *Connection) ConnectionClosed(connection *Connection, err error) }
type MemberBoundInvocation ¶
type MemberBoundInvocation struct { *invocation.Impl // contains filtered or unexported fields }
func NewMemberBoundInvocation ¶
func NewMemberBoundInvocation(msg *proto.ClientMessage, member *pubcluster.MemberInfo, deadline time.Time, redoOperation bool) *MemberBoundInvocation
func (*MemberBoundInvocation) CanRetry ¶
func (i *MemberBoundInvocation) CanRetry(err error) bool
type MembersAdded ¶
type MembersAdded struct {
Members []pubcluster.MemberInfo
}
func NewMembersAdded ¶
func NewMembersAdded(members []pubcluster.MemberInfo) *MembersAdded
func (MembersAdded) EventName ¶
func (m MembersAdded) EventName() string
type MembersRemoved ¶
type MembersRemoved struct {
Members []pubcluster.MemberInfo
}
func NewMemberRemoved ¶
func NewMemberRemoved(members []pubcluster.MemberInfo) *MembersRemoved
func (MembersRemoved) EventName ¶
func (m MembersRemoved) EventName() string
type PartitionService ¶
type PartitionService struct {
// contains filtered or unexported fields
}
func NewPartitionService ¶
func NewPartitionService(bundle PartitionServiceCreationBundle) *PartitionService
func (*PartitionService) GetPartitionID ¶
func (s *PartitionService) GetPartitionID(keyData *iserialization.Data) (int32, error)
func (*PartitionService) GetPartitionOwner ¶
func (s *PartitionService) GetPartitionOwner(partitionId int32) (types.UUID, bool)
func (*PartitionService) PartitionCount ¶
func (s *PartitionService) PartitionCount() int32
func (*PartitionService) Reset ¶
func (s *PartitionService) Reset()
type PartitionServiceCreationBundle ¶
type PartitionServiceCreationBundle struct { EventDispatcher *event.DispatchService Logger ilogger.Logger }
func (PartitionServiceCreationBundle) Check ¶
func (b PartitionServiceCreationBundle) Check()
type ResponseHandler ¶
type ResponseHandler func(msg *proto.ClientMessage)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(bundle CreationBundle) *Service
func (*Service) GetMemberByUUID ¶
func (s *Service) GetMemberByUUID(uuid types.UUID) *pubcluster.MemberInfo
func (*Service) MemberAddr ¶
func (s *Service) MemberAddr(m *pubcluster.MemberInfo) (pubcluster.Address, error)
func (*Service) MemberAddrs ¶
func (s *Service) MemberAddrs() []pubcluster.Address
func (*Service) RandomDataMember ¶
func (s *Service) RandomDataMember() *pubcluster.MemberInfo
func (*Service) RandomDataMemberExcluding ¶
func (s *Service) RandomDataMemberExcluding(excluded map[pubcluster.Address]struct{}) *pubcluster.MemberInfo
func (*Service) RefreshedSeedAddrs ¶
func (s *Service) RefreshedSeedAddrs(clusterCtx *CandidateCluster) ([]pubcluster.Address, error)
type ViewListenerService ¶
type ViewListenerService struct {
// contains filtered or unexported fields
}
func NewViewListenerService ¶
func NewViewListenerService(cs *Service, cm *ConnectionManager, dispatcher *event.DispatchService, logger logger.Logger) *ViewListenerService
Source Files ¶
- address_provider.go
- address_translator.go
- client_message.go
- cluster_service.go
- connection.go
- connection_bound_invocation.go
- connection_invocation_handler.go
- connection_listener_binder.go
- connection_listener_interface.go
- connection_manager.go
- connection_strategy.go
- error_codes.go
- events.go
- failover_service.go
- invocation_factory.go
- member_bound_invocation.go
- partition_service.go
- view_listener_service.go
Click to show internal directories.
Click to hide internal directories.