Esempio n. 1
0
        internal static string FindLatestDbVersion(S3Token token, RestClient rest)
        {
            // TODO: Sort out binary/text Get
            var info = GetS3Object("1/spc.info", token, "the database info", rest).ToUtf8();

            var re = new Regex(@"VERSION\s+(\d+)");
            var m  = re.Match(info);

            if (!m.Success)
            {
                throw new InternalErrorException("Invalid database info format");
            }

            return(m.Groups[1].Value);
        }
Esempio n. 2
0
 private static byte[] GetS3Object(string filename, S3Token token, string name, RestClient rest)
 {
     return(S3.GetObject(token.BucketName, token.ObjectPrefix + filename, token.Credentials, rest));
 }
Esempio n. 3
0
        internal static byte[] DownloadDb(string version, S3Token token, RestClient rest)
        {
            var db = GetS3Object($"1/db_{version}.dmp", token, "the database", rest);

            return(Inflate(db, "the database"));
        }
Esempio n. 4
0
        internal static byte[] DownloadLatestDb(S3Token token, RestClient rest)
        {
            var version = FindLatestDbVersion(token, rest);

            return(DownloadDb(version, token, rest));
        }
Esempio n. 5
0
 // This functions finds out what the latest version of the database is and downloads
 // it from S3.
 internal static byte[] DownloadLatestDb(S3Token token, IRestTransport transport)
 {
     return(DownloadLatestDb(token, new RestClient(transport)));
 }