Documentation
¶
Overview ¶
Package workerpool provides a two-level bounded-concurrency helper for the scanner (see §5 of scry-plan.md).
Two semaphores are exposed:
- Host — bounds the number of hosts in flight (default 50).
- Socket — bounds the total in-flight TCP sockets across all hosts (default 1000).
Both are acquired as weighted semaphores so the caller can release exactly what was acquired. The split keeps per-host latency predictable while still letting a single "busy" host use many sockets when others are idle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool holds the two semaphores. Acquire in Host→Socket order and release in reverse to avoid starving other hosts while holding socket budget.
func (*Pool) AcquireHost ¶
AcquireHost blocks until there is room for another host, or ctx is done.
func (*Pool) AcquireSocket ¶
AcquireSocket blocks until there is a free socket slot, or ctx is done.
func (*Pool) ReleaseSocket ¶
func (p *Pool) ReleaseSocket()
ReleaseSocket releases a single socket slot.
func (*Pool) SocketLimit ¶
SocketLimit returns the configured max in-flight sockets.