Class MetadataStorage

java.lang.Object
org.jgroups.raft.filelog.MetadataStorage

public class MetadataStorage extends Object
Stores the RAFT log metadata in a file.

The metadata includes the commit index, the current term and the last vote. The storage format keeps the fixed-size elements first and the vote last. The format follows:


 +----------------+--------------+------------------+
 |                |              |                  |
 | COMMIT 8 Bytes | TERM 8 Bytes | VOTE <Var> Bytes |
 |                |              |                  |
 +----------------+--------------+------------------+
 

The storage mmap the file to avoid syscalls. Since these variables have frequent access, the implementation accesses the direct positions in mmap.

Platform Dependent: The implementation does not utilize mmap in Windows. Due to restrictions on managing files in Windows, the data is read and written directly from the file.

Since:
0.5.4
Author:
Pedro Ruivo