More work on debug_string

This commit is contained in:
2021-07-21 16:10:29 -04:00
parent c2a69b5b23
commit 49a4ec220d
6 changed files with 142 additions and 95 deletions

View File

@@ -72,12 +72,6 @@
#include "streambuffer.hpp"
class IdGlobalPool {
private:
std::vector<int64_t> salvaged_;
int64_t next_batch_;
int64_t next_id_;
friend int unittests_idalloc(lua_State *L);
public:
// Construct and destroy global pools. Note that after constructing
// a global pool, it is generally also necessary to initialize it
@@ -118,15 +112,18 @@ public:
// Serialize to or deserialize from a streambuffer.
void serialize(StreamBuffer *sb);
void deserialize(StreamBuffer *sb);
// Generate a debug string.
std::string debug_string() const;
private:
std::vector<int64_t> salvaged_;
int64_t next_batch_;
int64_t next_id_;
friend int unittests_idalloc(lua_State *L);
};
class IdPlayerPool {
private:
IdGlobalPool *global_;
int fifo_capacity_;
std::deque<int64_t> ranges_;
friend int unittests_idalloc(lua_State *L);
public:
// Construct a player pool.
//
@@ -189,6 +186,15 @@ public:
//
bool make_patch(const IdPlayerPool &auth, StreamBuffer *sb) const;
void apply_patch(StreamBuffer *sb);
// Debug string.
std::string debug_string() const;
private:
IdGlobalPool *global_;
int fifo_capacity_;
std::deque<int64_t> ranges_;
friend int unittests_idalloc(lua_State *L);
};
#endif // IDALLOC_HPP