Package restkit :: Package pool :: Module base
[hide private]
[frames] | no frames]

Source Code for Module restkit.pool.base

 1  # -*- coding: utf-8 - 
 2  # 
 3  # This file is part of restkit released under the MIT license.  
 4  # See the NOTICE for more information. 
 5   
 6   
 7   
8 -class BasePool(object):
9
10 - def __init__(self, keepalive=2, timeout=300):
11 """ abstract class from which all connection 12 pool should inherit. 13 """ 14 if type(timeout) != type(1): 15 raise ValueError("Pool timeout isn't an integer") 16 self.keepalive = keepalive 17 self.timeout = timeout
18
19 - def get(self, netloc):
20 """ method used to return a connection from the pool""" 21 raise NotImplementedError
22
23 - def put(self, netloc, conn):
24 """ Put an item back into the pool, when done """ 25 raise NotImplementedError
26
27 - def clear_host(self, netloc):
28 """ method to clear all connections from host """ 29 raise NotImplementedError
30
31 - def clear(self):
32 """ method used to release all connections """ 33 raise NotImplementedError
34