Documentation ¶
Index ¶
- func UpdateResourceVersionTracking(versions map[string]string, resources *mcp.Resources)
- type UniqueQueue
- func (q *UniqueQueue) Close()
- func (q *UniqueQueue) Dequeue() (string, interface{}, bool)
- func (q *UniqueQueue) Done() <-chan struct{}
- func (q *UniqueQueue) Dump() string
- func (q *UniqueQueue) Empty() bool
- func (q *UniqueQueue) Enqueue(key string, val interface{}) bool
- func (q *UniqueQueue) Full() bool
- func (q *UniqueQueue) Ready() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type UniqueQueue ¶
type UniqueQueue struct {
// contains filtered or unexported fields
}
UniqueQueue is a specialized queue structure. It has the following properties:
- Enqueuing an item already in the queue is idempotent. The first time an item is added to the queue determines its order in the queue until it is dequeued. Callers can safely update the queued items state while preserving it's place in the queue.
- Enqueuing an item in the queue creates a trySchedule event. The caller can select over the Ready() channel to process this event and remove items from the queue.
- The maximum queue depth is fixed.
- The queue can be safely closed. The caller is responsible for checking the Done() state of the queue and should stop checking Ready() and invoking Dequeue() when the channel returned by Done() is closed.
This is intended to be used by the MCP source/server packages for managing per-type watch state.
func NewUniqueScheduledQueue ¶
func NewUniqueScheduledQueue(maxDepth int) *UniqueQueue
NewUniqueScheduledQueue creates a new unique queue specialized for MCP source/server implementations.
func (*UniqueQueue) Close ¶
func (q *UniqueQueue) Close()
func (*UniqueQueue) Dequeue ¶
func (q *UniqueQueue) Dequeue() (string, interface{}, bool)
Dequeue removes an item from the queue. This should only be called once for each time Ready() indicates a new item is ready to be dequeued.
func (*UniqueQueue) Done ¶
func (q *UniqueQueue) Done() <-chan struct{}
func (*UniqueQueue) Dump ¶
func (q *UniqueQueue) Dump() string
Dump returns a JSON formatted dump of the internal queue state. This is intended for debug purposes only.
func (*UniqueQueue) Empty ¶
func (q *UniqueQueue) Empty() bool
Empty returns true if the queue is empty
func (*UniqueQueue) Enqueue ¶
func (q *UniqueQueue) Enqueue(key string, val interface{}) bool
Enqueue an item in the queue. Items with the same key may be safely enqueued multiple times. Enqueueing an item with a key that has already queued has no affect on the order of existing queued items.
Returns true if the item exists in the queue upon return. Otherwise, returns false if the item could not be queued.
func (*UniqueQueue) Ready ¶
func (q *UniqueQueue) Ready() <-chan struct{}