Class: Rooq::ConnectionPool

Inherits:
Object
  • Object
show all
Defined in:
lib/rooq/connection.rb

Overview

Abstract interface for connection pools. Implementations manage a pool of reusable database connections.

Direct Known Subclasses

Adapters::PostgreSQL::ConnectionPool

Instance Method Summary collapse

Instance Method Details

#availableInteger

Returns number of available connections.

Returns:

  • (Integer)

    number of available connections

Raises:

  • (NotImplementedError)


122
123
124
# File 'lib/rooq/connection.rb', line 122

def available
  raise NotImplementedError, "#{self.class} must implement #available"
end

#checkin(connection) ⇒ Object

Check in a connection back to the pool.

Parameters:

  • connection (Object)

    the connection to return

Raises:

  • (NotImplementedError)


112
113
114
# File 'lib/rooq/connection.rb', line 112

def checkin(connection)
  raise NotImplementedError, "#{self.class} must implement #checkin"
end

#checkoutObject

Check out a connection from the pool.

Returns:

  • (Object)

    a database connection

Raises:

  • (NotImplementedError)


106
107
108
# File 'lib/rooq/connection.rb', line 106

def checkout
  raise NotImplementedError, "#{self.class} must implement #checkout"
end

#shutdownObject

Shutdown the pool and close all connections.

Raises:

  • (NotImplementedError)


127
128
129
# File 'lib/rooq/connection.rb', line 127

def shutdown
  raise NotImplementedError, "#{self.class} must implement #shutdown"
end

#sizeInteger

Returns total pool size.

Returns:

  • (Integer)

    total pool size

Raises:

  • (NotImplementedError)


117
118
119
# File 'lib/rooq/connection.rb', line 117

def size
  raise NotImplementedError, "#{self.class} must implement #size"
end