Package google.registry.rde
Class RdeUtils
java.lang.Object
google.registry.rde.RdeUtils
Helper methods for RDE.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
findMostRecentPrefixForWatermark
(org.joda.time.DateTime watermark, String bucket, String tld, GcsUtils gcsUtils) Find the most recent folder in the given GCS bucket for the given watermark.static org.joda.time.DateTime
peekWatermark
(BufferedInputStream xmlInput) Look at some bytes fromxmlInput
to ensure it appears to be a FULL XML deposit and then use a regular expression to extract the watermark timestamp which is returned.static String
timestampToId
(org.joda.time.ReadableInstant timestamp) Generates an ID matching the regex\w{1,13}
from a millisecond timestamp.
-
Method Details
-
peekWatermark
public static org.joda.time.DateTime peekWatermark(BufferedInputStream xmlInput) throws IOException, XmlException Look at some bytes fromxmlInput
to ensure it appears to be a FULL XML deposit and then use a regular expression to extract the watermark timestamp which is returned.- Throws:
IOException
XmlException
-
findMostRecentPrefixForWatermark
public static String findMostRecentPrefixForWatermark(org.joda.time.DateTime watermark, String bucket, String tld, GcsUtils gcsUtils) throws HttpException.NoContentException Find the most recent folder in the given GCS bucket for the given watermark.- Throws:
HttpException.NoContentException
-
timestampToId
Generates an ID matching the regex\w{1,13}
from a millisecond timestamp.This routine works by turning the number of UTC milliseconds from the UNIX epoch into a big-endian byte-array which is then converted to a base32 string without padding that's no longer than 13 chars because
13 = Ceiling[Log[32, 2^64]]
. How lucky!
-