diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-03-15T16·20+0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-03-15T16·20+0100 |
commit | 3f35612c041ecc4e6a4f29f01d5a87fba983cf0f (patch) | |
tree | b7db6ed646771d7c1c0bf4bc7735691fb66c2b75 /src | |
parent | 25dff2b7dbab54bd97b5ec22a05e594504555a12 (diff) |
More precise compression settings
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/s3-binary-cache-store.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 3804e0b0fb8f..571bf7dfd801 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -141,15 +141,16 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore S3Helper s3Helper; - std::string textCompression, logCompression; + std::string narinfoCompression, lsCompression, logCompression; S3BinaryCacheStoreImpl( const Params & params, const std::string & bucketName) : S3BinaryCacheStore(params) , bucketName(bucketName) , s3Helper(get(params, "aws-region", Aws::Region::US_EAST_1)) - , textCompression(get(params, "text-compression", "")) - , logCompression(get(params, "log-compression", textCompression)) + , narinfoCompression(get(params, "narinfo-compression", "")) + , lsCompression(get(params, "ls-compression", "")) + , logCompression(get(params, "log-compression", "")) { diskCache = getNarInfoDiskCache(); } @@ -267,8 +268,10 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore void upsertFile(const std::string & path, const std::string & data, const std::string & mimeType) override { - if (textCompression != "" && (hasSuffix(path, ".narinfo") || hasSuffix(path, ".ls"))) - uploadFile(path, *compress(textCompression, data), mimeType, textCompression); + if (narinfoCompression != "" && hasSuffix(path, ".narinfo")) + 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/")) uploadFile(path, *compress(logCompression, data), mimeType, logCompression); else |