keystone.common.kvs package¶
Subpackages¶
Submodules¶
keystone.common.kvs.core module¶
-
class
keystone.common.kvs.core.
KeyValueStore
(*args, **kwargs)[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.
Deprecated as of Newton.
-
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_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.
-
is_configured
¶
-
-
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.
-
expired
¶
-
-
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.