go-proxy/worker.go
Virgil fd6bc01b87 docs(proxy): align API comments with AX
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 23:48:33 +00:00

30 lines
695 B
Go

package proxy
import (
"sync"
"time"
)
// workers := NewWorkers(WorkersByRigID, bus)
// records := workers.List()
type Workers struct {
mode WorkersMode
entries []WorkerRecord // ordered by first-seen (stable)
nameIndex map[string]int // workerName → entries index
idIndex map[int64]int // minerID → entries index
subscribed bool
mu sync.RWMutex
}
// record.Hashrate(60)
type WorkerRecord struct {
Name string
LastIP string
Connections uint64
Accepted uint64
Rejected uint64
Invalid uint64
Hashes uint64 // sum of accepted share difficulties
LastHashAt time.Time
windows [5]tickWindow // 60s, 600s, 3600s, 12h, 24h
}