package extraction import ( "context" "errors" "time" ) type Fulfillment string const ( Partial Fulfillment = "partial" AllOrNothing Fulfillment = "allOrNothing" ) type State string const ( Available State = "AVAILABLE" Extracted State = "EXTRACTED" ) var ( ErrInsufficientProxies = errors.New("insufficient proxies") ErrIdempotencyConflict = errors.New("idempotency key was reused with a different extraction request") ErrInvalidCommand = errors.New("invalid extraction command") ErrStoreUnavailable = errors.New("extraction store unavailable") ) type Candidate struct { ID string Protocol string Host string Port uint16 Username string Password string Region string Carrier string Upstream string OwnerWorkerID string URL string State State ExpiresAt time.Time LastCheckedAt time.Time } type Command struct { RequestID string ClientID string SourceIP string IdempotencyKey string IdempotencyTTL time.Duration Requested int Fulfillment Fulfillment Now time.Time MinRemainingTTL time.Duration MaxHealthCheckAge time.Duration ReserveForGateway int Protocols []string Regions []string Carriers []string Upstreams []string } type Result struct { Requested int Returned int ExtractedAt time.Time Items []Candidate } // Store atomically consumes proxies from a bounded, ephemeral activity pool. // Implementations must not require durable per-proxy extraction records. type Store interface { Extract(context.Context, Command) (Result, error) }