istio: istio.io/istio/pkg/mcp/internal Index | Files | Directories

package internal

import "istio.io/istio/pkg/mcp/internal"

Index

Package Files

internal.go queue.go size.go

func ProtoSize Uses

func ProtoSize(msg hasSize) int

func UpdateResourceVersionTracking Uses

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.

type UniqueQueue Uses

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 Uses

func NewUniqueScheduledQueue(maxDepth int) *UniqueQueue

NewUniqueScheduledQueue creates a new unique queue specialized for MCP source/server implementations.

func (*UniqueQueue) Close Uses

func (q *UniqueQueue) Close()

func (*UniqueQueue) Dequeue Uses

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 Uses

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

func (*UniqueQueue) Dump Uses

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 Uses

func (q *UniqueQueue) Empty() bool

Empty returns true if the queue is empty

func (*UniqueQueue) Enqueue Uses

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 Uses

func (q *UniqueQueue) Full() bool

Full returns true if the queue is full

func (*UniqueQueue) Ready Uses

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

Directories

PathSynopsis
test

Package internal imports 4 packages (graph) and is imported by 4 packages. Updated 2019-08-06. Refresh now. Tools for package owners.