Class: Makara::Strategies::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/makara/strategies/abstract.rb

Direct Known Subclasses

PriorityFailover, RoundRobin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pool) ⇒ Abstract

Returns a new instance of Abstract.



5
6
7
8
# File 'lib/makara/strategies/abstract.rb', line 5

def initialize(pool)
  @pool = pool
  init
end

Instance Attribute Details

#poolObject (readonly)

Returns the value of attribute pool.



4
5
6
# File 'lib/makara/strategies/abstract.rb', line 4

def pool
  @pool
end

Instance Method Details

#connection_added(wrapper) ⇒ Object



14
15
16
# File 'lib/makara/strategies/abstract.rb', line 14

def connection_added(wrapper)
  # doesn't have to be implemented
end

#currentObject



18
19
20
21
# File 'lib/makara/strategies/abstract.rb', line 18

def current
  # it's sticky - give the "curent" one
  Kernel.raise NotImplementedError
end

#initObject



10
11
12
# File 'lib/makara/strategies/abstract.rb', line 10

def init
  # explicit constructor
end

#nextObject



23
24
25
26
# File 'lib/makara/strategies/abstract.rb', line 23

def next
  # rotate to the "next" one if you feel like it
  Kernel.raise NotImplementedError
end