Module: Scales::Server::Proxy::Callbacks

Extended by:
Callbacks
Included in:
Callbacks
Defined in:
lib/scales-server/proxy/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#on_connectObject



8
9
# File 'lib/scales-server/proxy/callbacks.rb', line 8

def on_connect
end

#on_dataObject



11
12
13
# File 'lib/scales-server/proxy/callbacks.rb', line 11

def on_data
  lambda { |data| data }
end

#on_finishObject



23
24
25
# File 'lib/scales-server/proxy/callbacks.rb', line 23

def on_finish
  lambda { |backend| backend.decrement_counter if Backend.strategy == :balanced }
end

#on_responseObject



15
16
17
# File 'lib/scales-server/proxy/callbacks.rb', line 15

def on_response
  lambda { |backend, response|  response }
end

#on_selectObject



19
20
21
# File 'lib/scales-server/proxy/callbacks.rb', line 19

def on_select
  lambda { |backend| backend.increment_counter if Backend.strategy == :balanced }
end