Documentation
¶
Index ¶
- type ClientConnection
- type ConnectionPool
- func (cp *ConnectionPool) Close() error
- func (cp *ConnectionPool) GetAllMetrics() map[string]PoolMetrics
- func (cp *ConnectionPool) GetClient(ctx context.Context, serverName string) (*ClientConnection, error)
- func (cp *ConnectionPool) GetMetrics(serverName string) (PoolMetrics, error)
- func (cp *ConnectionPool) HasServer(name string) bool
- func (cp *ConnectionPool) ListServers() []string
- func (cp *ConnectionPool) ListTools(ctx context.Context, serverName string) ([]mcp.Tool, error)
- func (cp *ConnectionPool) RegisterServer(name string, cfg *migrate.ServerConfig)
- func (cp *ConnectionPool) ReturnClient(serverName string, conn *ClientConnection)
- func (cp *ConnectionPool) SendToolRequest(ctx context.Context, serverName string, toolName string, ...) (*mcp.CallToolResult, error)
- func (cp *ConnectionPool) UnregisterServer(name string)
- type PoolConfig
- type PoolMetrics
- type Response
- type ServerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConnection ¶
type ClientConnection struct {
// contains filtered or unexported fields
}
func (*ClientConnection) GetClient ¶
func (c *ClientConnection) GetClient() *client.Client
func (*ClientConnection) IsHealthy ¶
func (c *ClientConnection) IsHealthy() bool
func (*ClientConnection) SetHealthy ¶
func (c *ClientConnection) SetHealthy(healthy bool)
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool(config PoolConfig, logger *slog.Logger) *ConnectionPool
func (*ConnectionPool) Close ¶
func (cp *ConnectionPool) Close() error
func (*ConnectionPool) GetAllMetrics ¶
func (cp *ConnectionPool) GetAllMetrics() map[string]PoolMetrics
func (*ConnectionPool) GetClient ¶
func (cp *ConnectionPool) GetClient(ctx context.Context, serverName string) (*ClientConnection, error)
func (*ConnectionPool) GetMetrics ¶
func (cp *ConnectionPool) GetMetrics(serverName string) (PoolMetrics, error)
func (*ConnectionPool) HasServer ¶
func (cp *ConnectionPool) HasServer(name string) bool
func (*ConnectionPool) ListServers ¶
func (cp *ConnectionPool) ListServers() []string
func (*ConnectionPool) RegisterServer ¶
func (cp *ConnectionPool) RegisterServer(name string, cfg *migrate.ServerConfig)
func (*ConnectionPool) ReturnClient ¶
func (cp *ConnectionPool) ReturnClient(serverName string, conn *ClientConnection)
func (*ConnectionPool) SendToolRequest ¶
func (cp *ConnectionPool) SendToolRequest(ctx context.Context, serverName string, toolName string, args map[string]interface{}) (*mcp.CallToolResult, error)
func (*ConnectionPool) UnregisterServer ¶
func (cp *ConnectionPool) UnregisterServer(name string)
type PoolConfig ¶
type PoolConfig struct {
MaxSize int `yaml:"max_size"`
MaxWaitTime time.Duration `yaml:"max_wait_time"`
IdleTimeout time.Duration `yaml:"idle_timeout"`
HealthCheck time.Duration `yaml:"health_check_interval"`
InitialSize int `yaml:"initial_size"`
}
func DefaultPoolConfig ¶
func DefaultPoolConfig() PoolConfig
type PoolMetrics ¶
type Response ¶
type Response struct {
Result json.RawMessage `json:"result,omitempty"`
ID interface{} `json:"id"`
}
type ServerPool ¶
type ServerPool struct {
// contains filtered or unexported fields
}
func NewServerPool ¶
func NewServerPool(maxSize int, config PoolConfig, logger *slog.Logger) *ServerPool
func (*ServerPool) Close ¶
func (sp *ServerPool) Close() error
func (*ServerPool) GetClient ¶
func (sp *ServerPool) GetClient(ctx context.Context, createFunc func() (*client.Client, error)) (*ClientConnection, error)
func (*ServerPool) GetMetrics ¶
func (sp *ServerPool) GetMetrics() PoolMetrics
func (*ServerPool) ReturnClient ¶
func (sp *ServerPool) ReturnClient(conn *ClientConnection)
Click to show internal directories.
Click to hide internal directories.