aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/log-store.hh
blob: b807e3e71de894166f2b401fdbd46f4e9c7b4156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "store-api.hh"


namespace nix {

struct LogStore : public virtual Store
{
    inline static std::string operationName = "Build log storage and retrieval";

    /* Return the build log of the specified store path, if available,
       or null otherwise. */
    std::optional<std::string> getBuildLog(const StorePath & path) {
      auto maybePath = getBuildDerivationPath(path);
      if (!maybePath)
          return std::nullopt;
      return getBuildLogExact(maybePath.value());
    }

    virtual std::optional<std::string> getBuildLogExact(const StorePath & path) = 0;

    virtual void addBuildLog(const StorePath & path, std::string_view log) = 0;

    static LogStore & require(Store & store);
};

}