diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-03-28 23:22:10 +0000 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2020-03-29 11:23:15 -0400 |
commit | 87b32bab05ff91981c8847d66cd5502feb44f3b5 (patch) | |
tree | ff77f6703185a8b9544f354de5853254ef88a4d8 /src/libstore/binary-cache-store.cc | |
parent | eb1911e277bfcc1b161cb996205ae1696f496099 (diff) |
Use `enum struct` and drop prefixes
This does a few enums; the rest will be gotten in subsequent commits.
Diffstat (limited to 'src/libstore/binary-cache-store.cc')
-rw-r--r-- | src/libstore/binary-cache-store.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 3a2d84861..a650bbfa6 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -134,7 +134,7 @@ void BinaryCacheStore::addToStore(const ValidPathInfo & info, const ref<std::str auto narInfo = make_ref<NarInfo>(info); narInfo->narSize = nar->size(); - narInfo->narHash = hashString(htSHA256, *nar); + narInfo->narHash = hashString(HashType::SHA256, *nar); if (info.narHash && info.narHash != narInfo->narHash) throw Error("refusing to copy corrupted path '%1%' to binary cache", printStorePath(info.path)); @@ -169,16 +169,16 @@ void BinaryCacheStore::addToStore(const ValidPathInfo & info, const ref<std::str auto now1 = std::chrono::steady_clock::now(); auto narCompressed = compress(compression, *nar, parallelCompression); auto now2 = std::chrono::steady_clock::now(); - narInfo->fileHash = hashString(htSHA256, *narCompressed); + narInfo->fileHash = hashString(HashType::SHA256, *narCompressed); narInfo->fileSize = narCompressed->size(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); - printMsg(lvlTalkative, "copying path '%1%' (%2% bytes, compressed %3$.1f%% in %4% ms) to binary cache", + printMsg(Verbosity::Talkative, "copying path '%1%' (%2% bytes, compressed %3$.1f%% in %4% ms) to binary cache", printStorePath(narInfo->path), narInfo->narSize, ((1.0 - (double) narCompressed->size() / nar->size()) * 100.0), duration); - narInfo->url = "nar/" + narInfo->fileHash.to_string(Base32, false) + ".nar" + narInfo->url = "nar/" + narInfo->fileHash.to_string(Base::Base32, false) + ".nar" + (compression == "xz" ? ".xz" : compression == "bzip2" ? ".bz2" : compression == "br" ? ".br" : @@ -206,7 +206,7 @@ void BinaryCacheStore::addToStore(const ValidPathInfo & info, const ref<std::str // to a GC'ed file, so overwriting might be useful... if (fileExists(key)) return; - printMsg(lvlTalkative, "creating debuginfo link from '%s' to '%s'", key, target); + printMsg(Verbosity::Talkative, "creating debuginfo link from '%s' to '%s'", key, target); upsertFile(key, json.dump(), "application/json"); }; @@ -299,7 +299,7 @@ void BinaryCacheStore::queryPathInfoUncached(const StorePath & storePath, { auto uri = getUri(); auto storePathS = printStorePath(storePath); - auto act = std::make_shared<Activity>(*logger, lvlTalkative, actQueryPathInfo, + auto act = std::make_shared<Activity>(*logger, Verbosity::Talkative, ActivityType::QueryPathInfo, fmt("querying info about '%s' on '%s'", storePathS, uri), Logger::Fields{storePathS, uri}); PushActivity pact(act->id); |