Source

callchain / callchain / root / activeman.py

Full commit
# -*- coding: utf-8 -*-
'''active manually balanced chains'''

from appspace import appifies
from twoq.active import ManResultMixin

from callchain.config import Defaults
from callchain.keys.mixin import KEvent
from callchain.route import Chains, Events
from callchain.mixins import ChainMixin, PriorityMixin, EventMixin

from callchain.root.core import RootMixin, EventRootMixin
from callchain.root.keys import KRootResults, KRootThings
from callchain.root.apps import thingchain, thingevent, chain, event, events

thingchain = Chains(thingchain).defaults(Defaults)
thingevent = Events(thingevent).events(events).defaults(Defaults)


@appifies(KRootThings)
@thingchain
class callchain(RootMixin, ChainMixin, ManResultMixin):

    '''active queued manually balanced lite call chain'''


@appifies(KRootThings)
@thingchain
class prioritychain(RootMixin, PriorityMixin, ManResultMixin):

    '''active priority queued manually balanced lite call chain'''


@appifies(KEvent)
@thingevent
class eventchain(EventRootMixin, EventMixin, ManResultMixin):

    '''active queued manually balanced lite event chain'''


class chainqueue(chain):
    prefix = 'callchain.active_man.chainlet'


class eventqueue(event):
    prefix = 'callchain.active_man.eventlet'

chain = Chains(chainqueue).defaults(Defaults)
event = Events(eventqueue).events(events).defaults(Defaults)


@appifies(KRootResults)
@chain
class chainq(RootMixin, ChainMixin, ManResultMixin):

    '''active queued manually balanced call chain'''


@appifies(KRootResults)
@chain
class priorityq(RootMixin, PriorityMixin, ManResultMixin):

    '''active priority queued manually balanced lite call chain'''


@appifies(KEvent)
@event
class eventq(EventRootMixin, EventMixin, ManResultMixin):

    '''active queued manually balanced event chain'''