# Path: sio/sioworkersd/server.py
# class DuplicateWorker(Exception):
# class WorkerRejected(Exception):
# class WorkerServer(rpc.WorkerRPC):
# class WorkerServerFactory(ServerFactory):
#     def __init__(self):
#     def established(self, ignore=None):
#     def connectionLost(self, reason):
#     def __init__(self, manager):
#     def workerConnected(self, proto):
#     def workerDisconnected(self, proto):
# 
# Path: sio/protocol/rpc.py
# class TimeoutError(Exception):
#     pass


from sio.sioworkersd import server
from sio.protocol.rpc import TimeoutError
from twisted.application import service
from twisted.internet import reactor, defer
from twisted.logger import Logger
import six
        self.lostWorkerCallback = None

        # Various worker statistics, check out _updateWorkerStats().
        self.minAnyCpuWorkerRam = None
        self.maxAnyCpuWorkerRam = None
        self.minVcpuOnlyWorkerRam = None
        self.maxVcpuOnlyWorkerRam = None

    def makeFactory(self):
        f = server.WorkerServerFactory(self)
        self.serverFactory = f
        return f

    def notifyOnNewWorker(self, callback):
        if not callable(callback):
            raise ValueError()
        self.newWorkerCallback = callback

    def notifyOnLostWorker(self, callback):
        if not callable(callback):
            raise ValueError()
        self.lostWorkerCallback = callback

    @defer.inlineCallbacks
    def newWorker(self, uid, proto):
        log.info('New worker {w} uid={uid}', w=proto.name, uid=uid)
        name = proto.name
        if name in self.workers:
            proto.transport.loseConnection()
            log.warn('WARNING: Worker {w} connected twice and was dropped', w=name)

# Path: sio/sioworkersd/server.py
# class DuplicateWorker(Exception):
# class WorkerRejected(Exception):
# class WorkerServer(rpc.WorkerRPC):
# class WorkerServerFactory(ServerFactory):
#     def __init__(self):
#     def established(self, ignore=None):
#     def connectionLost(self, reason):
#     def __init__(self, manager):
#     def workerConnected(self, proto):
#     def workerDisconnected(self, proto):
# 
# Path: sio/protocol/rpc.py
# class TimeoutError(Exception):
#     pass


# Path: sio/sioworkersd/workermanager.py
from sio.sioworkersd import server
from sio.protocol.rpc import TimeoutError
from twisted.application import service
from twisted.internet import reactor, defer
from twisted.logger import Logger
import six

        self.lostWorkerCallback = None

        # Various worker statistics, check out _updateWorkerStats().
        self.minAnyCpuWorkerRam = None
        self.maxAnyCpuWorkerRam = None
        self.minVcpuOnlyWorkerRam = None
        self.maxVcpuOnlyWorkerRam = None

    def makeFactory(self):
        f = server.WorkerServerFactory(self)
        self.serverFactory = f
        return f

    def notifyOnNewWorker(self, callback):
        if not callable(callback):
            raise ValueError()
        self.newWorkerCallback = callback

    def notifyOnLostWorker(self, callback):
        if not callable(callback):
            raise ValueError()
        self.lostWorkerCallback = callback

    @defer.inlineCallbacks
    def newWorker(self, uid, proto):
        log.info('New worker {w} uid={uid}', w=proto.name, uid=uid)
        name = proto.name
        if name in self.workers:
            proto.transport.loseConnection()
            log.warn('WARNING: Worker {w} connected twice and was dropped', w=name)

            raise server.DuplicateWorker()