<commit_before>/*
 * Copyright (C) 2014  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package c5db.log;

import c5db.generated.OLogContentType;
import c5db.generated.OLogEntryHeader;
import c5db.interfaces.log.SequentialEntry;
import c5db.interfaces.log.SequentialEntryCodec;
import c5db.interfaces.replication.QuorumConfiguration;
import c5db.replication.generated.QuorumConfigurationMessage;
import com.google.common.math.IntMath;
import io.protostuff.Schema;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

import static c5db.log.EntryEncodingUtil.CrcError;
import static c5db.log.EntryEncodingUtil.decodeAndCheckCrc;
import static c5db.log.EntryEncodingUtil.getAndCheckContent;
import static c5db.log.EntryEncodingUtil.skip;

public final class OLogEntryDescription extends SequentialEntry {
  private final long electionTerm;
  private final int contentLength;
  private final OLogContentType type;
  private final boolean headerCrcIsValid;
  private final boolean contentCrcIsValid;

  // Only used for type == QUORUM_CONFIGURATION
  private final QuorumConfiguration quorumConfiguration;
<commit_msg>Add documentation for class OLogEntryDescription<commit_after>/*
 * Copyright (C) 2014  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package c5db.log;

import c5db.generated.OLogContentType;
import c5db.generated.OLogEntryHeader;
import c5db.interfaces.log.SequentialEntry;
import c5db.interfaces.log.SequentialEntryCodec;
import c5db.interfaces.replication.QuorumConfiguration;
import c5db.replication.generated.QuorumConfigurationMessage;
import com.google.common.math.IntMath;
import io.protostuff.Schema;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

import static c5db.log.EntryEncodingUtil.CrcError;
import static c5db.log.EntryEncodingUtil.decodeAndCheckCrc;
import static c5db.log.EntryEncodingUtil.getAndCheckContent;
import static c5db.log.EntryEncodingUtil.skip;

/**
 * A description of an OLogEntry for use by reader utilities.
 * <p>
 * OLogEntry log entries encoded to some medium, such as a log file on disk, using
 * {@link c5db.log.OLogEntry.Codec} may be decoded (deserialized) using a different Codec.
 * This class and its Codec are one such example. Their goal is to look at a serialized
 * OLogEntry and describe its features. The intended use of this is for readers such
 * as CatOLog that may wish to analyze and display features of the serialized entry
 * not normally visible when decoded as an OLogEntry object, such as CRC check validity.
 * <p>
 * As such, the provided Codec below can only decode, not encode.
 */
public final class OLogEntryDescription extends SequentialEntry {
  private final long electionTerm;
  private final int contentLength;
  private final OLogContentType type;
  private final boolean headerCrcIsValid;
  private final boolean contentCrcIsValid;

  // Only used for type == QUORUM_CONFIGURATION
  private final QuorumConfiguration quorumConfiguration;

{'fraction_non_alphanumeric': 0.06295173700163208, 'fraction_numerical': 0.007694101189088366, 'mean_word_length': 4.735294117647059, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4624646', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1179, 'n_words': 467}