runner: initial automatic update (#2141)

This commit is contained in:
Andrey Nekrasov
2020-04-21 10:30:12 +03:00
committed by GitHub
parent e9ecdb3f56
commit 0354026292
37 changed files with 735 additions and 326 deletions

View File

@@ -2,11 +2,16 @@
#include <ctime>
#include <optional>
#include <functional>
// All fields must be default-initialized
struct UpdateState
{
std::optional<std::time_t> github_update_last_checked_date;
bool pending_update = false;
static UpdateState load();
void save();
// To prevent concurrent modification of the file, we enforce this interface, which locks the file while
// the state_modifier is active.
static void store(std::function<void(UpdateState&)> state_modifier);
static UpdateState read();
};