API documentation

This is the API documentation for DynamoDB Config Store.

DynamoDBConfigStore

class dynamodb_config_store.DynamoDBConfigStore(connection, table_name, store_name, store_key='_store', option_key='_option', read_units=1, write_units=1, config_store='SimpleConfigStore', config_store_args=[], config_store_kwargs={})[source]

DynamoDB Config Store instance

_create_table(read_units=1, write_units=1)[source]

Create a new table

Parameters:
  • read_units (int) – Number of read capacity units to provision
  • write_units (int) – Number of write capacity units to provision
Returns:

bool – Returns True if the table was created

_initialize_store()[source]

Initialize the store to use

_initialize_table()[source]

Initialize the table

Returns:None
_wait_for_table(target_state, sleep_time=5, retries=30)[source]

Wait for the table to get to a certain state

Parameters:
  • target_state (str) – The target state to wait for
  • sleep_time (int) – Number of seconds to wait between the checks
  • retries (int) – Number of retries before giving up
Returns:

bool – True if the target state was reached, else False

reload()[source]

Reload the config store

Returns:None
set(option, data)[source]

Upsert a config item

A write towards DynamoDB will be executed when this method is called.

Parameters:
  • option (str) – Name of the configuration option
  • data (dict) – Dictionary with all option data
Returns:

bool – True if the data was stored successfully

ConfigStores

ConfigStore

This is the ConfigStore base class that all other config stores inherit from.

class dynamodb_config_store.config_stores.ConfigStore[source]

Base class for config stores

_delete_instance_attributes()[source]

Delete all the instance attributes

Returns:None
_set_instance_attributes(options)[source]

Set instance attributes

Parameters:options (dict) – Dict with {‘option’: {‘key’: ‘value’}}
Returns:None

DirectConfigStore

The DirectConfigStore is the default Config Store. All requests made will be send directly to DynamoDB so that the latest configuration is fetched at all times.

TimeBasedConfigStore

The TimeBasedConfigStore is a Config Store used for fetching configuration from DynamoDB on a preset interval. All configuration options will be exposed using instance attributes such as store.config.option, where option is the store option.

This class shall not be instanciated directly, it’s called by DynamoDBConfigStore.

class dynamodb_config_store.config_stores.time_based.TimeBasedConfigStore(table, store_name, store_key, option_key, update_interval=300)[source]

Fetches Stores on a periodic interval from DynamoDB

All internal variables and methods are private (with an leading _), as the configuration options from DynamoDB will be set as instance attributes.

_fetch_options()[source]

Retrieve a dictionary with all options and values from DynamoDB

Returns:dict – Dict with {‘option’: {‘key’: ‘value’}}
_run()[source]

Run periodic fetcher

Returns:None

Exceptions

Exception definitions

exception dynamodb_config_store.exceptions.MisconfiguredSchemaException[source]

Exception thrown if the table does not match the configuration

exception dynamodb_config_store.exceptions.TableNotCreatedException[source]

Exception thrown if the table could not be created successfull

exception dynamodb_config_store.exceptions.TableNotReadyException[source]

Exception thrown if the table is not in ACTIVE or UPDATING state