Generic backend pool
Project description
Generic backend pool
Setup
pip install ramos
Development setup
make install
Usage
import ramos
ramos.configure(pools={
'backend_type': [
'path.to.backend_a',
'path.to.backend_b',
]
})
Integrations
Ramos can uses Django or Simple Settings to get backends configurations if set settings.POOL_OF_RAMOS:
POOL_OF_RAMOS = {
'backend_type': [
'path.to.backend_a',
'path.to.backend_b',
]
}
Backend Implementations
from ramos.mixins import ThreadSafeCreateMixin
class BackendA(ThreadSafeCreateMixin):
id = 'backend_a'
def say(self):
return 'A'
class BackendB(ThreadSafeCreateMixin):
id = 'backend_b'
def say(self):
return 'B'
Backend Pool
from ramos.pool import BackendPool
class BackendTypePool(BackendPool)
backend_type = 'backend_type'
backends = BackendTypePool.all()
for backend in backends:
print(backend.say())
# backend_a = BackendTypePool.get('backend_a')
# backend_b = BackendTypePool.get('backend_b')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ramos-1.2.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for ramos-1.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c90811faa87a8786b972f3847148aacf3d4ad90eb917640f3ac441f8e08996f9 |
|
MD5 | 210aa2adbd0bb3578247394607ffe0b1 |
|
BLAKE2b-256 | a247b0e44eb3fa2f763ff363791d275877f35d0b87a645e7799916e72c596a5f |