Documentation
¶
Index ¶
- type AnalysisWorker
- type Config
- type HeartbeatProgress
- type Job
- type WooglesClient
- func (c *WooglesClient) ClaimJob(ctx context.Context) (*Job, error)
- func (c *WooglesClient) FetchGameHistory(ctx context.Context, gameID string) (*pb.GameHistory, error)
- func (c *WooglesClient) SendHeartbeat(ctx context.Context, jobID string, progress *HeartbeatProgress) error
- func (c *WooglesClient) SubmitResult(ctx context.Context, jobID string, resultProto []byte) error
- type WorkerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisWorker ¶
type AnalysisWorker struct {
// contains filtered or unexported fields
}
AnalysisWorker polls for analysis jobs and processes them
func NewAnalysisWorker ¶
func NewAnalysisWorker(cfg *WorkerConfig) *AnalysisWorker
NewAnalysisWorker creates a new worker
type Config ¶
type Config struct {
SimPlaysEarlyMid int
SimPliesEarlyMid int
SimStopEarlyMid int
SimPlaysEarlyPreendgame int
SimPliesEarlyPreendgame int
SimStopEarlyPreendgame int
PEGEarlyCutoff bool
Threads int
}
Config is analysis configuration from the server
type HeartbeatProgress ¶
type HeartbeatProgress struct {
// Current turn being analyzed (1-indexed)
CurrentTurn int
// Total number of turns to analyze
TotalTurns int
// Optional status message
Status string
}
HeartbeatProgress represents progress information sent in heartbeats
type Job ¶
type Job struct {
// Unique identifier for this job
JobID string
// Game ID to analyze (e.g., "ABC123")
GameID string
// Analysis configuration
Config *Config
}
Job represents an analysis job received from Woogles
type WooglesClient ¶
type WooglesClient struct {
// contains filtered or unexported fields
}
WooglesClient handles HTTP communication with the Woogles API
func NewWooglesClient ¶
func NewWooglesClient(baseURL, apiKey string, cfg *config.Config) *WooglesClient
NewWooglesClient creates a new Woogles API client
func (*WooglesClient) ClaimJob ¶
func (c *WooglesClient) ClaimJob(ctx context.Context) (*Job, error)
ClaimJob attempts to claim a job from the queue Uses Connect RPC JSON format
func (*WooglesClient) FetchGameHistory ¶
func (c *WooglesClient) FetchGameHistory(ctx context.Context, gameID string) (*pb.GameHistory, error)
FetchGameHistory fetches the game history from Woogles
func (*WooglesClient) SendHeartbeat ¶
func (c *WooglesClient) SendHeartbeat(ctx context.Context, jobID string, progress *HeartbeatProgress) error
SendHeartbeat sends a heartbeat to indicate the worker is still processing
func (*WooglesClient) SubmitResult ¶
SubmitResult submits analysis results back to Woogles Sends protobuf bytes directly (not base64)
type WorkerConfig ¶
type WorkerConfig struct {
// Base URL for the Woogles API (default: https://woogles.io)
WooglesBaseURL string
// Woogles API key for authentication
APIKey string
// How often to poll for new jobs when idle
PollInterval time.Duration
// How often to send heartbeats while processing
HeartbeatInterval time.Duration
// Macondo configuration for the analyzer
MacondoConfig *config.Config
}
WorkerConfig holds configuration for the analysis worker
func DefaultWorkerConfig ¶
func DefaultWorkerConfig() *WorkerConfig
DefaultWorkerConfig creates a WorkerConfig with default values