Esempio n. 1
0
def send_deleted_entity_data(interest, face):
    logger.debug('Sending DeletedEntityData for interest %s',
                 interest.getName().toUri())

    result = entities.Result(
        status=const.status_code.DELETED_ENTITY, value=None)
    name = interest.getName().appendVersion(utils.get_timestamp())
    deleted_entity_data = pyndn.Data(name)
    deleted_entity_data.setContent(entities.Result.serialize(result))

    face.putData(deleted_entity_data)
Esempio n. 2
0
 def add(self, name, value):
     self.diff[name] = value
     self.diff['timestamp'] = get_timestamp()
Esempio n. 3
0
 def touch(self):
     self.freshness = get_timestamp()
Esempio n. 4
0
 def is_fresh(self):
     return (self.x // 15, self.y // 15) in mngt.player_watch or \
            self.freshness + const.FRESH_TIMEOUT > get_timestamp()
Esempio n. 5
0
    def __init__(self, **kwargs):
        kwargs.setdefault('timestamp', get_timestamp())
        kwargs.setdefault('version', 1)

        super().__init__(**kwargs)
        self.diff = Diff(type(self))