istio: istio.io/istio/mixer/pkg/config/store Index | Files

package store

import "istio.io/istio/mixer/pkg/config/store"

Index

Package Files

convert.go fsstore.go listener.go queue.go store.go

Constants

const (
    // example fs:///tmp/testdata/configroot
    FSUrl = "fs"
)

URL types supported by the config store

Variables

var ErrNotFound = errors.New("not found")

ErrNotFound is the error to be returned when the given key does not exist in the storage.

var ErrWatchAlreadyExists = errors.New("watch already exists")

ErrWatchAlreadyExists is the error to report that the watching channel already exists.

func StartWatch Uses

func StartWatch(s Store) (map[Key]*Resource, <-chan Event, error)

StartWatch registers with store, initiates a watch, and returns the current config state.

func WatchChanges Uses

func WatchChanges(wch <-chan Event, stop <-chan struct{}, watchFlushDuration time.Duration, applyEvents ApplyEventsFn)

WatchChanges watches for changes on a channel and publishes a batch of changes via applyEvents. WatchChanges is started in a goroutine.

type ApplyEventsFn Uses

type ApplyEventsFn func(events []*Event)

ApplyEventsFn is used for testing

type BackEndResource Uses

type BackEndResource struct {
    Kind     string
    Metadata ResourceMeta
    Spec     map[string]interface{}
}

BackEndResource represents a resources with a raw spec

func ParseChunk Uses

func ParseChunk(chunk []byte) (*BackEndResource, error)

ParseChunk parses a YAML formatted bytes into a BackEndResource.

func (*BackEndResource) Key Uses

func (ber *BackEndResource) Key() Key

Key returns the key of the resource in the store.

type Backend Uses

type Backend interface {
    Init(kinds []string) error

    Stop()

    // WaitForSynced blocks and awaits for the caches to be fully populated until timeout.
    WaitForSynced(time.Duration) error

    // Watch creates a channel to receive the events.
    Watch() (<-chan BackendEvent, error)

    // Get returns a resource's spec to the key.
    Get(key Key) (*BackEndResource, error)

    // List returns the whole mapping from key to resource specs in the store.
    List() map[Key]*BackEndResource
}

Backend defines the typeless storage backend for mixer.

type BackendEvent Uses

type BackendEvent struct {
    Key
    Type  ChangeType
    Value *BackEndResource
}

BackendEvent is an event used between Backend and Store.

type BackendValidator Uses

type BackendValidator interface {
    Validate(ev *BackendEvent) error
    SupportsKind(string) bool
}

BackendValidator defines the interface to validate unstructured event.

type Builder Uses

type Builder func(u *url.URL, gv *schema.GroupVersion, credOptions *creds.Options, ck []string) (Backend, error)

Builder is the type of function to build a Backend.

type ChangeType Uses

type ChangeType int

ChangeType denotes the type of a change

const (
    // Update - change was an update or a create to a key.
    Update ChangeType = iota
    // Delete - key was removed.
    Delete
)

type Event Uses

type Event struct {
    Key
    Type ChangeType

    // Value refers the new value in the updated event. nil if the event type is delete.
    Value *Resource
}

Event represents an event. Used by Store.Watch.

func ConvertValue Uses

func ConvertValue(ev BackendEvent, kinds map[string]proto.Message) (Event, error)

ConvertValue from JSON using a protobuf mapping

type Key Uses

type Key struct {
    Kind      string
    Namespace string
    Name      string
}

Key represents the key to identify a resource in the store.

func (Key) String Uses

func (k Key) String() string

String is the Istio compatible string representation of the resource. Name.Kind.Namespace At the point of use Namespace can be omitted, and it is assumed to be the namespace of the document.

type RegisterFunc Uses

type RegisterFunc func(map[string]Builder)

RegisterFunc is the type to register a builder for URL scheme.

type Registry Uses

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

Registry keeps the relationship between the URL scheme and the Backend implementation.

func NewRegistry Uses

func NewRegistry(inventory ...RegisterFunc) *Registry

NewRegistry creates a new Registry instance for the inventory.

func (*Registry) NewStore Uses

func (r *Registry) NewStore(
    configURL string,
    groupVersion *schema.GroupVersion,
    credOptions *creds.Options,
    criticalKinds []string) (Store, error)

NewStore creates a new Store instance with the specified backend.

type Resource Uses

type Resource struct {
    Metadata ResourceMeta
    Spec     proto.Message
}

Resource represents a resources with converted spec.

type ResourceMeta Uses

type ResourceMeta struct {
    Name        string
    Namespace   string
    Labels      map[string]string
    Annotations map[string]string
    Revision    string
}

ResourceMeta is the standard metadata associated with a resource.

type Store Uses

type Store interface {
    Init(kinds map[string]proto.Message) error

    Stop()

    // WaitForSynced blocks and awaits for the caches to be fully populated until timeout.
    WaitForSynced(time.Duration) error

    // Watch creates a channel to receive the events. A store can conduct a single
    // watch channel at the same time. Multiple calls lead to an error.
    Watch() (<-chan Event, error)

    // Get returns the resource to the key.
    Get(key Key) (*Resource, error)

    // List returns the whole mapping from key to resource specs in the store.
    List() map[Key]*Resource

    probe.SupportsProbe
}

Store defines the access to the storage for mixer.

func WithBackend Uses

func WithBackend(b Backend) Store

WithBackend creates a new Store with a certain backend. This should be used only by tests.

type Validator Uses

type Validator interface {
    Validate(ev *Event) error
}

Validator defines the interface to validate a new change.

Package store imports 19 packages (graph) and is imported by 19 packages. Updated 2019-06-30. Refresh now. Tools for package owners.