go-proxy/splitter/simple/mapper.go
Virgil 6f4d7019e2 fix(proxy): align runtime with RFC
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 18:38:28 +00:00

31 lines
682 B
Go

package simple
import (
"sync"
"time"
"dappco.re/go/proxy"
"dappco.re/go/proxy/pool"
)
// SimpleMapper holds one outbound pool connection and serves at most one active miner
// at a time. It becomes idle when the miner disconnects and may be reclaimed for the
// next login.
//
// m := simple.NewSimpleMapper(id, strategy)
type SimpleMapper struct {
id int64
miner *proxy.Miner // nil when idle
currentJob proxy.Job
strategy pool.Strategy
idleAt time.Time // zero when active
stopped bool
events *proxy.EventBus
pending map[int64]submitContext
mu sync.Mutex
}
type submitContext struct {
RequestID int64
StartedAt time.Time
}