Class: DynamoAutoscale::LocalActioner
- Includes:
- Logger
- Defined in:
- lib/dynamo-autoscale/local_actioner.rb
Instance Attribute Summary
Attributes inherited from Actioner
#downscales, #table, #upscales
Class Method Summary collapse
-
.faux_provisioning_filters ⇒ Object
These filters use the arrays inside the local actioner to fake the provisioned reads and writes when the local data enters the system.
Instance Method Summary collapse
Methods included from Logger
included, logger, #logger, logger=
Methods inherited from Actioner
#check_day_reset!, #clear_pending!, #downscale, #flush_operations!, #initialize, maximum_throughput, maximum_throughput=, minimum_throughput, minimum_throughput=, #pending_reads?, #pending_writes?, #provisioned_for, #provisioned_reads, #provisioned_writes, #queue_operation!, #set, #should_flush?, #try_flush!, #upscale
Constructor Details
This class inherits a constructor from DynamoAutoscale::Actioner
Class Method Details
.faux_provisioning_filters ⇒ Object
These filters use the arrays inside the local actioner to fake the provisioned reads and writes when the local data enters the system. It makes it look like we’re actually modifying the provisioned numbers.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dynamo-autoscale/local_actioner.rb', line 29 def self.faux_provisioning_filters [Proc.new do |table, time, datum| actioner = DynamoAutoscale.actioners[table] actioner.provisioned_reads.reverse_each do |rtime, reads| if time > rtime logger.debug "[filter] Faked provisioned_reads to be #{reads} at #{time}" datum[:provisioned_reads] = reads break end end actioner.provisioned_writes.reverse_each do |wtime, writes| if time > wtime logger.debug "[filter] Faked provisioned_writes to be #{writes} at #{time}" datum[:provisioned_writes] = writes break end end end] end |
Instance Method Details
#can_run? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dynamo-autoscale/local_actioner.rb', line 15 def can_run? return true if @updating_until.nil? if Time.now.utc > @updating_until @updating_until = nil return true end return false end |
#scale(metric, value) ⇒ Object
5 6 7 8 |
# File 'lib/dynamo-autoscale/local_actioner.rb', line 5 def scale metric, value @updating_until = rand(4.0..7.0).minutes.from_now.utc return true end |
#scale_both(reads, writes) ⇒ Object
10 11 12 13 |
# File 'lib/dynamo-autoscale/local_actioner.rb', line 10 def scale_both reads, writes @updating_until = rand(4.0..7.0).minutes.from_now.utc return true end |