Commit f70a688c authored by Vincent Pelletier's avatar Vincent Pelletier

neoctl: Change the expected tid-or-timestamp format

Before this change, the only distinction between a timestamp and a TID was
the presence of the decimal separator, ".". As a result, a timestamp
mistakenly provided without a decimal separator would be interpreted as a
TID, which will be somewhere in January 1900 (as TIDs are 64bits with much
finer accuracy than timestamps). When used to truncate a database, and in
the absence of sanity checks, this would simply wipe the database.

So, instead of just relying on a decimal separator, require a longer
string. Make it a prefix for readability. Also, TIDs are more niche than
timestamp, require them to have a mark, and do not require anything from
timestamps.
parent c4443632
...@@ -70,9 +70,9 @@ class TerminalNeoCTL(object): ...@@ -70,9 +70,9 @@ class TerminalNeoCTL(object):
return getattr(ClusterStates, value.upper()) return getattr(ClusterStates, value.upper())
def asTID(self, value): def asTID(self, value):
if '.' in value: if value.lower().startswith('tid:'):
return p64(int(value[4:], 0))
return tidFromTime(float(value)) return tidFromTime(float(value))
return p64(int(value, 0))
asNode = staticmethod(uuid_int) asNode = staticmethod(uuid_int)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment