about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/s3-binary-cache-store.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
commitb99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (patch)
tree1f76047dd027421dcf79cdf4804fa5ff1bb08b2b /third_party/nix/src/libstore/s3-binary-cache-store.cc
parent8cf1322a6fd5ae282d8a09fdba634f27a1a88560 (diff)
refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil r/845
Uses the equivalent absl::StartsWith and absl::EndsWith functions
instead.
Diffstat (limited to 'third_party/nix/src/libstore/s3-binary-cache-store.cc')
-rw-r--r--third_party/nix/src/libstore/s3-binary-cache-store.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/s3-binary-cache-store.cc b/third_party/nix/src/libstore/s3-binary-cache-store.cc
index 2b25fd874437..d713c5ce0151 100644
--- a/third_party/nix/src/libstore/s3-binary-cache-store.cc
+++ b/third_party/nix/src/libstore/s3-binary-cache-store.cc
@@ -3,6 +3,7 @@
 #include "s3-binary-cache-store.hh"
 
 #include <absl/strings/ascii.h>
+#include <absl/strings/match.h>
 #include <aws/core/Aws.h>
 #include <aws/core/VersionConfig.h>
 #include <aws/core/auth/AWSCredentialsProvider.h>
@@ -347,12 +348,12 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore {
 
   void upsertFile(const std::string& path, const std::string& data,
                   const std::string& mimeType) override {
-    if (narinfoCompression != "" && hasSuffix(path, ".narinfo"))
+    if (narinfoCompression != "" && absl::EndsWith(path, ".narinfo"))
       uploadFile(path, *compress(narinfoCompression, data), mimeType,
                  narinfoCompression);
-    else if (lsCompression != "" && hasSuffix(path, ".ls"))
+    else if (lsCompression != "" && absl::EndsWith(path, ".ls"))
       uploadFile(path, *compress(lsCompression, data), mimeType, lsCompression);
-    else if (logCompression != "" && hasPrefix(path, "log/"))
+    else if (logCompression != "" && absl::StartsWith(path, "log/"))
       uploadFile(path, *compress(logCompression, data), mimeType,
                  logCompression);
     else
@@ -400,7 +401,7 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore {
 
       for (auto object : contents) {
         auto& key = object.GetKey();
-        if (key.size() != 40 || !hasSuffix(key, ".narinfo")) {
+        if (key.size() != 40 || !absl::EndsWith(key, ".narinfo")) {
           continue;
         }
         paths.insert(storeDir + "/" + key.substr(0, key.size() - 8));