internal

package
v0.0.0-...-dcdb1c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateResourceVersionTracking

func UpdateResourceVersionTracking(versions map[string]string, resources *mcp.Resources)

UpdateResourceVersionTracking updates a map of resource versions indexed by name based on the MCP resources response message.

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) Full

func (q *UniqueQueue) Full() bool

Full returns true if the queue is full

func (*UniqueQueue) Ready

func (q *UniqueQueue) Ready() <-chan struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL