Class: Dynomite::Waiter
- Inherits:
-
Object
- Object
- Dynomite::Waiter
- Includes:
- Client
- Defined in:
- lib/dynomite/waiter.rb
Instance Method Summary collapse
Instance Method Details
#wait(table_name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dynomite/waiter.rb', line 5 def wait(table_name) logger.info "Waiting for #{table_name} table to be ready." statuses = [:initial] until statuses.all? { |s| s == "ACTIVE" } do resp = client.describe_table(table_name: table_name) table = resp.table # table_status: CREATING UPDATING DELETING ACTIVE INACCESSIBLE_ENCRYPTION_CREDENTIALS ARCHIVING ARCHIVED table_status = table.table_status statuses = [table_status] # index_status: CREATING UPDATING DELETING ACTIVE indexes = table.global_secondary_indexes || [] statuses += indexes.map { |i| i.index_status } print '.' sleep pause_time end puts end |
#wait_for_delete(table_name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dynomite/waiter.rb', line 24 def wait_for_delete(table_name) logger.info "Waiting for #{table_name} table to be deleted." begin client.describe_table(table_name: table_name) print '.' sleep pause_time rescue Aws::DynamoDB::Errors::ResourceNotFoundException => e end puts end |