keystone.common.kvs package

Submodules

keystone.common.kvs.core module

class keystone.common.kvs.core.KeyValueStore(kvs_region)[source]

Bases: object

Basic KVS manager object to support Keystone Key-Value-Store systems.

This manager also supports the concept of locking a given key resource to allow for a guaranteed atomic transaction to the backend.

configure(backing_store, key_mangler=None, proxy_list=None, locking=True, **region_config_args)[source]

Configure the KeyValueStore instance.

Parameters:
  • backing_store – dogpile.cache short name of the region backend
  • key_mangler – key_mangler function
  • proxy_list – list of proxy classes to apply to the region
  • locking – boolean that allows disabling of locking mechanism for this instantiation
  • region_config_args – key-word args passed to the dogpile.cache backend for configuration
delete(key, lock=None)[source]

Delete a single key from the KVS backend.

This method will raise NotFound if the key doesn’t exist. The get and delete are done in a single transaction (via KeyValueStoreLock mechanism).

delete_multi(keys)[source]

Delete multiple keys from the KVS backend in a single call.

Like set_multi, this call does not serialize through the KeyValueStoreLock mechanism (locking cannot occur on more than one key in a given context without significant deadlock potential).

get(key)[source]

Get a single value from the KVS backend.

get_lock(key)[source]

Get a write lock on the KVS value referenced by key.

The ability to get a context manager to pass into the set/delete methods allows for a single-transaction to occur while guaranteeing the backing store will not change between the start of the ‘lock’ and the end. Lock timeout is fixed to the KeyValueStore configured lock timeout.

get_multi(keys)[source]

Get multiple values in a single call from the KVS backend.

is_configured[source]
set(key, value, lock=None)[source]

Set a single value in the KVS backend.

set_multi(mapping)[source]

Set multiple key/value pairs in the KVS backend at once.

Like delete_multi, this call does not serialize through the KeyValueStoreLock mechanism (locking cannot occur on more than one key in a given context without significant deadlock potential).

class keystone.common.kvs.core.KeyValueStoreLock(mutex, key, locking_enabled=True, lock_timeout=0)[source]

Bases: object

Basic KeyValueStoreLock context manager.

Hooks into the dogpile.cache backend mutex allowing for distributed locking on resources. This is only a write lock, and will not prevent reads from occurring.

acquire()[source]
expired[source]
release()[source]
exception keystone.common.kvs.core.LockTimeout(message=None, **kwargs)[source]

Bases: keystone.exception.UnexpectedError

debug_message_format = u'Lock Timeout occurred for key, %(target)s'
keystone.common.kvs.core.get_key_value_store(name, kvs_region=None)[source]

Retrieve key value store.

Instantiate a new KeyValueStore or return a previous instantiation that has the same name.

Module contents

Table Of Contents

Previous topic

keystone.common.environment package

Next topic

keystone.common.kvs.backends package

Project Source

This Page