| 118 | // Represents a file on the filesystem that is generated as the result |
| 119 | // of running some action. |
| 120 | class DiskArtifact |
| 121 | { |
| 122 | public: |
| 123 | static Try<DiskArtifact> create( |
| 124 | const std::string& filename, |
| 125 | time_t timestamp, |
| 126 | std::function<Try<Nothing>(const std::string& outputPath)> generator); |
| 127 | |
| 128 | const time_t getId() const; |
| 129 | |
| 130 | std::string getPath() const; |
| 131 | |
| 132 | // Generates an error response if the file doesn't exist, or a download |
| 133 | // if it does. |
| 134 | http::Response asHttp() const; |
| 135 | |
| 136 | private: |
| 137 | DiskArtifact(const std::string& path, time_t id); |
| 138 | |
| 139 | std::string path; |
| 140 | time_t id; |
| 141 | }; |
| 142 | |
| 143 | // This profile is obtained by telling jemalloc to dump its stats to a file. |
| 144 | Try<DiskArtifact> rawProfile = Error("Not yet generated"); |