support obs storage

This commit is contained in:
MaxWk 2021-09-29 14:11:28 +08:00
parent 2805c28e65
commit 723ff795a8

View File

@ -603,7 +603,7 @@ namespace S3
/// Case when bucket name represented in domain name of S3 URL.
/// E.g. (https://bucket-name.s3.Region.amazonaws.com/key)
/// https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#virtual-hosted-style-access
static const RE2 virtual_hosted_style_pattern(R"((.+)\.(s3|cos)([.\-][a-z0-9\-.:]+))");
static const RE2 virtual_hosted_style_pattern(R"((.+)\.(s3|cos|obs)([.\-][a-z0-9\-.:]+))");
/// Case when bucket name and key represented in path of S3 URL.
/// E.g. (https://s3.Region.amazonaws.com/bucket-name/key)
@ -613,6 +613,8 @@ namespace S3
static constexpr auto S3 = "S3";
static constexpr auto COSN = "COSN";
static constexpr auto COS = "COS";
static constexpr auto OBS = "OBS";
uri = uri_;
storage_name = S3;
@ -636,7 +638,7 @@ namespace S3
}
boost::to_upper(name);
if (name != S3 && name != COS)
if (name != S3 && name != COS && name != OBS)
{
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Object storage system name is unrecognized in virtual hosted style S3 URI: {}", quoteString(name));
}
@ -644,6 +646,10 @@ namespace S3
{
storage_name = name;
}
else if (name == OBS)
{
storage_name = OBS;
}
else
{
storage_name = COSN;