Documentation ¶
Index ¶
- Constants
- type CallPropertiesProvider
- type Connection
- type ConnectionDesc
- type ConnectionPool
- type ConnectionPropertiesProvider
- type ConnectionStatus
- type ConnectionStatusKind
- type ConnectionTag
- type ConnectionsMap
- type DefaultConnectionProps
- type GRPCClient
- func (c *GRPCClient) ConnStatusChannel() *dllist.ListItem[StatusSub]
- func (c *GRPCClient) DialOptions(ctx context.Context) ([]grpc.DialOption, error)
- func (c *GRPCClient) GetStableConnection(ctx context.Context) (*grpc.ClientConn, error)
- func (c *GRPCClient) Reconnect(ctx context.Context) (*grpc.ClientConn, error)
- func (c *GRPCClient) Tag(ctx context.Context) (ConnectionTag, error)
- func (c *GRPCClient) Validate(l, r *ConnectionTag) bool
- type GRPCClientInterface
- type StatusSub
Constants ¶
View Source
const (
)Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallPropertiesProvider ¶
type CallPropertiesProvider interface {
CallOptions(context.Context) []grpc.CallOption
}
type Connection ¶
type Connection struct { Tag ConnectionTag Connection ConnectionDesc // contains filtered or unexported fields }
NOTE: Mutex `mx` is used by value here, so no copying is allowed
func (*Connection) Disconnect ¶
func (uc *Connection) Disconnect() error
func (*Connection) IsConnected ¶
func (uc *Connection) IsConnected() bool
func (*Connection) String ¶
func (uc *Connection) String() string
type ConnectionDesc ¶
type ConnectionDesc = *grpc.ClientConn
type ConnectionPool ¶
type ConnectionPool interface { GetStableConnection(context.Context) (*grpc.ClientConn, error) Reconnect(context.Context) (*grpc.ClientConn, error) }
type ConnectionPropertiesProvider ¶
type ConnectionPropertiesProvider interface { DialOptions(context.Context) ([]grpc.DialOption, error) Tag(context.Context) (ConnectionTag, error) Validate(*ConnectionTag, *ConnectionTag) bool }
type ConnectionStatus ¶
type ConnectionStatus struct { Kind ConnectionStatusKind Attempt int }
func (*ConnectionStatus) IsConnected ¶
func (cs *ConnectionStatus) IsConnected() bool
func (*ConnectionStatus) IsConnecting ¶
func (cs *ConnectionStatus) IsConnecting() bool
type ConnectionStatusKind ¶
type ConnectionStatusKind string
const ( Connected ConnectionStatusKind = "connected" ConnectionAttempt ConnectionStatusKind = "connection-attempt" )
type ConnectionTag ¶
type ConnectionTag struct { Key string UserData interface{} }
type ConnectionsMap ¶
type ConnectionsMap map[string]*Connection
type DefaultConnectionProps ¶
type DefaultConnectionProps struct{}
NOTE: This struct implements `ConnectionPropertiesProvider`
func (*DefaultConnectionProps) DialOptions ¶
func (dcp *DefaultConnectionProps) DialOptions(_ context.Context) ([]grpc.DialOption, error)
func (*DefaultConnectionProps) Tag ¶
func (dcp *DefaultConnectionProps) Tag(ctx context.Context) (ConnectionTag, error)
func (*DefaultConnectionProps) Validate ¶
func (dcp *DefaultConnectionProps) Validate(prev, next *ConnectionTag) bool
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
func New ¶
func New( log logrus.FieldLogger, addr string, connProps ConnectionPropertiesProvider, r *retries.Retries, ) (*GRPCClient, error)
func (*GRPCClient) ConnStatusChannel ¶
func (c *GRPCClient) ConnStatusChannel() *dllist.ListItem[StatusSub]
func (*GRPCClient) DialOptions ¶
func (c *GRPCClient) DialOptions(ctx context.Context) ([]grpc.DialOption, error)
func (*GRPCClient) GetStableConnection ¶
func (c *GRPCClient) GetStableConnection(ctx context.Context) ( *grpc.ClientConn, error, )
func (*GRPCClient) Reconnect ¶
func (c *GRPCClient) Reconnect(ctx context.Context) (*grpc.ClientConn, error)
func (*GRPCClient) Tag ¶
func (c *GRPCClient) Tag(ctx context.Context) (ConnectionTag, error)
func (*GRPCClient) Validate ¶
func (c *GRPCClient) Validate(l, r *ConnectionTag) bool
type GRPCClientInterface ¶
type GRPCClientInterface interface { ConnectionPropertiesProvider CallPropertiesProvider // NOTE: This method returns Droppable list item, making its clients able to // subscribe for connection related events ConnStatusChannel() *dllist.ListItem[StatusSub] }
type StatusSub ¶
type StatusSub = *dchannel.DynamicChannel[ConnectionStatus]
Click to show internal directories.
Click to hide internal directories.