Documentation ¶
Index ¶
- Variables
- type Job
- type JobScheduler
- func (js *JobScheduler) AddJob(job *Job) error
- func (js *JobScheduler) GetJobDetails(jobID string) (map[string]interface{}, error)
- func (js *JobScheduler) GetQueueStatus() map[string]interface{}
- func (js *JobScheduler) GetSystemMetrics() SystemResources
- func (js *JobScheduler) SetResourceLimits(cpuThreshold, memoryThreshold float64)
- func (js *JobScheduler) Stop()
- type Quorum
- type SystemResources
- type WaitingJob
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidTimeframe = fmt.Errorf("invalid timeframe specified")
)
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { JobID string ArgType string Arguments map[string]interface{} ChainID string ContractAddress string JobCostPrediction float64 Stake float64 Status string TargetFunction string TimeFrame int64 // in seconds TimeInterval int64 // in seconds UserID string CreatedAt time.Time MaxRetries int CurrentRetries int LastExecuted time.Time NextExecutionTime time.Time Error string Payload map[string]interface{} CodeURL string }
Job represents a scheduled task with its properties
type JobScheduler ¶
type JobScheduler struct { Cron *cron.Cron // contains filtered or unexported fields }
JobScheduler enhanced with load balancing
func NewJobScheduler ¶
func NewJobScheduler(workersCount int) *JobScheduler
NewJobScheduler creates an enhanced scheduler with resource limits
func (*JobScheduler) AddJob ¶
func (js *JobScheduler) AddJob(job *Job) error
AddJob enhanced with resource checking
func (*JobScheduler) GetJobDetails ¶
func (js *JobScheduler) GetJobDetails(jobID string) (map[string]interface{}, error)
GetJobDetails returns detailed information about a specific job
func (*JobScheduler) GetQueueStatus ¶
func (js *JobScheduler) GetQueueStatus() map[string]interface{}
GetQueueStatus returns the current status of job queues
func (*JobScheduler) GetSystemMetrics ¶
func (js *JobScheduler) GetSystemMetrics() SystemResources
GetSystemMetrics returns current system metrics
func (*JobScheduler) SetResourceLimits ¶
func (js *JobScheduler) SetResourceLimits(cpuThreshold, memoryThreshold float64)
type Quorum ¶
type Quorum struct { QuorumID string NodeCount int ActiveNodes []string Status string ChainID string CreatedAt time.Time UpdatedAt time.Time }
Quorum represents a group of nodes that can execute jobs
type SystemResources ¶
type SystemResources struct { CPUUsage float64 MemoryUsage float64 MaxCPU float64 MaxMemory float64 }
SystemResources tracks system resource usage
type WaitingJob ¶
WaitingJob represents a job waiting in queue
Click to show internal directories.
Click to hide internal directories.