aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-01-18 16:14:01 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-01-18 16:14:01 +0100
commit5b243a2b4bf88f41c87569773af84671ba83e890 (patch)
tree52b2853d34e963a1452e830c2381a59113ce2f16
parent4dda1f92aae05dd9d633152458d65a3815bcd03c (diff)
BinaryCacheStore: Implement addBuildLog()
-rw-r--r--src/libstore/binary-cache-store.cc10
-rw-r--r--src/libstore/binary-cache-store.hh3
-rw-r--r--src/libstore/local-binary-cache-store.cc1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index 7d25e2160..6e4458f7a 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -512,4 +512,14 @@ std::optional<std::string> BinaryCacheStore::getBuildLog(const StorePath & path)
return getFile(logPath);
}
+void BinaryCacheStore::addBuildLog(const StorePath & drvPath, std::string_view log)
+{
+ assert(drvPath.isDerivation());
+
+ upsertFile(
+ "log/" + std::string(drvPath.to_string()),
+ (std::string) log, // FIXME: don't copy
+ "text/plain; charset=utf-8");
+}
+
}
diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh
index 46ff67c77..7599230d9 100644
--- a/src/libstore/binary-cache-store.hh
+++ b/src/libstore/binary-cache-store.hh
@@ -51,6 +51,7 @@ public:
const std::string & mimeType) = 0;
void upsertFile(const std::string & path,
+ // FIXME: use std::string_view
std::string && data,
const std::string & mimeType);
@@ -120,6 +121,8 @@ public:
std::optional<std::string> getBuildLog(const StorePath & path) override;
+ void addBuildLog(const StorePath & drvPath, std::string_view log) override;
+
};
MakeError(NoSuchBinaryCacheFile, Error);
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index f93111fce..f754770f9 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -96,6 +96,7 @@ void LocalBinaryCacheStore::init()
createDirs(binaryCacheDir + "/" + realisationsPrefix);
if (writeDebugInfo)
createDirs(binaryCacheDir + "/debuginfo");
+ createDirs(binaryCacheDir + "/log");
BinaryCacheStore::init();
}