Module: Rbcli::ConfigurateStorage

Defined in:
lib/rbcli/stateful_systems/storagetypes/localstate.rb,
lib/rbcli/stateful_systems/configuratestorage.rb,
lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb

Overview

Configuration Interface

Class Method Summary collapse

Class Method Details

.configure(&block) ⇒ Object



13
14
15
16
# File 'lib/rbcli/stateful_systems/configuratestorage.rb', line 13

def self.configure &block
  @self_before_instance_eval = eval "self", block.binding
  instance_eval &block
end

.dataObject

Data Retrieval



21
22
23
# File 'lib/rbcli/stateful_systems/configuratestorage.rb', line 21

def self.data
  @data
end

.local_state(path, force_creation: false, halt_on_error: false) ⇒ Object



8
9
10
# File 'lib/rbcli/stateful_systems/storagetypes/localstate.rb', line 8

def self.local_state path, force_creation: false, halt_on_error: false
  @data[:localstate] = Rbcli::State::LocalStorage.new(path, force_creation: force_creation, halt_on_error: halt_on_error)
end

.remote_state_dynamodb(table_name: nil, region: nil, force_creation: false, halt_on_error: true, locking: false) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb', line 6

def self.remote_state_dynamodb table_name: nil, region: nil, force_creation: false, halt_on_error: true, locking: false
  raise StandardError "Must decalre `table_name` and `region` to use remote_state_dynamodb" if table_name.nil? or region.nil?
  @data[:remotestate_init_params] = {
      dynamodb_table: table_name,
      region: region,
      locking: locking
  }
  @data[:remotestate] = Rbcli::State::DynamoDBStorage.new(table_name, force_creation: force_creation, halt_on_error: halt_on_error)
end