storage

package
v0.0.0-...-5853c50 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiServerConfigMapStore

type ApiServerConfigMapStore struct {
	ConfigMapStore
	// contains filtered or unexported fields
}

ApiServerConfigMapStore only services Add and GetByKey from apiserver. TODO: Implement all the other store methods and make this a write through cache.

func (*ApiServerConfigMapStore) Add

func (a *ApiServerConfigMapStore) Add(obj interface{}) error

Add adds the given config map to the apiserver's store.

func (*ApiServerConfigMapStore) Delete

func (a *ApiServerConfigMapStore) Delete(obj interface{}) error

Delete deletes the existing config map object.

func (*ApiServerConfigMapStore) GetByKey

func (a *ApiServerConfigMapStore) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey returns the config map for a given key. The key must take the form namespace/name.

func (*ApiServerConfigMapStore) Update

func (a *ApiServerConfigMapStore) Update(obj interface{}) error

Update updates the existing config map object.

type CloudListingPool

type CloudListingPool struct {

	// The pool that is re-populated via re-list from cloud, and written to
	// from controller
	*InMemoryPool
	// contains filtered or unexported fields
}

CloudListingPool wraps InMemoryPool but relists from the cloud periodically.

func NewCloudListingPool

func NewCloudListingPool(k keyFunc, lister cloudLister, relistPeriod time.Duration) *CloudListingPool

NewCloudListingPool replenishes the InMemoryPool through a background goroutine that lists from the given cloudLister.

func (*CloudListingPool) Add

func (c *CloudListingPool) Add(key string, obj interface{})

Add simply adds to the underlying pool.

func (*CloudListingPool) Delete

func (c *CloudListingPool) Delete(key string)

Delete just deletes from underlying pool.

func (*CloudListingPool) ReplenishPool

func (c *CloudListingPool) ReplenishPool()

ReplenishPool lists through the cloudLister and inserts into the pool. This is especially useful in scenarios like deleting an Ingress while the controller is restarting. As long as the resource exists in the shared memory pool, it is visible to the caller and they can take corrective actions, eg: backend pool deletes backends with non-matching node ports in its sync method.

func (*CloudListingPool) Snapshot

func (c *CloudListingPool) Snapshot() map[string]interface{}

Snapshot just snapshots the underlying pool.

type ConfigMapStore

type ConfigMapStore interface {
	cache.Store
}

ConfigMapStore wraps the store interface. Implementations usually persist contents of the store transparently.

func NewConfigMapStore

func NewConfigMapStore(c *client.Client) ConfigMapStore

NewConfigMapStore returns a config map store capable of persisting updates to apiserver.

type ConfigMapVault

type ConfigMapVault struct {
	ConfigMapStore cache.Store
	// contains filtered or unexported fields
}

ConfigMapVault stores cluster UIDs in config maps. It's a layer on top of ConfigMapStore that just implements the utils.uidVault interface.

func NewConfigMapVault

func NewConfigMapVault(c *client.Client, uidNs, uidConfigMapName string) *ConfigMapVault

NewConfigMapVault creates a config map client. This client is essentially meant to abstract out the details of configmaps and the API, and just store/retrieve a single value, the cluster uid.

func NewFakeConfigMapVault

func NewFakeConfigMapVault(ns, name string) *ConfigMapVault

NewFakeConfigMapVault is an implementation of the ConfigMapStore that doesn't persist configmaps. Only used in testing.

func (*ConfigMapVault) Delete

func (c *ConfigMapVault) Delete() error

Delete deletes the cluster UID storing config map.

func (*ConfigMapVault) Get

func (c *ConfigMapVault) Get() (string, bool, error)

Get retrieves the cluster UID from the cluster config map. If this method returns an error, it's guaranteed to be apiserver flake. If the error is a not found error it sets the boolean to false and returns and error of nil instead.

func (*ConfigMapVault) Put

func (c *ConfigMapVault) Put(uid string) error

Put stores the given UID in the cluster config map.

type InMemoryPool

type InMemoryPool struct {
	cache.ThreadSafeStore
}

InMemoryPool is used as a cache for cluster resource pools.

func NewInMemoryPool

func NewInMemoryPool() *InMemoryPool

NewInMemoryPool creates an InMemoryPool.

func (*InMemoryPool) Snapshot

func (p *InMemoryPool) Snapshot() map[string]interface{}

Snapshot returns a read only copy of the k:v pairs in the store. Caller beware: Violates traditional snapshot guarantees.

type Snapshotter

type Snapshotter interface {
	Snapshot() map[string]interface{}
	cache.ThreadSafeStore
}

Snapshotter is an interface capable of providing a consistent snapshot of the underlying storage implementation of a pool. It does not guarantee thread safety of snapshots, so they should be treated as read only unless the implementation specifies otherwise.

type UIDVault

type UIDVault interface {
	Get() (string, bool, error)
	Put(string) error
	Delete() error
}

UIDVault stores UIDs.

Jump to

Keyboard shortcuts

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