Documentation
¶
Index ¶
- Variables
- type Client
- type Config
- type Handler
- func (h *Handler) Dispatch(_ context.Context, req *coordinatorv1.DispatchRequest) (*coordinatorv1.DispatchResponse, error)
- func (h *Handler) GetWorkers(_ context.Context, _ *coordinatorv1.GetWorkersRequest) (*coordinatorv1.GetWorkersResponse, error)
- func (h *Handler) Heartbeat(_ context.Context, req *coordinatorv1.HeartbeatRequest) (*coordinatorv1.HeartbeatResponse, error)
- func (h *Handler) Poll(ctx context.Context, req *coordinatorv1.PollRequest) (*coordinatorv1.PollResponse, error)
- type Metrics
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMissingTLSConfig = fmt.Errorf("TLS enabled but no certificates provided")
)
Errors
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
execution.Dispatcher
// Dispatch sends a task to the coordinator
Dispatch(ctx context.Context, task *coordinatorv1.Task) error
// Poll retrieves a task from the coordinator.
Poll(ctx context.Context, policy backoff.RetryPolicy, req *coordinatorv1.PollRequest) (*coordinatorv1.Task, error)
// GetWorkers retrieves the list of workers from the coordinator
GetWorkers(ctx context.Context) ([]*coordinatorv1.WorkerInfo, error)
// Heartbeat sends a heartbeat to the coordinator
Heartbeat(ctx context.Context, req *coordinatorv1.HeartbeatRequest) error
// Metrics returns the metrics for the coordinator client
Metrics() Metrics
}
Client abstracts handling communication with the coordinator service using service registry and gRPC.
type Config ¶
type Config struct {
// TLS configuration
Insecure bool // Use insecure connection (default: true)
CertFile string // Client certificate
KeyFile string // Client key
CAFile string // CA certificate
SkipTLSVerify bool // Skip server certificate verification
// Timeouts
DialTimeout time.Duration // Connection timeout (default: 10s)
RequestTimeout time.Duration // Per-request timeout (default: 5m)
// Retry configuration
MaxRetries int // Max dispatch retries (default: 3)
RetryInterval time.Duration // Base retry interval (default: 1s)
}
Config holds configuration for the coordinator client
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with default values
type Handler ¶
type Handler struct {
coordinatorv1.UnimplementedCoordinatorServiceServer
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler() *Handler
func (*Handler) Dispatch ¶
func (h *Handler) Dispatch(_ context.Context, req *coordinatorv1.DispatchRequest) (*coordinatorv1.DispatchResponse, error)
Dispatch tries to send a task to a waiting poller It fails if no pollers are available or no workers match the selector
func (*Handler) GetWorkers ¶
func (h *Handler) GetWorkers(_ context.Context, _ *coordinatorv1.GetWorkersRequest) (*coordinatorv1.GetWorkersResponse, error)
GetWorkers returns the list of currently connected workers
func (*Handler) Heartbeat ¶
func (h *Handler) Heartbeat(_ context.Context, req *coordinatorv1.HeartbeatRequest) (*coordinatorv1.HeartbeatResponse, error)
Heartbeat receives periodic status updates from workers
func (*Handler) Poll ¶
func (h *Handler) Poll(ctx context.Context, req *coordinatorv1.PollRequest) (*coordinatorv1.PollResponse, error)
Poll implements long polling - workers wait until a task is available
type Metrics ¶
type Metrics struct {
FailCount int // Total number of failures
IsConnected bool // Whether the client is currently connected
ConsecutiveFails int // Number of consecutive failures
LastError error // Last error encountered
}
Metrics defines the metrics for the coordinator client
Click to show internal directories.
Click to hide internal directories.