Serialization for idalloc and animqueue

This commit is contained in:
2021-03-13 13:05:00 -05:00
parent 2e0befe817
commit 4426fa157a
7 changed files with 289 additions and 39 deletions

View File

@@ -76,7 +76,7 @@ private:
std::vector<int64_t> salvaged_;
int64_t next_batch_;
int64_t next_id_;
int queue_fill_;
int32_t queue_fill_;
friend int unittests_idalloc(lua_State *L);
public:
@@ -120,10 +120,8 @@ public:
// batch if possible. If not, fetches one ID from the global pool.
int64_t alloc_id_for_thread(lua_State *L);
// Serialize to a streambuffer.
// Serialize to or deserialize from a streambuffer.
void serialize(StreamBuffer *sb);
// Deserialize from a streambuffer.
void deserialize(StreamBuffer *sb);
};
@@ -163,10 +161,9 @@ public:
// Return the size of the queue.
int size() { return ranges_.size(); }
// Serialize to a streambuffer.
// Serialize to or deserialize from a streambuffer.
// Caution: the pointer to the global pool is not serialized or deserialized.
void serialize(StreamBuffer *sb);
// Deserialize from a streambuffer.
void deserialize(StreamBuffer *sb);
};