@@ -32,42 +32,42 @@ import (
3232 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/scheduling"
3333)
3434
35- var _ requestcontrol.PreRequest = & Plugin {}
36- var _ requestcontrol.ResponseBody = & Plugin {}
35+ var _ requestcontrol.PreRequest = & RequestEvictor {}
36+ var _ requestcontrol.ResponseBody = & RequestEvictor {}
3737
38- // Plugin tracks in-flight requests via RequestControl hooks and provides eviction capability.
39- type Plugin struct {
38+ // RequestEvictor tracks in-flight requests via RequestControl hooks and provides eviction capability.
39+ type RequestEvictor struct {
4040 queue * EvictionQueue
41- aborter Aborter
41+ evictor Evictor
4242 abortRegistry * AbortRegistry
4343}
4444
45- // NewPlugin creates an eviction plugin with the given policies and aborter .
46- func NewPlugin (
45+ // NewRequestEvictor creates a RequestEvictor with the given policies and evictor .
46+ func NewRequestEvictor (
4747 ordering flowcontrol.EvictionOrderingPolicy ,
4848 filter flowcontrol.EvictionFilterPolicy ,
49- aborter Aborter ,
50- ) * Plugin {
51- return & Plugin {
49+ evictor Evictor ,
50+ ) * RequestEvictor {
51+ return & RequestEvictor {
5252 queue : NewEvictionQueue (ordering , filter ),
53- aborter : aborter ,
53+ evictor : evictor ,
5454 abortRegistry : NewAbortRegistry (),
5555 }
5656}
5757
5858// AbortRegistry returns the shared abort registry.
5959// The ext_proc Process() goroutine uses this to look up abort channels for dispatched requests.
60- func (p * Plugin ) AbortRegistry () * AbortRegistry {
60+ func (p * RequestEvictor ) AbortRegistry () * AbortRegistry {
6161 return p .abortRegistry
6262}
6363
64- func (p * Plugin ) TypedName () plugin.TypedName {
64+ func (p * RequestEvictor ) TypedName () plugin.TypedName {
6565 return plugin.TypedName {Type : "EvictionPlugin" , Name : "eviction" }
6666}
6767
6868// PreRequest is called after scheduling, before the request reaches the model server.
6969// It tracks the request and, if the filter policy accepts it, adds it to the eviction queue.
70- func (p * Plugin ) PreRequest (
70+ func (p * RequestEvictor ) PreRequest (
7171 ctx context.Context ,
7272 request * scheduling.LLMRequest ,
7373 result * scheduling.SchedulingResult ,
@@ -121,7 +121,7 @@ func (p *Plugin) PreRequest(
121121
122122// ResponseBody is called for every response data chunk (streaming) or once (non-streaming).
123123// On the final call (EndOfStream == true), it removes the request from tracking and the eviction queue.
124- func (p * Plugin ) ResponseBody (
124+ func (p * RequestEvictor ) ResponseBody (
125125 ctx context.Context ,
126126 request * scheduling.LLMRequest ,
127127 response * requestcontrol.Response ,
@@ -151,7 +151,7 @@ func (p *Plugin) ResponseBody(
151151// Each request is only removed from tracking after a successful abort. If the abort fails,
152152// the request remains in the queue for a future eviction attempt.
153153// Returns the request IDs that were successfully aborted.
154- func (p * Plugin ) EvictN (ctx context.Context , n int ) ([]string , error ) {
154+ func (p * RequestEvictor ) EvictN (ctx context.Context , n int ) ([]string , error ) {
155155 logger := log .FromContext (ctx )
156156 aborted := make ([]string , 0 , n )
157157
@@ -162,8 +162,8 @@ func (p *Plugin) EvictN(ctx context.Context, n int) ([]string, error) {
162162 }
163163 item := items [0 ]
164164
165- if err := p .aborter . Abort (ctx , item ); err != nil {
166- logger .Error (err , "Failed to abort request, re-tracking" , "requestID" , item .RequestID , "targetURL" , item .TargetURL )
165+ if err := p .evictor . Evict (ctx , item ); err != nil {
166+ logger .Error (err , "Failed to evict request, re-tracking" , "requestID" , item .RequestID , "targetURL" , item .TargetURL )
167167 p .queue .Track (item )
168168 continue
169169 }
@@ -177,6 +177,6 @@ func (p *Plugin) EvictN(ctx context.Context, n int) ([]string, error) {
177177}
178178
179179// Stats returns the current in-flight and evictable request counts.
180- func (p * Plugin ) Stats () (inFlight int , evictable int ) {
180+ func (p * RequestEvictor ) Stats () (inFlight int , evictable int ) {
181181 return p .queue .InFlightLen (), p .queue .EvictableLen ()
182182}
0 commit comments