Documentation ¶
Index ¶
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.
Functions ¶
This section is empty.
Types ¶
type BackEndResource ¶
type BackEndResource struct { Kind string Metadata ResourceMeta Spec map[string]interface{} }
BackEndResource represents a resources with a raw spec
func ParseChunk ¶
func ParseChunk(chunk []byte) (*BackEndResource, error)
ParseChunk parses a YAML formatted bytes into a BackEndResource.
func (*BackEndResource) Key ¶
func (ber *BackEndResource) Key() Key
Key returns the key of the resource in the store.
type Backend ¶
type Backend interface { Init(kinds []string) error Stop() // 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 ¶
type BackendEvent struct { Key Type ChangeType Value *BackEndResource }
BackendEvent is an event used between Backend and Store.
type BackendValidator ¶
type BackendValidator interface {
Validate(ev *BackendEvent) error
}
BackendValidator defines the interface to validte unstructured event.
func NewValidator ¶
func NewValidator(ev Validator, kinds map[string]proto.Message) BackendValidator
NewValidator creates a default validator which validates the structure through registered kinds and referential integrity through ev.
type ChangeType ¶
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 ¶
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.
type RegisterFunc ¶
RegisterFunc is the type to register a builder for URL scheme.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry keeps the relationship between the URL scheme and the Backend implementation.
func NewRegistry ¶
func NewRegistry(inventory ...RegisterFunc) *Registry
NewRegistry creates a new Registry instance for the inventory.
type Resource ¶
type Resource struct { Metadata ResourceMeta Spec proto.Message }
Resource represents a resources with converted spec.
type ResourceMeta ¶
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 ¶
type Store interface { Init(kinds map[string]proto.Message) error Stop() // 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 a resource's spec to the key. Get(key Key, spec proto.Message) 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 ¶
WithBackend creates a new Store with a certain backend. This should be used only by tests.