go-proxy/splitter/simple/mapper.go
Virgil b66739b64f fix(simple): track expired shares
Propagate the submitted job id through simple-mode share handling so accepted shares can be flagged expired when a reply lands after a job rollover. Add coverage for the expired accept event path.\n\nCo-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 20:24:06 +00:00

33 lines
722 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
prevJob 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
JobID string
}