// Path: src/main/java/org/tools4j/hoverraft/command/LogKey.java
// public interface LogKey extends Comparable<LogKey> {
//     Comparator<LogKey> COMPARATOR = (k1, k2) -> {
//         final int termCompare = Integer.compare(k1.term(), k2.term());
//         return termCompare == 0 ? Long.compare(k1.index(), k2.index()) : termCompare;
//     };
// 
//     int term();
//     LogKey term(int term);
// 
//     long index();
//     LogKey index(long index);
// 
//     @Override
//     default int compareTo(final LogKey other) {
//         return COMPARATOR.compare(this, other);
//     }
// 
//     default LogContainment containedIn(final CommandLog commandLog) {
//         return LogContainment.containmentFor(this, commandLog);
//     }
// 
// }
// 
// Path: src/main/java/org/tools4j/hoverraft/message/MessageType.java
// public enum MessageType {
//     VOTE_REQUEST {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.voteRequest();
//         }
//     },
//     VOTE_RESPONSE {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.voteResponse();
//         }
//     },
//     APPEND_REQUEST {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.appendRequest();
//         }
//     },
//     APPEND_RESPONSE {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.appendResponse();
//         }
//     },
//     TIMEOUT_NOW {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.timeoutNow();
//         }
//     };
// 
//     private static final MessageType[] VALUES = values();
// 
//     public static final MessageType valueByOrdinal(final int ordinal) {
//         return VALUES[ordinal];
//     }
// 
//     public static final int maxOrdinal() {
//         return VALUES.length - 1;
//     }
// 
//     abstract public Message create(DirectFactory factory);
// 
//     public static MessageType readFrom(final DirectBuffer directBuffer, final int offset) {
//         final int type = directBuffer.getInt(offset);
//         if (type >= 0 & type <= MessageType.maxOrdinal()) {
//             return MessageType.valueByOrdinal(type);
//         }
//         throw new IllegalArgumentException("Illegal message type: " + type);
//     }
// 
// 
// }
// 
// Path: src/main/java/org/tools4j/hoverraft/message/VoteRequest.java
// public interface VoteRequest extends Message {
// 
//     int term();
// 
//     VoteRequest term(int term);
// 
//     int candidateId();
// 
//     VoteRequest candidateId(int candidateId);
// 
//     LogKey lastLogKey();
// 
//     @Override
//     default Transition accept(final ServerContext serverContext, final EventHandler eventHandler) {
//         return eventHandler.onVoteRequest(serverContext, this);
//     }
// }


import org.agrona.DirectBuffer;
import org.agrona.MutableDirectBuffer;
import org.tools4j.hoverraft.command.LogKey;
import org.tools4j.hoverraft.message.MessageType;
import org.tools4j.hoverraft.message.VoteRequest;
    }

    @Override
    public int byteLength() {
        return BYTE_LENGTH;
    }

    @Override
    public int term() {
        return readBuffer.getInt(offset + TERM_OFF);
    }

    @Override
    public DirectVoteRequest term(final int term) {
        writeBuffer.putInt(offset + TERM_OFF, term);
        return this;
    }

    @Override
    public int candidateId() {
        return readBuffer.getInt(offset + CANDIDATE_ID_OFF);
    }

    @Override
    public DirectVoteRequest candidateId(final int candidateId) {
        writeBuffer.putInt(offset + CANDIDATE_ID_OFF, candidateId);
        return this;
    }

    @Override
// Path: src/main/java/org/tools4j/hoverraft/command/LogKey.java
// public interface LogKey extends Comparable<LogKey> {
//     Comparator<LogKey> COMPARATOR = (k1, k2) -> {
//         final int termCompare = Integer.compare(k1.term(), k2.term());
//         return termCompare == 0 ? Long.compare(k1.index(), k2.index()) : termCompare;
//     };
// 
//     int term();
//     LogKey term(int term);
// 
//     long index();
//     LogKey index(long index);
// 
//     @Override
//     default int compareTo(final LogKey other) {
//         return COMPARATOR.compare(this, other);
//     }
// 
//     default LogContainment containedIn(final CommandLog commandLog) {
//         return LogContainment.containmentFor(this, commandLog);
//     }
// 
// }
// 
// Path: src/main/java/org/tools4j/hoverraft/message/MessageType.java
// public enum MessageType {
//     VOTE_REQUEST {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.voteRequest();
//         }
//     },
//     VOTE_RESPONSE {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.voteResponse();
//         }
//     },
//     APPEND_REQUEST {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.appendRequest();
//         }
//     },
//     APPEND_RESPONSE {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.appendResponse();
//         }
//     },
//     TIMEOUT_NOW {
//         @Override
//         public Message create(final DirectFactory factory) {
//             return factory.timeoutNow();
//         }
//     };
// 
//     private static final MessageType[] VALUES = values();
// 
//     public static final MessageType valueByOrdinal(final int ordinal) {
//         return VALUES[ordinal];
//     }
// 
//     public static final int maxOrdinal() {
//         return VALUES.length - 1;
//     }
// 
//     abstract public Message create(DirectFactory factory);
// 
//     public static MessageType readFrom(final DirectBuffer directBuffer, final int offset) {
//         final int type = directBuffer.getInt(offset);
//         if (type >= 0 & type <= MessageType.maxOrdinal()) {
//             return MessageType.valueByOrdinal(type);
//         }
//         throw new IllegalArgumentException("Illegal message type: " + type);
//     }
// 
// 
// }
// 
// Path: src/main/java/org/tools4j/hoverraft/message/VoteRequest.java
// public interface VoteRequest extends Message {
// 
//     int term();
// 
//     VoteRequest term(int term);
// 
//     int candidateId();
// 
//     VoteRequest candidateId(int candidateId);
// 
//     LogKey lastLogKey();
// 
//     @Override
//     default Transition accept(final ServerContext serverContext, final EventHandler eventHandler) {
//         return eventHandler.onVoteRequest(serverContext, this);
//     }
// }


// Path: src/main/java/org/tools4j/hoverraft/message/direct/DirectVoteRequest.java
import org.agrona.DirectBuffer;
import org.agrona.MutableDirectBuffer;
import org.tools4j.hoverraft.command.LogKey;
import org.tools4j.hoverraft.message.MessageType;
import org.tools4j.hoverraft.message.VoteRequest;

    }

    @Override
    public int byteLength() {
        return BYTE_LENGTH;
    }

    @Override
    public int term() {
        return readBuffer.getInt(offset + TERM_OFF);
    }

    @Override
    public DirectVoteRequest term(final int term) {
        writeBuffer.putInt(offset + TERM_OFF, term);
        return this;
    }

    @Override
    public int candidateId() {
        return readBuffer.getInt(offset + CANDIDATE_ID_OFF);
    }

    @Override
    public DirectVoteRequest candidateId(final int candidateId) {
        writeBuffer.putInt(offset + CANDIDATE_ID_OFF, candidateId);
        return this;
    }

    @Override
    public LogKey lastLogKey() {