Documentation ¶
Index ¶
- Constants
- Variables
- func NewDefaultAddressTranslator() *defaultAddressTranslator
- func ParseAddress(addr string) (*pubcluster.AddressImpl, error)
- type AddrSet
- type AddressProvider
- type AddressTranslator
- type Connected
- type ConnectedHandler
- type Connection
- type ConnectionBoundInvocation
- type ConnectionClosed
- type ConnectionClosedHandler
- type ConnectionInvocationFactory
- func (f *ConnectionInvocationFactory) NewConnectionBoundInvocation(message *proto.ClientMessage, partitionID int32, ...) *ConnectionBoundInvocation
- func (f *ConnectionInvocationFactory) NewInvocationOnPartitionOwner(message *proto.ClientMessage, partitionID int32) invocation.Invocation
- func (f *ConnectionInvocationFactory) NewInvocationOnRandomTarget(message *proto.ClientMessage, handler proto.ClientMessageHandler) invocation.Invocation
- type ConnectionInvocationHandler
- type ConnectionInvocationHandlerCreationBundle
- type ConnectionListenerBinder
- type ConnectionManager
- func (m *ConnectionManager) ActiveConnections() []*Connection
- func (m *ConnectionManager) GetConnectionForAddress(addr *pubcluster.AddressImpl) *Connection
- func (m *ConnectionManager) GetConnectionForPartition(partitionID int32) *Connection
- func (m *ConnectionManager) NextConnectionID() int64
- func (m *ConnectionManager) RandomConnection() *Connection
- func (m *ConnectionManager) Start(timeout time.Duration) error
- func (m *ConnectionManager) Stop()
- type ConnectionManagerCreationBundle
- type ConnectionOpened
- type ConnectionOpenedHandler
- type CreationBundle
- type DefaultAddressProvider
- type Disconnected
- type DisconnectedHandler
- type Listener
- type Member
- 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) Update(connID int64, partitions []proto.Pair, version int32)
- type PartitionServiceCreationBundle
- type ResponseHandler
- type Service
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" )
Variables ¶
View Source
var ClientVersion = "1.0.0"
ClientVersion is the build time version TODO: This should be replace with a build time version variable, BuildInfo etc.
Functions ¶
func NewDefaultAddressTranslator ¶
func NewDefaultAddressTranslator() *defaultAddressTranslator
func ParseAddress ¶
func ParseAddress(addr string) (*pubcluster.AddressImpl, 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.AddressImpl)
func (AddrSet) AddAddrs ¶
func (a AddrSet) AddAddrs(addrs []*pubcluster.AddressImpl)
func (AddrSet) Addrs ¶
func (a AddrSet) Addrs() []*pubcluster.AddressImpl
type AddressProvider ¶
type AddressProvider interface {
Addresses() []*pubcluster.AddressImpl
}
type AddressTranslator ¶
type AddressTranslator interface { // Translate translates the given address to another address specific // to network or service Translate(address *pubcluster.AddressImpl) *pubcluster.AddressImpl }
AddressTranslator is used to resolve private ip address of cloud services.
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) 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, partitionID int32, address *pubcluster.AddressImpl, conn *Connection, handler proto.ClientMessageHandler) *ConnectionBoundInvocation
func (*ConnectionInvocationFactory) NewInvocationOnPartitionOwner ¶
func (f *ConnectionInvocationFactory) NewInvocationOnPartitionOwner(message *proto.ClientMessage, partitionID int32) invocation.Invocation
func (*ConnectionInvocationFactory) NewInvocationOnRandomTarget ¶
func (f *ConnectionInvocationFactory) NewInvocationOnRandomTarget(message *proto.ClientMessage, handler proto.ClientMessageHandler) invocation.Invocation
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) 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(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.AddressImpl) *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 { RequestCh chan<- invocation.Invocation ResponseCh chan<- *proto.ClientMessage Logger ilogger.Logger ClusterService *Service PartitionService *PartitionService SerializationService *iserialization.Service EventDispatcher *event.DispatchService InvocationFactory *ConnectionInvocationFactory ClusterConfig *pubcluster.Config Credentials security.Credentials ClientName 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 Config *pubcluster.Config RequestCh chan<- invocation.Invocation InvocationFactory *ConnectionInvocationFactory EventDispatcher *event.DispatchService PartitionService *PartitionService AddrProviders []AddressProvider }
func (CreationBundle) Check ¶
func (b CreationBundle) Check()
type DefaultAddressProvider ¶
type DefaultAddressProvider struct {
// contains filtered or unexported fields
}
func NewDefaultAddressProvider ¶
func NewDefaultAddressProvider(networkConfig *pubcluster.Config) *DefaultAddressProvider
func (DefaultAddressProvider) Addresses ¶
func (p DefaultAddressProvider) Addresses() []*pubcluster.AddressImpl
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 Listener ¶
type Listener interface { ConnectionOpened(connection *Connection) ConnectionClosed(connection *Connection, err error) }
type Member ¶
type Member struct {
// contains filtered or unexported fields
}
func NewMember ¶
func NewMember(address pubcluster.Address, uuid types.UUID, isLiteMember bool, attributes map[string]string, version pubcluster.MemberVersion, addressMap map[pubcluster.EndpointQualifier]pubcluster.Address) *Member
func (Member) Address ¶
func (m Member) Address() pubcluster.Address
func (Member) Attributes ¶
func (*Member) HasSameAddress ¶
func (Member) LiteMember ¶
type MembersAdded ¶
type MembersAdded struct {
Members []pubcluster.Member
}
func NewMembersAdded ¶
func NewMembersAdded(members []pubcluster.Member) *MembersAdded
func (MembersAdded) EventName ¶
func (m MembersAdded) EventName() string
type MembersRemoved ¶
type MembersRemoved struct {
Members []pubcluster.Member
}
func NewMemberRemoved ¶
func NewMemberRemoved(members []pubcluster.Member) *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
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 NewServiceImpl ¶
func NewServiceImpl(bundle CreationBundle) *Service
func (*Service) GetMemberByUUID ¶
func (s *Service) GetMemberByUUID(uuid types.UUID) pubcluster.Member
func (*Service) MemberAddrs ¶
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
- events.go
- invocation_factory.go
- member.go
- partition_service.go
Click to show internal directories.
Click to hide internal directories.