Class RaftEntrySBESerializer
java.lang.Object
io.atomix.raft.storage.serializer.RaftEntrySBESerializer
- All Implemented Interfaces:
RaftEntrySerializer
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.atomix.raft.storage.serializer.RaftEntrySerializer
RaftEntrySerializer.SerializedBufferWriterAdapter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDetermines the length in bytes of a serialized application entry.intDetermines the length in bytes of a serialized configuration entry.intDetermines the length in bytes of a serialized initial entry.readRaftLogEntry(org.agrona.DirectBuffer buffer) Read the raft log entry from the bufferintwriteApplicationEntry(long term, ApplicationEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Writes the term and entry into given buffer at the given offsetintwriteConfigurationEntry(long term, ConfigurationEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Writes the term and entry into given buffer at the given offsetintwriteInitialEntry(long term, InitialEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Writes the term and entry into given buffer at the given offset
-
Constructor Details
-
RaftEntrySBESerializer
public RaftEntrySBESerializer()
-
-
Method Details
-
getApplicationEntrySerializedLength
Description copied from interface:RaftEntrySerializerDetermines the length in bytes of a serialized application entry.- Specified by:
getApplicationEntrySerializedLengthin interfaceRaftEntrySerializer- Parameters:
entry- to determine the length in bytes for- Returns:
- the length in bytes when the entry gets serialized
-
getInitialEntrySerializedLength
public int getInitialEntrySerializedLength()Description copied from interface:RaftEntrySerializerDetermines the length in bytes of a serialized initial entry.- Specified by:
getInitialEntrySerializedLengthin interfaceRaftEntrySerializer- Returns:
- the length in bytes of a serialized initial entry
-
getConfigurationEntrySerializedLength
Description copied from interface:RaftEntrySerializerDetermines the length in bytes of a serialized configuration entry.- Specified by:
getConfigurationEntrySerializedLengthin interfaceRaftEntrySerializer- Parameters:
entry- to determine the length in bytes for- Returns:
- the length in bytes when the entry gets serialized
-
writeApplicationEntry
public int writeApplicationEntry(long term, ApplicationEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Description copied from interface:RaftEntrySerializerWrites the term and entry into given buffer at the given offset- Specified by:
writeApplicationEntryin interfaceRaftEntrySerializer- Parameters:
term- the term of the entryentry- the ApplicationEntry to writebuffer- the buffer to write tooffset- the offset in the buffer at which the term and entry will be written- Returns:
- the number of bytes written
-
writeInitialEntry
public int writeInitialEntry(long term, InitialEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Description copied from interface:RaftEntrySerializerWrites the term and entry into given buffer at the given offset- Specified by:
writeInitialEntryin interfaceRaftEntrySerializer- Parameters:
term- the term of the entryentry- the InitialEntry to writebuffer- the buffer to write tooffset- the offset in the buffer at which the term and entry will be written- Returns:
- the number of bytes written
-
writeConfigurationEntry
public int writeConfigurationEntry(long term, ConfigurationEntry entry, org.agrona.MutableDirectBuffer buffer, int offset) Description copied from interface:RaftEntrySerializerWrites the term and entry into given buffer at the given offset- Specified by:
writeConfigurationEntryin interfaceRaftEntrySerializer- Parameters:
term- the term of the entryentry- the ConfigurationEntry to writebuffer- the buffer to write tooffset- the offset in the buffer at which the term and entry will be written- Returns:
- the number of bytes written
-
readRaftLogEntry
Description copied from interface:RaftEntrySerializerRead the raft log entry from the buffer- Specified by:
readRaftLogEntryin interfaceRaftEntrySerializer- Parameters:
buffer- to read the raft log entry from- Returns:
- RaftLogEntry
-