Example #1
0
    def get_bucket_instance_entries(self, marker, instance):
        entries = []
        while True:
            try:
                log_entries = client.get_log(self.src_conn, 'bucket-index',
                                             marker, self.max_entries, instance)
            except NotFound:
                log_entries = []

            log.debug('bucket instance "%s" has %d entries after "%s"', instance,
                      len(log_entries), marker)

            try:
                entries += [_bi_entry_from_json(entry) for entry in log_entries]
            except KeyError:
                log.error('log missing key is: %s', log_entries)
                raise

            if entries:
                marker = entries[-1].marker
            else:
                marker = ' '

            if len(log_entries) < self.max_entries:
                break
        return marker, entries
Example #2
0
 def get_log_entries(self, shard_num, marker):
     try:
         result = client.get_log(self.src_conn, self.type, marker,
                                 self.max_entries, shard_num)
         last_marker = result['marker']
         log_entries = result['entries']
         if len(log_entries) == self.max_entries:
             log.warn('shard %d log has fallen behind - log length >= %d',
                      shard_num, self.max_entries)
     except NotFound:
         # no entries past this marker yet, but we my have retries
         last_marker = ' '
         log_entries = []
     return last_marker, log_entries
Example #3
0
 def get_log_entries(self, shard_num, marker):
     try:
         result = client.get_log(self.src_conn, self.type,
                                 marker, self.max_entries,
                                 shard_num)
         last_marker = result['marker']
         log_entries = result['entries']
         if len(log_entries) == self.max_entries:
             log.warn('shard %d log has fallen behind - log length >= %d',
                      shard_num, self.max_entries)
     except NotFound:
         # no entries past this marker yet, but we my have retries
         last_marker = ' '
         log_entries = []
     return last_marker, log_entries