istio: istio.io/istio/pkg/mcp/snapshot Index | Files

package snapshot

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

Index

Package Files

inmemory.go snapshot.go

type Cache Uses

type Cache struct {
    // contains filtered or unexported fields
}

Cache is a snapshot-based cache that maintains a single versioned snapshot of responses per group of clients. Cache consistently replies with the latest snapshot.

func New Uses

func New(groupIndex GroupIndexFn) *Cache

New creates a new cache of resource snapshots.

func (*Cache) ClearSnapshot Uses

func (c *Cache) ClearSnapshot(group string)

ClearSnapshot clears snapshot for a group. This does not cancel any open watches already created (see ClearStatus).

func (*Cache) ClearStatus Uses

func (c *Cache) ClearStatus(group string)

ClearStatus clears status for a group. This has the effect of canceling any open watches opened against this group info.

func (*Cache) GetGroups Uses

func (c *Cache) GetGroups() []string

GetGroups returns all groups of snapshots that the server layer is serving.

func (*Cache) GetResource Uses

func (c *Cache) GetResource(group string, collection string, resourceName string) *sink.Object

GetResource returns the mcp resource detailed information for the specified group

func (*Cache) GetSnapshotInfo Uses

func (c *Cache) GetSnapshotInfo(group string) []Info

GetSnapshotInfo return the snapshots information

func (*Cache) SetSnapshot Uses

func (c *Cache) SetSnapshot(group string, snapshot Snapshot)

SetSnapshot updates a snapshot for a group.

func (*Cache) Status Uses

func (c *Cache) Status(group string) *StatusInfo

Status returns informational status for a group.

func (*Cache) Watch Uses

func (c *Cache) Watch(
    request *source.Request,
    pushResponse source.PushResponseFunc,
    peerAddr string) source.CancelWatchFunc

Watch returns a watch for an MCP request.

type GroupIndexFn Uses

type GroupIndexFn func(collection string, node *mcp.SinkNode) string

GroupIndexFn returns a stable group index for the given MCP collection and node. This is how an MCP server partitions snapshots to different clients. The index function is an implementation detail of the MCP server and Istio does not depend on any particular mapping.

type InMemory Uses

type InMemory struct {
    // contains filtered or unexported fields
}

InMemory Snapshot implementation

func (*InMemory) Builder Uses

func (s *InMemory) Builder() *InMemoryBuilder

Builder returns a new builder instance, based on the contents of this snapshot.

func (*InMemory) Clone Uses

func (s *InMemory) Clone() *InMemory

Clone this snapshot.

func (*InMemory) Collections Uses

func (s *InMemory) Collections() []string

Collections is an implementation of Snapshot.Collections

func (*InMemory) Resources Uses

func (s *InMemory) Resources(collection string) []*mcp.Resource

Resources is an implementation of Snapshot.Resources

func (*InMemory) String Uses

func (s *InMemory) String() string

func (*InMemory) Version Uses

func (s *InMemory) Version(collection string) string

Version is an implementation of Snapshot.Version

type InMemoryBuilder Uses

type InMemoryBuilder struct {
    // contains filtered or unexported fields
}

InMemoryBuilder is a builder for an InMemory snapshot.

func NewInMemoryBuilder Uses

func NewInMemoryBuilder() *InMemoryBuilder

NewInMemoryBuilder creates and returns a new InMemoryBuilder.

func (*InMemoryBuilder) Build Uses

func (b *InMemoryBuilder) Build() *InMemory

Build the snapshot and return.

func (*InMemoryBuilder) DeleteEntry Uses

func (b *InMemoryBuilder) DeleteEntry(collection string, name string)

DeleteEntry deletes the named entry within the given collection.

func (*InMemoryBuilder) Set Uses

func (b *InMemoryBuilder) Set(collection, version string, resources []*mcp.Resource)

Set the values for a given collection. If Set is called after a call to Freeze, then this method panics.

func (*InMemoryBuilder) SetEntry Uses

func (b *InMemoryBuilder) SetEntry(collection, name, version string, createTime time.Time, labels,
    annotations map[string]string, m proto.Message) error

SetEntry sets a single entry. Note that this is a slow operation, as update requires scanning through existing entries.

func (*InMemoryBuilder) SetVersion Uses

func (b *InMemoryBuilder) SetVersion(collection string, version string)

SetVersion sets the version for the given collection

type Info Uses

type Info struct {
    // Collection of mcp resource
    Collection string
    // Version of the resource
    Version string
    // Names of the resource entries.
    Names []string
    // Synced of this collection, including peerAddr and synced status
    Synced map[string]bool
}

Info is used for configz

type Snapshot Uses

type Snapshot interface {
    Collections() []string
    Resources(collection string) []*mcp.Resource
    Version(collection string) string
}

Snapshot provides an immutable view of versioned resources.

type StatusInfo Uses

type StatusInfo struct {
    // contains filtered or unexported fields
}

StatusInfo records watch status information of a group.

func (*StatusInfo) LastWatchRequestTime Uses

func (si *StatusInfo) LastWatchRequestTime() time.Time

LastWatchRequestTime returns the time the most recent watch request was received.

func (*StatusInfo) Watches Uses

func (si *StatusInfo) Watches() int

Watches returns the number of open watches.

Package snapshot imports 12 packages (graph) and is imported by 15 packages. Updated 2019-09-26. Refresh now. Tools for package owners.