Source

callchain / callchain / root / lazyman.py

# -*- coding: utf-8 -*-
'''lazy manually balanced chains'''

from appspace import appifies
from twoq.lazy 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, events

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


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

    '''lazy queued manually balanced lite call chain'''


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

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


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

    '''lazy queued manually balanced lite event chain'''


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


class eventqueue(chain):
    prefix = 'callchain.chainlet.lazyman.eventlet'
    chain = 'callchain.chainlet.lazyman.chainlet.chainlink'


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


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

    '''lazy queued manually balanced call chain'''


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

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


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

    '''lazy queued manually balanced event chain'''