Class: Makara::Strategies::Abstract

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

Direct Known Subclasses

PriorityFailover, RoundRobin, ShardAware

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pool) ⇒ Abstract

Returns a new instance of Abstract.



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

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



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

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

#currentObject



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

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

#initObject



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

def init
  # explicit constructor
end

#nextObject



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

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