The zaqar.storage.utils module

can_connect(uri, conf=None)

Given a URI, verifies whether it’s possible to connect to it.

Parameters:uri (six.text_type) – connection string to a storage endpoint
Returns:True if can connect else False
Return type:bool
dynamic_conf(uri, options, conf=None)

Given metadata, yields a dynamic configuration.

Parameters:
  • uri (six.text_type) – pool location
  • options (dict) – additional pool metadata
  • conf (oslo_config.cfg.ConfigOpts) – Optional conf object to copy
Returns:

Configuration object suitable for constructing storage drivers

Return type:

oslo_config.cfg.ConfigOpts

keyify(key, iterable)

Make an iterator from an iterable of dicts compared with a key.

Parameters:
  • key – A key exists for all dict inside the iterable object
  • iterable – The input iterable object
load_storage_driver(conf, cache, storage_type=None, control_mode=False, control_driver=None)

Loads a storage driver and returns it.

The driver’s initializer will be passed conf and cache as its positional args.

Parameters:
  • conf – Configuration instance to use for loading the driver. Must include a ‘drivers’ group.
  • cache – Cache instance that the driver can (optionally) use to reduce latency for some operations.
  • storage_type – The storage_type to load. If None, then the drivers option will be used.
  • control_mode – (Default False). Determines which driver type to load; if False, the data driver is loaded. If True, the control driver is loaded.
  • control_driver – (Default None). The control driver instance to pass to the storage driver. Needed to access the queue controller, mainly.
load_storage_impl(uri, control_mode=False, default_store=None)

Loads a storage driver implementation and returns it.

Parameters:
  • uri – The connection uri to parse and load a driver for.
  • control_mode – (Default False). Determines which driver type to load; if False, the data driver is loaded. If True, the control driver is loaded.
  • default_store – The default store to load if no scheme is parsed.