<commit_before>package com.twitter.finagle.mux.transport

import com.twitter.finagle.mux.ContextCodec
import com.twitter.finagle.tracing.{Flags, SpanId, TraceId}
import com.twitter.finagle.{Dentry, Dtab, Failure, NameTree, Path}
import com.twitter.io.{Buf, BufByteWriter, ByteReader}
import com.twitter.util.{Duration, Future, Time}
import java.nio.charset.{StandardCharsets => Charsets}
import scala.collection.mutable.ArrayBuffer

/**
 * Indicates that encoding or decoding of a Mux message failed.
 * Reason for failure should be provided by the `why` string.
 */
case class BadMessageException(why: String) extends Exception(why)

/**
 * Documentation details are in the [[com.twitter.finagle.mux]] package object.
 */
private[finagle] sealed trait Message {

  /**
   * Values should correspond to the constants defined in
   * [[com.twitter.finagle.mux.transport.Message.Types]]
   */
  def typ: Byte

  /** Only 3 of its bytes are used. */
  def tag: Int

  /**
   * The body of the message omitting size, typ, and tag.
   */
  def buf: Buf
}

private[finagle] object Message {

  object Types {

    def isDiscard(typ: Byte): Boolean =
      typ == Message.Types.BAD_Tdiscarded ||
        typ == Message.Types.Rdiscarded ||
        typ == Message.Types.Tdiscarded

    private[mux] def isRefCounted(typ: Byte): Boolean =
      (typ == Types.Tping || typ == Types.Rping
        || typ == Types.Tdiscarded || typ == Types.Rdiscarded
        || typ == Types.Tdrain || typ == Types.Rdrain
        || typ == Types.Tlease)

    // Application messages:
    val Treq = 1: Byte
    val Rreq = -1: Byte

    val Tdispatch = 2: Byte
    val Rdispatch = -2: Byte

    // Control messages:
    val Tdrain = 64: Byte
    val Rdrain = -64: Byte
    val Tping = 65: Byte
    val Rping = -65: Byte

    val Tdiscarded = 66: Byte
    val Rdiscarded = -66: Byte

    val Tlease = 67: Byte

    val Tinit = 68: Byte<commit_msg>finagle-mux: Remove some dead code from Message<commit_after>package com.twitter.finagle.mux.transport

import com.twitter.finagle.mux.ContextCodec
import com.twitter.finagle.tracing.{Flags, SpanId, TraceId}
import com.twitter.finagle.{Dentry, Dtab, Failure, NameTree, Path}
import com.twitter.io.{Buf, BufByteWriter, ByteReader}
import com.twitter.util.{Duration, Future, Time}
import java.nio.charset.{StandardCharsets => Charsets}
import scala.collection.mutable.ArrayBuffer

/**
 * Indicates that encoding or decoding of a Mux message failed.
 * Reason for failure should be provided by the `why` string.
 */
case class BadMessageException(why: String) extends Exception(why)

/**
 * Documentation details are in the [[com.twitter.finagle.mux]] package object.
 */
private[finagle] sealed trait Message {

  /**
   * Values should correspond to the constants defined in
   * [[com.twitter.finagle.mux.transport.Message.Types]]
   */
  def typ: Byte

  /** Only 3 of its bytes are used. */
  def tag: Int

  /**
   * The body of the message omitting size, typ, and tag.
   */
  def buf: Buf
}

private[finagle] object Message {

  object Types {

    def isDiscard(typ: Byte): Boolean =
      typ == Message.Types.BAD_Tdiscarded ||
        typ == Message.Types.Rdiscarded ||
        typ == Message.Types.Tdiscarded

    // Application messages:
    val Treq = 1: Byte
    val Rreq = -1: Byte

    val Tdispatch = 2: Byte
    val Rdispatch = -2: Byte

    // Control messages:
    val Tdrain = 64: Byte
    val Rdrain = -64: Byte
    val Tping = 65: Byte
    val Rping = -65: Byte

    val Tdiscarded = 66: Byte
    val Rdiscarded = -66: Byte

    val Tlease = 67: Byte

    val Tinit = 68: Byte
{'fraction_non_alphanumeric': 0.11237199003598118, 'fraction_numerical': 0.011624688624411846, 'mean_word_length': 3.0561167227833894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6002171', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1114, 'n_words': 358}