registry

package
v0.0.0-...-b80afe7 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package registry provides a persistence layer to manage open service broker service instances and bindings.

Package registry is the persistence layer of the service broker.

Index

Constants

This section is empty.

Variables

View Source
var ErrPermsission = goerrors.New("permission error")

ErrPermsission is raised when you don't have permission to read/write a registry key.

Functions

func Name

func Name(t Type, name string) string

Name returns the name of the registry secret.

Types

type Directory

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

Directory is a lookup table used to locate the registry entries for a service instance. The registry must live in the same namespace as the resources it is creating in order for garbage collection to work correctly. We can only determine this when a context is provided by the API telling us the namespace a service instance is provisioned in to. To further compound the issue, the context is only provided on creation, so we need to cache where the registry exists, in a fixed location we can always access.

func NewDirectory

func NewDirectory(namespace string) (*Directory, error)

NewDirectory lookups up or creates the registry directory.

func (*Directory) Add

func (d *Directory) Add(instanceID string, dirent *DirectoryEntry) error

Add registers a directory entry for a service instance. This should only ever be set for a service instance creation.

func (*Directory) Lookup

func (d *Directory) Lookup(instanceID string) (*DirectoryEntry, error)

Lookup finds the directory entry registered for a service instance.

func (*Directory) Remove

func (d *Directory) Remove(instanceID string) error

Remove cleans out a service instance entry from the directory.

type DirectoryEntry

type DirectoryEntry struct {
	// Namespace is the namespace in which the service instance,
	// and registry entries, reside.
	Namespace string `json:"namespace"`
}

DirectoryEntry contains persistent data about a service instance.

type Entry

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

Entry is a KV store associated with each instance or binding.

func New

func New(t Type, namespace, name string, readOnly bool) (*Entry, error)

New creates a registry entry, or retrives an existing one.

func (*Entry) Clone

func (e *Entry) Clone() *Entry

Clone duplicates a registry entry, the clone is read only to allow concurrency while the master copy retains its read/write status.

func (*Entry) Commit

func (e *Entry) Commit() error

Commit persists the entry transaction to Kubernetes.

func (*Entry) Delete

func (e *Entry) Delete() error

Delete removes the entry from Kubernetes.

func (*Entry) Exists

func (e *Entry) Exists() bool

Exists indicates whether the entry existed in Kubernetes when it was created.

func (*Entry) Get

func (e *Entry) Get(key Key, value interface{}) (bool, error)

Get gets an entry item.

func (*Entry) GetOwnerReference

func (e *Entry) GetOwnerReference() metav1.OwnerReference

GetOwnerReference returns the owner reference to attach to all resources created referenced by the template binding.

func (*Entry) GetString

func (e *Entry) GetString(key Key) (string, bool, error)

Get gets a string from the entry.

func (*Entry) GetUser

func (e *Entry) GetUser(key string) (interface{}, bool, error)

GetUser gets and decodes a JSON object from the registry.

func (*Entry) Inherit

func (e *Entry) Inherit(o *Entry)

Inherit is used when creating a service binding registry entry. It gets a copy of all data cached in the service instance.

func (*Entry) Set

func (e *Entry) Set(key Key, value interface{}) error

Set sets an entry item.

func (*Entry) SetUser

func (e *Entry) SetUser(key string, value interface{}) error

SetUser encodes a JSON object and sets the entry item.

func (*Entry) Unset

func (e *Entry) Unset(key Key)

Unset removes an item from the entry item.

type Key

type Key string

Key is an indentifier of a value in the registry entry's KV map.

const (
	// Namespace is the namespace assigned to the instance.
	Namespace Key = "namespace"

	// InstanceID is the name of the service.
	InstanceID Key = "instance-id"

	// BindingID is the name of the binding.
	BindingID Key = "binding-id"

	// ServiceID is the service ID related to the instance or binding.
	ServiceID Key = "service-id"

	// PlanID is the plan ID related to the instance or binding.
	PlanID Key = "plan-id"

	// Context is the context used to create or update the instance or binding.
	Context Key = "context"

	// Parameters are the parameters used to create or update the instance or binding.
	Parameters Key = "parameters"

	// Operation records there is an asynchronous operation in progress for the instance or binding.
	// This is the analogue to an operation.Type.
	Operation Key = "operation"

	// OperationID is the unique ID for an asynchronous operation on an instance or binding.
	OperationID Key = "operation-id"

	// OperationStatus is the error string returned by an aysynchronous operation.
	OperationStatus Key = "operation-status"

	// DashboardURL is the dashboard URL associated with a service instance.
	DashboardURL Key = "dashboard-url"

	// Credentials is the set of credentials that may be generated for a service binding.
	Credentials Key = "credentials"
)

type Type

type Type string

Type defines the registry type.

const (
	// ServiceInstance is used for service instance registries.
	ServiceInstance Type = "service-instance"

	// ServiceBinding is used for service instance registries.
	ServiceBinding Type = "service-binding"
)

Jump to

Keyboard shortcuts

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