Class: Flydata::Helper::Action::Flush

Inherits:
AgentAction show all
Defined in:
lib/flydata/helper/action/flush.rb

Constant Summary

Constants inherited from AgentAction

AgentAction::FLYDATA_CMD

Instance Attribute Summary

Attributes inherited from BaseAction

#config

Instance Method Summary collapse

Methods inherited from AgentAction

#execute, #get_tables

Methods inherited from BaseAction

#config_hash, #initialize

Constructor Details

This class inherits a constructor from Flydata::Helper::BaseAction

Instance Method Details

#build_options(opts) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/flydata/helper/action/flush.rb', line 11

def build_options(opts)
  opt_str = ""

  if config_hash(opts)[:skip_flush] # skip server flush
    opt_str << " --skip-flush"
  end

  timeout = config_hash(opts)[:server_timeout].to_i
  if timeout > 0 && timeout <= 3600 # max 1 hour
    opt_str << " --server-timeout #{timeout}"
  end

  if !!config_hash(opts)[:dont_wait_upload]
    opt_str << " --dont-wait-upload"
  end

  opt_str
end

#command(opts = {}) ⇒ Object


7
8
9
# File 'lib/flydata/helper/action/flush.rb', line 7

def command(opts = {})
  "sync:flush -y %s" % [build_options(opts)]
end