Class: Floom::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/floom/models/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, type, *args) ⇒ Request

Returns a new instance of Request.



6
7
8
9
10
# File 'lib/floom/models/request.rb', line 6

def initialize(connection, type, *args)
  @connection = connection
  @type       = type
  @command    = FlumeMasterCommandThrift.new(command: type.to_s, arguments: args)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/floom/models/request.rb', line 4

def connection
  @connection
end

#payloadObject (readonly)

Returns the value of attribute payload.



4
5
6
# File 'lib/floom/models/request.rb', line 4

def payload
  @payload
end

Instance Method Details

#fetchObject



12
13
14
15
# File 'lib/floom/models/request.rb', line 12

def fetch
  @response = connection.submit @command
  self
end

#parse(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/floom/models/request.rb', line 17

def parse(options = {})
  state = connection.getCmdStatus(@response).state
  
  while state == "EXECING"
    state = connection.getCmdStatus(@response).state
  end
  
  connection.getCmdStatus(@response)
  
end