Documentation
¶
Index ¶
- Constants
- type MockValkeyClient
- func (m *MockValkeyClient) Close() error
- func (m *MockValkeyClient) DeleteRoute(ctx context.Context, hostname string) error
- func (m *MockValkeyClient) GetRoute(ctx context.Context, hostname string) (*RouteInfo, error)
- func (m *MockValkeyClient) Ping(ctx context.Context) error
- func (m *MockValkeyClient) Publish(ctx context.Context, channel string, message string) error
- func (m *MockValkeyClient) SetRoute(ctx context.Context, hostname string, route *RouteInfo) error
- func (m *MockValkeyClient) Subscribe(ctx context.Context, channel string, onMessage func(channel, message string)) error
- type RespClient
- func (c *RespClient) Close() error
- func (c *RespClient) DeleteRoute(ctx context.Context, hostname string) error
- func (c *RespClient) GetRoute(ctx context.Context, hostname string) (*RouteInfo, error)
- func (c *RespClient) Ping(ctx context.Context) error
- func (c *RespClient) Publish(ctx context.Context, channel string, message string) error
- func (c *RespClient) SetRoute(ctx context.Context, hostname string, route *RouteInfo) error
- func (c *RespClient) Subscribe(ctx context.Context, channel string, onMessage func(channel, message string)) error
- type RouteInfo
- type ValkeyClient
Constants ¶
const ( // ValkeyChannelRoutingEvents is the pub/sub channel for route broadcasts. ValkeyChannelRoutingEvents = "carbon-panel:routing:events" // ValkeyRouteKeyPrefix is the key prefix for stored routes. ValkeyRouteKeyPrefix = "carbon-panel:routes:" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockValkeyClient ¶
type MockValkeyClient struct {
// contains filtered or unexported fields
}
MockValkeyClient provides an in-memory client for testing or standalone execution.
func NewMockValkeyClient ¶
func NewMockValkeyClient() *MockValkeyClient
NewMockValkeyClient returns an in-memory Valkey client.
func (*MockValkeyClient) Close ¶
func (m *MockValkeyClient) Close() error
Close marks the mock client closed.
func (*MockValkeyClient) DeleteRoute ¶
func (m *MockValkeyClient) DeleteRoute(ctx context.Context, hostname string) error
DeleteRoute removes a route from memory.
func (*MockValkeyClient) Ping ¶
func (m *MockValkeyClient) Ping(ctx context.Context) error
Ping reports whether the mock client is still open.
type RespClient ¶
type RespClient struct {
// contains filtered or unexported fields
}
RespClient implements a lightweight Go-native Redis RESP protocol client.
func NewRespClient ¶
func NewRespClient(addr string, password ...string) *RespClient
NewRespClient creates a new RESP client for Valkey or Dragonfly.
func (*RespClient) Close ¶
func (c *RespClient) Close() error
Close shuts down command and subscription connections.
func (*RespClient) DeleteRoute ¶
func (c *RespClient) DeleteRoute(ctx context.Context, hostname string) error
DeleteRoute removes a stored route.
func (*RespClient) Ping ¶
func (c *RespClient) Ping(ctx context.Context) error
Ping checks the Valkey connection.
type RouteInfo ¶
type RouteInfo struct {
ServerID string `json:"server_id"`
Hostname string `json:"hostname"`
BackendHost string `json:"backend_host"`
BackendPort int `json:"backend_port"`
ProxyPort int `json:"proxy_port"`
UpdatedAt int64 `json:"updated_at"`
}
RouteInfo holds stored route details in Valkey / Dragonfly KV.
type ValkeyClient ¶
type ValkeyClient interface {
Ping(ctx context.Context) error
SetRoute(ctx context.Context, hostname string, route *RouteInfo) error
GetRoute(ctx context.Context, hostname string) (*RouteInfo, error)
DeleteRoute(ctx context.Context, hostname string) error
Publish(ctx context.Context, channel string, message string) error
Subscribe(ctx context.Context, channel string, onMessage func(channel, message string)) error
Close() error
}
ValkeyClient is the Valkey/Dragonfly KV and pub/sub surface Cloud and the panel proxy share.