paxos/src/legislator/ledger.hh

34 lines
584 B
C++
Raw Normal View History

2020-05-05 17:29:14 +00:00
#pragma once
#include <string>
#include <vector>
#include "law/decree.hh"
#include "vote.hh"
2020-05-05 17:29:14 +00:00
namespace paxos
{
class Ledger
{
public:
Ledger(std::string path);
2020-05-05 22:23:23 +00:00
Decree get_decree();
void set_decree(Decree decree);
2020-05-05 17:29:14 +00:00
int last_tried();
void set_last_tried(int b);
Vote prev_vote();
void set_prev_vote(Vote v);
2020-05-05 17:29:14 +00:00
int next_bal();
void set_next_bal(int b);
private:
std::string base_path_;
int read_file(std::string path);
void write_file(std::string path, int n);
};
}