Module: Aws::SessionStore::DynamoDB::Table
- Defined in:
- lib/aws/session_store/dynamo_db/table.rb
Overview
This module provides a way to create and delete a session table.
Class Method Summary collapse
-
.create_table(options = {}) ⇒ Object
Creates a session table.
-
.delete_table(options = {}) ⇒ Object
Deletes a session table.
Class Method Details
.create_table(options = {}) ⇒ Object
Creates a session table.
12 13 14 15 16 17 18 19 20 |
# File 'lib/aws/session_store/dynamo_db/table.rb', line 12 def create_table( = {}) config = load_config() config.dynamo_db_client.create_table(create_opts(config)) logger.info "Table #{config.table_name} created, waiting for activation..." config.dynamo_db_client.wait_until(:table_exists, table_name: config.table_name) logger.info "Table #{config.table_name} is now ready to use." rescue Aws::DynamoDB::Errors::ResourceInUseException logger.warn "Table #{config.table_name} already exists, skipping creation." end |
.delete_table(options = {}) ⇒ Object
Deletes a session table.
24 25 26 27 28 29 |
# File 'lib/aws/session_store/dynamo_db/table.rb', line 24 def delete_table( = {}) config = load_config() config.dynamo_db_client.delete_table(table_name: config.table_name) config.dynamo_db_client.wait_until(:table_not_exists, table_name: config.table_name) logger.info "Table #{config.table_name} deleted." end |