aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/s3-binary-cache-store.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-03-17 19:14:18 -0700
committerJade Lovelace <lix@jade.fyi>2024-03-17 20:17:19 -0700
commit61e21b25576f7f3491f6a837bf59d8b44c6897a0 (patch)
tree3f62d83b3bab84afcf1011b5c2353226b84313b3 /src/libstore/s3-binary-cache-store.cc
parent706cee5c493b39e25bdb0add55d2e1771dc31696 (diff)
Delete hasPrefix and hasSuffix from the codebase
These now have equivalents in the standard lib in C++20. This change was performed with a custom clang-tidy check which I will submit later. Executed like so: ninja -C build && run-clang-tidy -checks='-*,nix-*' -load=build/libnix-clang-tidy.so -p .. -fix ../tests | tee -a clang-tidy-result Change-Id: I62679e315ff9e7ce72a40b91b79c3e9fc01b27e9
Diffstat (limited to 'src/libstore/s3-binary-cache-store.cc')
-rw-r--r--src/libstore/s3-binary-cache-store.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index 1a62d92d4..cf5f125d4 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -213,7 +213,7 @@ struct S3BinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
support it.
> **Note**
- >
+ >
> HTTPS should be used if the cache might contain sensitive
> information.
)"};
@@ -224,7 +224,7 @@ struct S3BinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
Do not specify this setting if you're using Amazon S3.
> **Note**
- >
+ >
> This endpoint must support HTTPS and will use path-based
> addressing instead of virtual host based addressing.
)"};
@@ -448,11 +448,11 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual
return std::make_shared<std::stringstream>(std::move(compressed));
};
- if (narinfoCompression != "" && hasSuffix(path, ".narinfo"))
+ if (narinfoCompression != "" && path.ends_with(".narinfo"))
uploadFile(path, compress(narinfoCompression), mimeType, narinfoCompression);
- else if (lsCompression != "" && hasSuffix(path, ".ls"))
+ else if (lsCompression != "" && path.ends_with(".ls"))
uploadFile(path, compress(lsCompression), mimeType, lsCompression);
- else if (logCompression != "" && hasPrefix(path, "log/"))
+ else if (logCompression != "" && path.starts_with("log/"))
uploadFile(path, compress(logCompression), mimeType, logCompression);
else
uploadFile(path, istream, mimeType, "");
@@ -499,7 +499,7 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual
for (auto object : contents) {
auto & key = object.GetKey();
- if (key.size() != 40 || !hasSuffix(key, ".narinfo")) continue;
+ if (key.size() != 40 || !key.ends_with(".narinfo")) continue;
paths.insert(parseStorePath(storeDir + "/" + key.substr(0, key.size() - 8) + "-" + MissingName));
}