예제 #1
0
 def get_header():
     # (tubid, incarnation,
     #  (first_event: number, time), (last_event: number, time),
     #  num_events,
     #  level_map, # maps string severity to count of messages
     # )
     return (TubID, int, (int, int), (int, int), int, DictOf(str, int))
예제 #2
0
    def list_incidents(since=Optional(str, "")):
        """Return a dict that maps an 'incident name' (a string of the form
        'incident-TIMESTAMP-UNIQUE') to the triggering event (a single event
        dictionary). The incident name can be passed to get_incident() to
        obtain the list of events (including header) contained inside the
        incident report. Incident names will sort in chronological order.

        If the optional since= argument is provided, then this will only
        return incident names that are alphabetically greater (and thus
        chronologically later) than the given string. This can be used to
        poll an application for incidents that have occurred since a previous
        query. For real-time reporting, use subscribe_to_incidents() instead.
        """
        return DictOf(str, Event)
예제 #3
0
파일: common.py 프로젝트: byrgazov/foolscap
        self.connected = False
        return fireEventually()

    def getPeer(self):
        return broker.LoopbackAddress()
    def getHost(self):
        return broker.LoopbackAddress()

Digits = re.compile('\d*')

MegaSchema1 = DictOf(str, ListOf(TupleOf(SetOf(int, maxLength=10, mutable=True),
        bytes, bool, int, float, None,
        StringConstraint(),
        ByteStringConstraint(),
        Any(),
        NumberConstraint(),
        IntegerConstraint(),
        StringConstraint(maxLength=100, minLength=90, regexp='\w+'),
        StringConstraint(regexp=Digits),
    ),
    maxLength=20),
    maxKeys=5)

# containers should convert their arguments into schemas
MegaSchema2 = TupleOf(SetOf(int), ListOf(int), DictOf(int, str))
MegaSchema3 = ListOf(TupleOf(int, int))


class RIHelper(RemoteInterface):
    def set(obj=Any()): return bool
    def set2(obj1=Any(), obj2=Any()): return bool
    def append(obj=Any()): return Any()
예제 #4
0
파일: common.py 프로젝트: exarkun/foolscap
    def getHost(self):
        return broker.LoopbackAddress()


Digits = re.compile("\d*")
MegaSchema1 = DictOf(str,
                     ListOf(TupleOf(
                         SetOf(int, maxLength=10, mutable=True),
                         str,
                         bool,
                         int,
                         long,
                         float,
                         None,
                         UnicodeConstraint(),
                         ByteStringConstraint(),
                         Any(),
                         NumberConstraint(),
                         IntegerConstraint(),
                         ByteStringConstraint(maxLength=100,
                                              minLength=90,
                                              regexp="\w+"),
                         ByteStringConstraint(regexp=Digits),
                     ),
                            maxLength=20),
                     maxKeys=5)
# containers should convert their arguments into schemas
MegaSchema2 = TupleOf(
    SetOf(int),
    ListOf(int),
    DictOf(int, str),
예제 #5
0
 def get_versions():
     return DictOf(str, str)
예제 #6
0
from zope.interface import Interface
from foolscap.remoteinterface import RemoteInterface
from foolscap.schema import DictOf, ListOf, Any, Optional, ChoiceOf

TubID = str  # printable, base32 encoded
Incarnation = (str, ChoiceOf(str, None))
Header = DictOf(str, Any())
Event = DictOf(str, Any())  # this has message:, level:, facility:, etc
EventWrapper = DictOf(str, Any())  # this has from:, rx_time:, and d:


class RILogObserver(RemoteInterface):
    __remote_name__ = "RILogObserver.foolscap.lothar.com"

    def msg(logmsg=Event):
        pass

    def done():
        pass

    def new_incident(name=str, trigger=Event):
        # should this give (tubid, incarnation, trigger) like list_incidents?
        pass

    def done_with_incident_catchup():
        pass


class RILogFile(RemoteInterface):
    __remote_name__ = "RILogFile.foolscap.lothar.com"
예제 #7
0
파일: common.py 프로젝트: sajith/foolscap
    def getPeer(self):
        return broker.LoopbackAddress()

    def getHost(self):
        return broker.LoopbackAddress()


MegaSchema1 = DictOf(ByteStringConstraint(),
                     ListOf(TupleOf(
                         SetOf(int, maxLength=10, mutable=True),
                         six.binary_type,
                         bool,
                         int,
                         long_type,
                         float,
                         None,
                         UnicodeConstraint(),
                         ByteStringConstraint(),
                         Any(),
                         NumberConstraint(),
                         IntegerConstraint(),
                         ByteStringConstraint(maxLength=100, minLength=90),
                     ),
                            maxLength=20),
                     maxKeys=5)
# containers should convert their arguments into schemas
MegaSchema2 = TupleOf(
    SetOf(int),
    ListOf(int),
    DictOf(int, str),
)
MegaSchema3 = ListOf(TupleOf(int, int))
예제 #8
0
 def get_versions():
     return DictOf(Any(), Any())