Exemplo n.º 1
0
    def _tail_attributes_single(self, client, logid):
        try:
            tail_lsn = client.get_tail_lsn(logid)
            cprint("  Tail lsn: {}".format(helpers.humanize_lsn(tail_lsn)))
            attr = client.get_tail_attributes(logid)
            cprint(
                "  Last released real (record) lsn: {}".format(
                    helpers.humanize_lsn(attr[0])
                )
            )
            ts = "INVALID!"
            try:
                ts = datetime.fromtimestamp(attr[1] / 1000)
            except Exception:
                pass
            cprint(
                "  Approximate timestamp of last released real lsn: "
                "{} -> {}".format(attr[1], ts)
            )
            cprint(
                "  Approximate byte offset of the tail of the log: {}".format(attr[2])
            )

        except Exception as e:
            cprint("Can't get tail attributes: {}".format(e), "red")
            return 1
Exemplo n.º 2
0
 def _head_attributes_single(self, client, logid):
     try:
         attr = client.get_head_attributes(logid)
         cprint("  Trim point: {}".format(helpers.humanize_lsn(attr[0])))
         ts = "INVALID!"
         try:
             ts = datetime.fromtimestamp(attr[1] / 1000)
         except Exception:
             pass
         cprint("  Approximate timestamp of trim point (ms):"
                " {} -> {}".format(attr[1], ts))
     except Exception as e:
         cprint("Can't get head attributes: {}".format(e), "red")
         return 1
     return 0