# Path: duct/interfaces.py
# class IDuctProtocol(Interface):
#     """Interface for Duct client protocols"""
# 
#     def sendEvent(self, event):
#         """Sends an event to this client"""
#         pass


from duct.ihateprotobuf import proto_pb2
from duct.interfaces import IDuctProtocol
from zope.interface import implementer
from twisted.protocols.basic import Int32StringReceiver
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import protocol
from twisted.python import log
        if self.failover:
            if self.host_index >= (len(self.hosts)-1):
                self.host_index = 0
            else:
                self.host_index += 1

            connector.host = self.hosts[self.host_index]

    def clientConnectionLost(self, connector, reason):
        log.msg('Lost connection.  Reason:' + str(reason))
        self.proto = None

        self._do_failover(connector)

        log.msg('Reconnecting to Riemann on %s:%s' % (connector.host,
                                                      connector.port))
        protocol.ReconnectingClientFactory.clientConnectionLost(
            self, connector, reason)

    def clientConnectionFailed(self, connector, reason):
        log.msg('Connection failed. Reason:' + str(reason))
        self.proto = None

        self._do_failover(connector)

        log.msg('Reconnecting to Riemann on %s:%s' % (connector.host,
                                                      connector.port))
        protocol.ReconnectingClientFactory.clientConnectionFailed(
            self, connector, reason)


# Path: duct/interfaces.py
# class IDuctProtocol(Interface):
#     """Interface for Duct client protocols"""
# 
#     def sendEvent(self, event):
#         """Sends an event to this client"""
#         pass


# Path: duct/protocol/riemann.py
from duct.ihateprotobuf import proto_pb2
from duct.interfaces import IDuctProtocol
from zope.interface import implementer
from twisted.protocols.basic import Int32StringReceiver
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import protocol
from twisted.python import log

        if self.failover:
            if self.host_index >= (len(self.hosts)-1):
                self.host_index = 0
            else:
                self.host_index += 1

            connector.host = self.hosts[self.host_index]

    def clientConnectionLost(self, connector, reason):
        log.msg('Lost connection.  Reason:' + str(reason))
        self.proto = None

        self._do_failover(connector)

        log.msg('Reconnecting to Riemann on %s:%s' % (connector.host,
                                                      connector.port))
        protocol.ReconnectingClientFactory.clientConnectionLost(
            self, connector, reason)

    def clientConnectionFailed(self, connector, reason):
        log.msg('Connection failed. Reason:' + str(reason))
        self.proto = None

        self._do_failover(connector)

        log.msg('Reconnecting to Riemann on %s:%s' % (connector.host,
                                                      connector.port))
        protocol.ReconnectingClientFactory.clientConnectionFailed(
            self, connector, reason)


@implementer(IDuctProtocol)