More precise compression settings
This commit is contained in:
parent
25dff2b7db
commit
3f35612c04
1 changed files with 8 additions and 5 deletions
|
@ -141,15 +141,16 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
|
||||||
|
|
||||||
S3Helper s3Helper;
|
S3Helper s3Helper;
|
||||||
|
|
||||||
std::string textCompression, logCompression;
|
std::string narinfoCompression, lsCompression, logCompression;
|
||||||
|
|
||||||
S3BinaryCacheStoreImpl(
|
S3BinaryCacheStoreImpl(
|
||||||
const Params & params, const std::string & bucketName)
|
const Params & params, const std::string & bucketName)
|
||||||
: S3BinaryCacheStore(params)
|
: S3BinaryCacheStore(params)
|
||||||
, bucketName(bucketName)
|
, bucketName(bucketName)
|
||||||
, s3Helper(get(params, "aws-region", Aws::Region::US_EAST_1))
|
, s3Helper(get(params, "aws-region", Aws::Region::US_EAST_1))
|
||||||
, textCompression(get(params, "text-compression", ""))
|
, narinfoCompression(get(params, "narinfo-compression", ""))
|
||||||
, logCompression(get(params, "log-compression", textCompression))
|
, lsCompression(get(params, "ls-compression", ""))
|
||||||
|
, logCompression(get(params, "log-compression", ""))
|
||||||
{
|
{
|
||||||
diskCache = getNarInfoDiskCache();
|
diskCache = getNarInfoDiskCache();
|
||||||
}
|
}
|
||||||
|
@ -267,8 +268,10 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
|
||||||
void upsertFile(const std::string & path, const std::string & data,
|
void upsertFile(const std::string & path, const std::string & data,
|
||||||
const std::string & mimeType) override
|
const std::string & mimeType) override
|
||||||
{
|
{
|
||||||
if (textCompression != "" && (hasSuffix(path, ".narinfo") || hasSuffix(path, ".ls")))
|
if (narinfoCompression != "" && hasSuffix(path, ".narinfo"))
|
||||||
uploadFile(path, *compress(textCompression, data), mimeType, textCompression);
|
uploadFile(path, *compress(narinfoCompression, data), mimeType, narinfoCompression);
|
||||||
|
else if (lsCompression != "" && hasSuffix(path, ".ls"))
|
||||||
|
uploadFile(path, *compress(lsCompression, data), mimeType, lsCompression);
|
||||||
else if (logCompression != "" && hasPrefix(path, "log/"))
|
else if (logCompression != "" && hasPrefix(path, "log/"))
|
||||||
uploadFile(path, *compress(logCompression, data), mimeType, logCompression);
|
uploadFile(path, *compress(logCompression, data), mimeType, logCompression);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue