API reference for storage drivers

class DataDriverBase(conf, cache, control_driver)

Interface definition for storage drivers.

Data plane storage drivers are responsible for implementing the core functionality of the system.

Connection information and driver-specific options are loaded from the config file or the pool catalog.

Parameters:
  • conf (oslo_config.ConfigOpts) – Configuration containing options for this driver.
  • cache (dogpile.cache.region.CacheRegion) – Cache instance to use for reducing latency for certain lookups.
capabilities

Returns storage’s capabilities.

claim_controller

Returns the driver’s claim controller.

close()

Close connections to the backend.

gc()

Perform manual garbage collection of claims and messages.

This method can be overridden in order to provide a trigger that can be called by so-called “garbage collection” scripts that are required by some drivers.

By default, this method does nothing.

health()

Return the health status of service.

is_alive()

Check whether the storage is ready.

message_controller

Returns the driver’s message controller.

subscription_controller

Returns the driver’s subscription controller.

class ControlDriverBase(conf, cache)

Interface definition for control plane storage drivers.

Storage drivers that work at the control plane layer allow one to modify aspects of the functionality of the system. This is ideal for administrative purposes.

Allows access to the pool registry through a catalogue and a pool controller.

Parameters:
  • conf (oslo_config.ConfigOpts) – Configuration containing options for this driver.
  • cache (dogpile.cache.region.CacheRegion) – Cache instance to use for reducing latency for certain lookups.
catalogue_controller

Returns the driver’s catalogue controller.

close()

Close connections to the backend.

flavors_controller

Returns storage’s flavor management controller.

pools_controller

Returns storage’s pool management controller.

queue_controller

Returns the driver’s queue controller.

class Queue(driver)

This class is responsible for managing queues.

Queue operations include CRUD, monitoring, etc.

Storage driver implementations of this class should be capable of handling high workloads and huge numbers of queues.

create(name, metadata=None, project=None)

Base method for queue creation.

Parameters:
  • name – The queue name
  • project – Project id
Returns:

True if a queue was created and False if it was updated.

delete(name, project=None)

Base method for deleting a queue.

Parameters:
  • name – The queue name
  • project – Project id
exists(name, project=None)

Base method for testing queue existence.

Parameters:
  • name – The queue name
  • project – Project id
Returns:

True if a queue exists and False if it does not.

get(name, project=None)

Base method for queue metadata retrieval.

Parameters:
  • name – The queue name
  • project – Project id
Returns:

Dictionary containing queue metadata

Raises:

DoesNotExist

get_metadata(name, project=None)

Base method for queue metadata retrieval.

Parameters:
  • name – The queue name
  • project – Project id
Returns:

Dictionary containing queue metadata

Raises:

DoesNotExist

list(project=None, marker=None, limit=10, detailed=False)

Base method for listing queues.

Parameters:
  • project – Project id
  • marker – The last queue name
  • limit – (Default 10) Max number of queues to return
  • detailed – Whether metadata is included
Returns:

An iterator giving a sequence of queues and the marker of the next page.

set_metadata(name, metadata, project=None)

Base method for updating a queue metadata.

Parameters:
  • name – The queue name
  • metadata – Queue metadata as a dict
  • project – Project id
Raises:

DoesNotExist

stats(name, project=None)

Base method for queue stats.

Parameters:
  • name – The queue name
  • project – Project id
Returns:

Dictionary with the queue stats

class Message(driver)

This class is responsible for managing message CRUD.

bulk_delete(queue, message_ids, project=None)

Base method for deleting multiple messages.

Parameters:
  • queue – Name of the queue to post message to.
  • message_ids – A sequence of message IDs to be deleted.
  • project – Project id
bulk_get(queue, message_ids, project=None)

Base method for getting multiple messages.

Parameters:
  • queue – Name of the queue to get the message from.
  • project – Project id
  • message_ids – A sequence of message IDs.
Returns:

An iterable, yielding dicts containing message details

delete(queue, message_id, project=None, claim=None)

Base method for deleting a single message.

Parameters:
  • queue – Name of the queue to post message to.
  • message_id – Message to be deleted
  • project – Project id
  • claim – Claim this message belongs to. When specified, claim must be valid and message_id must belong to it.
first(queue, project=None, sort=1)

Get first message in the queue (including claimed).

Parameters:
  • queue – Name of the queue to list
  • sort – (Default 1) Sort order for the listing. Pass 1 for ascending (oldest message first), or -1 for descending (newest message first).
Returns:

First message in the queue, or None if the queue is empty

get(queue, message_id, project=None)

Base method for getting a message.

Parameters:
  • queue – Name of the queue to get the message from.
  • project – Project id
  • message_id – Message ID
Returns:

Dictionary containing message data

Raises:

DoesNotExist

list(queue, project=None, marker=None, limit=10, echo=False, client_uuid=None, include_claimed=False)

Base method for listing messages.

Parameters:
  • queue – Name of the queue to get the message from.
  • project – Project id
  • marker – Tail identifier
  • limit (Maybe int) – (Default 10) Max number of messages to return.
  • echo – (Default False) Boolean expressing whether or not this client should receive its own messages.
  • client_uuid – A UUID object. Required when echo=False.
  • include_claimed (bool) – omit claimed messages from listing?
Returns:

An iterator giving a sequence of messages and the marker of the next page.

pop(queue, limit, project=None)

Base method for popping messages.

Parameters:
  • queue – Name of the queue to pop message from.
  • limit – Number of messages to pop.
  • project – Project id
post(queue, messages, client_uuid, project=None)

Base method for posting one or more messages.

Implementations of this method should guarantee and preserve the order, in the returned list, of incoming messages.

Parameters:
  • queue – Name of the queue to post message to.
  • messages – Messages to post to queue, an iterable yielding 1 or more elements. An empty iterable results in undefined behavior.
  • client_uuid – A UUID object.
  • project – Project id
Returns:

List of message ids

class Claim(driver)
create(queue, metadata, project=None, limit=10)

Base method for creating a claim.

Parameters:
  • queue – Name of the queue this claim belongs to.
  • metadata – Claim’s parameters to be stored.
  • project – Project id
  • limit – (Default 10) Max number of messages to claim.
Returns:

(Claim ID, claimed messages)

delete(queue, claim_id, project=None)

Base method for deleting a claim.

Parameters:
  • queue – Name of the queue this claim belongs to.
  • claim_id – Claim to be deleted
  • project – Project id
get(queue, claim_id, project=None)

Base method for getting a claim.

Parameters:
  • queue – Name of the queue this claim belongs to.
  • claim_id – The claim id
  • project – Project id
Returns:

(Claim’s metadata, claimed messages)

Raises:

DoesNotExist

update(queue, claim_id, metadata, project=None)

Base method for updating a claim.

Parameters:
  • queue – Name of the queue this claim belongs to.
  • claim_id – Claim to be updated
  • metadata – Claim’s parameters to be updated.
  • project – Project id