Skip to content

Commit bc94c90

Browse files
committed
more flow control
1 parent 2387722 commit bc94c90

40 files changed

+3291
-1814
lines changed

pkg/epp/flowcontroller/flowcontroller.go

Lines changed: 740 additions & 956 deletions
Large diffs are not rendered by default.

pkg/epp/flowcontroller/flowitem.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ type flowItem struct {
4242
// effectiveTTL is the actual Time-To-Live assigned to this item by the FlowController, considering the request's
4343
// preference and controller defaults.
4444
effectiveTTL time.Duration
45+
// priorityScore represents the dispatch priority of this item. The score's meaning and calculation method are
46+
// determined by the IntraFlowDispatchPolicy governing this item's queue, and its type is indicated by
47+
// QueueStateReader.PriorityScoreType() of the queue.
48+
// Convention: For many scores, a lower numerical value might indicate higher priority.
49+
priorityScore float64
4550
// queueHandle is the opaque handle returned by the FlowQueue when this item is successfully added to a queue.
4651
// It's used by the FlowController to instruct the FlowQueue to remove this specific item.
4752
// This is nil until the item is successfully enqueued into a FlowQueue.
@@ -83,6 +88,8 @@ func newFlowItem(req types.FlowControlRequest, spec types.FlowSpecification, eff
8388

8489
// --- Implementation of types.QueueItemAccessor ---
8590

91+
var _ types.QueueItemAccessor = &flowItem{} // Compile-time validation
92+
8693
func (fi *flowItem) EnqueueTime() time.Time {
8794
return fi.enqueueTime
8895
}
@@ -107,6 +114,18 @@ func (fi *flowItem) OriginalRequest() types.FlowControlRequest {
107114
return fi.originalRequest
108115
}
109116

117+
func (fi *flowItem) PriorityScore() float64 {
118+
return fi.priorityScore
119+
}
120+
121+
func (fi *flowItem) Handle() types.QueueItemHandle {
122+
return fi.queueHandle
123+
}
124+
125+
func (fi *flowItem) SetHandle(handle types.QueueItemHandle) {
126+
fi.queueHandle = handle
127+
}
128+
110129
// --- Lifecycle Management Methods (called by FlowController) ---
111130

112131
// setQueueDetails is called by the FlowController *after* an item has been

0 commit comments

Comments
 (0)