public class AppendRequest extends Object implements IdentifiedDataSerializable
See 5.3 Log replication section of In Search of an Understandable Consensus Algorithm paper by Diego Ongaro and John Ousterhout.
Invoked by leader to replicate log entries (§5.3); also used as heartbeat (§5.2).
Constructor and Description |
---|
AppendRequest() |
AppendRequest(Endpoint leader,
int term,
int prevLogTerm,
long prevLogIndex,
long leaderCommitIndex,
LogEntry[] entries) |
Modifier and Type | Method and Description |
---|---|
LogEntry[] |
entries() |
int |
entryCount() |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
Endpoint |
leader() |
long |
leaderCommitIndex() |
long |
prevLogIndex() |
int |
prevLogTerm() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
int |
term() |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public Endpoint leader()
public int term()
public int prevLogTerm()
public long prevLogIndex()
public long leaderCommitIndex()
public LogEntry[] entries()
public int entryCount()
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.