All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scray.service.qmodel.thrifscala.ScrayTQueryInfo.scala Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
/**
 * Generated by Scrooge
 *   version: 4.16.0
 *   rev: 0201cac9fdd6188248d42da91fd14c87744cc4a5
 *   built at: 20170421-124523
 */
package scray.service.qmodel.thrifscala

import com.twitter.scrooge.{
  HasThriftStructCodec3,
  LazyTProtocol,
  TFieldBlob,
  ThriftException,
  ThriftStruct,
  ThriftStructCodec3,
  ThriftStructFieldInfo,
  ThriftStructMetaData,
  ThriftUtil
}
import org.apache.thrift.protocol._
import org.apache.thrift.transport.{TMemoryBuffer, TTransport}
import java.nio.ByteBuffer
import java.util.Arrays
import scala.collection.immutable.{Map => immutable$Map}
import scala.collection.mutable.Builder
import scala.collection.mutable.{
  ArrayBuffer => mutable$ArrayBuffer, Buffer => mutable$Buffer,
  HashMap => mutable$HashMap, HashSet => mutable$HashSet}
import scala.collection.{Map, Set}

/**
 * Query identifier
 */
object ScrayTQueryInfo extends ThriftStructCodec3[ScrayTQueryInfo] {
  private val NoPassthroughFields = immutable$Map.empty[Short, TFieldBlob]
  val Struct = new TStruct("ScrayTQueryInfo")
  val QueryIdField = new TField("queryId", TType.STRUCT, 1)
  val QueryIdFieldManifest = implicitly[Manifest[scray.service.qmodel.thrifscala.ScrayUUID]]
  val QuerySpaceField = new TField("querySpace", TType.STRING, 2)
  val QuerySpaceFieldManifest = implicitly[Manifest[String]]
  val TableInfoField = new TField("tableInfo", TType.STRUCT, 3)
  val TableInfoFieldManifest = implicitly[Manifest[scray.service.qmodel.thrifscala.ScrayTTableInfo]]
  val ColumnsField = new TField("columns", TType.LIST, 4)
  val ColumnsFieldManifest = implicitly[Manifest[Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo]]]
  val PagesizeField = new TField("pagesize", TType.I32, 5)
  val PagesizeFieldManifest = implicitly[Manifest[Int]]
  val ExpiresField = new TField("expires", TType.I64, 6)
  val ExpiresFieldManifest = implicitly[Manifest[Long]]

  /**
   * Field information in declaration order.
   */
  lazy val fieldInfos: scala.List[ThriftStructFieldInfo] = scala.List[ThriftStructFieldInfo](
    new ThriftStructFieldInfo(
      QueryIdField,
      true,
      false,
      QueryIdFieldManifest,
      _root_.scala.None,
      _root_.scala.None,
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    ),
    new ThriftStructFieldInfo(
      QuerySpaceField,
      false,
      false,
      QuerySpaceFieldManifest,
      _root_.scala.None,
      _root_.scala.None,
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    ),
    new ThriftStructFieldInfo(
      TableInfoField,
      false,
      false,
      TableInfoFieldManifest,
      _root_.scala.None,
      _root_.scala.None,
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    ),
    new ThriftStructFieldInfo(
      ColumnsField,
      false,
      false,
      ColumnsFieldManifest,
      _root_.scala.None,
      _root_.scala.Some(implicitly[Manifest[scray.service.qmodel.thrifscala.ScrayTColumnInfo]]),
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    ),
    new ThriftStructFieldInfo(
      PagesizeField,
      true,
      false,
      PagesizeFieldManifest,
      _root_.scala.None,
      _root_.scala.None,
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    ),
    new ThriftStructFieldInfo(
      ExpiresField,
      true,
      false,
      ExpiresFieldManifest,
      _root_.scala.None,
      _root_.scala.None,
      immutable$Map.empty[String, String],
      immutable$Map.empty[String, String],
      None
    )
  )

  lazy val structAnnotations: immutable$Map[String, String] =
    immutable$Map.empty[String, String]

  /**
   * Checks that all required fields are non-null.
   */
  def validate(_item: ScrayTQueryInfo): Unit = {
  }

  def withoutPassthroughFields(original: ScrayTQueryInfo): ScrayTQueryInfo =
    new Immutable(
      queryId =
        {
          val field = original.queryId
          field.map { field =>
            scray.service.qmodel.thrifscala.ScrayUUID.withoutPassthroughFields(field)
          }
        },
      querySpace =
        {
          val field = original.querySpace
          field
        },
      tableInfo =
        {
          val field = original.tableInfo
          scray.service.qmodel.thrifscala.ScrayTTableInfo.withoutPassthroughFields(field)
        },
      columns =
        {
          val field = original.columns
          field.map { field =>
            scray.service.qmodel.thrifscala.ScrayTColumnInfo.withoutPassthroughFields(field)
          }
        },
      pagesize =
        {
          val field = original.pagesize
          field.map { field =>
            field
          }
        },
      expires =
        {
          val field = original.expires
          field.map { field =>
            field
          }
        }
    )

  override def encode(_item: ScrayTQueryInfo, _oproto: TProtocol): Unit = {
    _item.write(_oproto)
  }

  private[this] def lazyDecode(_iprot: LazyTProtocol): ScrayTQueryInfo = {

    var queryId: Option[scray.service.qmodel.thrifscala.ScrayUUID] = None
    var querySpaceOffset: Int = -1
    var tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = null
    var columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo]()
    var pagesizeOffset: Int = -1
    var expiresOffset: Int = -1

    var _passthroughFields: Builder[(Short, TFieldBlob), immutable$Map[Short, TFieldBlob]] = null
    var _done = false
    val _start_offset = _iprot.offset

    _iprot.readStructBegin()
    while (!_done) {
      val _field = _iprot.readFieldBegin()
      if (_field.`type` == TType.STOP) {
        _done = true
      } else {
        _field.id match {
          case 1 =>
            _field.`type` match {
              case TType.STRUCT =>
    
                queryId = Some(readQueryIdValue(_iprot))
              case _actualType =>
                val _expectedType = TType.STRUCT
                throw new TProtocolException(
                  "Received wrong type for field 'queryId' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 2 =>
            _field.`type` match {
              case TType.STRING =>
                querySpaceOffset = _iprot.offsetSkipString
    
              case _actualType =>
                val _expectedType = TType.STRING
                throw new TProtocolException(
                  "Received wrong type for field 'querySpace' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 3 =>
            _field.`type` match {
              case TType.STRUCT =>
    
                tableInfo = readTableInfoValue(_iprot)
              case _actualType =>
                val _expectedType = TType.STRUCT
                throw new TProtocolException(
                  "Received wrong type for field 'tableInfo' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 4 =>
            _field.`type` match {
              case TType.LIST =>
    
                columns = readColumnsValue(_iprot)
              case _actualType =>
                val _expectedType = TType.LIST
                throw new TProtocolException(
                  "Received wrong type for field 'columns' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 5 =>
            _field.`type` match {
              case TType.I32 =>
                pagesizeOffset = _iprot.offsetSkipI32
    
              case _actualType =>
                val _expectedType = TType.I32
                throw new TProtocolException(
                  "Received wrong type for field 'pagesize' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 6 =>
            _field.`type` match {
              case TType.I64 =>
                expiresOffset = _iprot.offsetSkipI64
    
              case _actualType =>
                val _expectedType = TType.I64
                throw new TProtocolException(
                  "Received wrong type for field 'expires' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case _ =>
            if (_passthroughFields == null)
              _passthroughFields = immutable$Map.newBuilder[Short, TFieldBlob]
            _passthroughFields += (_field.id -> TFieldBlob.read(_field, _iprot))
        }
        _iprot.readFieldEnd()
      }
    }
    _iprot.readStructEnd()

    new LazyImmutable(
      _iprot,
      _iprot.buffer,
      _start_offset,
      _iprot.offset,
      queryId,
      querySpaceOffset,
      tableInfo,
      columns,
      pagesizeOffset,
      expiresOffset,
      if (_passthroughFields == null)
        NoPassthroughFields
      else
        _passthroughFields.result()
    )
  }

  override def decode(_iprot: TProtocol): ScrayTQueryInfo =
    _iprot match {
      case i: LazyTProtocol => lazyDecode(i)
      case i => eagerDecode(i)
    }

  private[this] def eagerDecode(_iprot: TProtocol): ScrayTQueryInfo = {
    var queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = _root_.scala.None
    var querySpace: String = null
    var tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = null
    var columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo]()
    var pagesize: _root_.scala.Option[Int] = _root_.scala.None
    var expires: _root_.scala.Option[Long] = _root_.scala.None
    var _passthroughFields: Builder[(Short, TFieldBlob), immutable$Map[Short, TFieldBlob]] = null
    var _done = false

    _iprot.readStructBegin()
    while (!_done) {
      val _field = _iprot.readFieldBegin()
      if (_field.`type` == TType.STOP) {
        _done = true
      } else {
        _field.id match {
          case 1 =>
            _field.`type` match {
              case TType.STRUCT =>
                queryId = _root_.scala.Some(readQueryIdValue(_iprot))
              case _actualType =>
                val _expectedType = TType.STRUCT
                throw new TProtocolException(
                  "Received wrong type for field 'queryId' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 2 =>
            _field.`type` match {
              case TType.STRING =>
                querySpace = readQuerySpaceValue(_iprot)
              case _actualType =>
                val _expectedType = TType.STRING
                throw new TProtocolException(
                  "Received wrong type for field 'querySpace' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 3 =>
            _field.`type` match {
              case TType.STRUCT =>
                tableInfo = readTableInfoValue(_iprot)
              case _actualType =>
                val _expectedType = TType.STRUCT
                throw new TProtocolException(
                  "Received wrong type for field 'tableInfo' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 4 =>
            _field.`type` match {
              case TType.LIST =>
                columns = readColumnsValue(_iprot)
              case _actualType =>
                val _expectedType = TType.LIST
                throw new TProtocolException(
                  "Received wrong type for field 'columns' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 5 =>
            _field.`type` match {
              case TType.I32 =>
                pagesize = _root_.scala.Some(readPagesizeValue(_iprot))
              case _actualType =>
                val _expectedType = TType.I32
                throw new TProtocolException(
                  "Received wrong type for field 'pagesize' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case 6 =>
            _field.`type` match {
              case TType.I64 =>
                expires = _root_.scala.Some(readExpiresValue(_iprot))
              case _actualType =>
                val _expectedType = TType.I64
                throw new TProtocolException(
                  "Received wrong type for field 'expires' (expected=%s, actual=%s).".format(
                    ttypeToString(_expectedType),
                    ttypeToString(_actualType)
                  )
                )
            }
          case _ =>
            if (_passthroughFields == null)
              _passthroughFields = immutable$Map.newBuilder[Short, TFieldBlob]
            _passthroughFields += (_field.id -> TFieldBlob.read(_field, _iprot))
        }
        _iprot.readFieldEnd()
      }
    }
    _iprot.readStructEnd()

    new Immutable(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires,
      if (_passthroughFields == null)
        NoPassthroughFields
      else
        _passthroughFields.result()
    )
  }

  def apply(
    queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = _root_.scala.None,
    querySpace: String,
    tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo,
    columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo](),
    pagesize: _root_.scala.Option[Int] = _root_.scala.None,
    expires: _root_.scala.Option[Long] = _root_.scala.None
  ): ScrayTQueryInfo =
    new Immutable(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires
    )

  def unapply(_item: ScrayTQueryInfo): _root_.scala.Option[_root_.scala.Tuple6[Option[scray.service.qmodel.thrifscala.ScrayUUID], String, scray.service.qmodel.thrifscala.ScrayTTableInfo, Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo], Option[Int], Option[Long]]] = _root_.scala.Some(_item.toTuple)


  @inline private def readQueryIdValue(_iprot: TProtocol): scray.service.qmodel.thrifscala.ScrayUUID = {
    scray.service.qmodel.thrifscala.ScrayUUID.decode(_iprot)
  }

  @inline private def writeQueryIdField(queryId_item: scray.service.qmodel.thrifscala.ScrayUUID, _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(QueryIdField)
    writeQueryIdValue(queryId_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writeQueryIdValue(queryId_item: scray.service.qmodel.thrifscala.ScrayUUID, _oprot: TProtocol): Unit = {
    queryId_item.write(_oprot)
  }

  @inline private def readQuerySpaceValue(_iprot: TProtocol): String = {
    _iprot.readString()
  }

  @inline private def writeQuerySpaceField(querySpace_item: String, _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(QuerySpaceField)
    writeQuerySpaceValue(querySpace_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writeQuerySpaceValue(querySpace_item: String, _oprot: TProtocol): Unit = {
    _oprot.writeString(querySpace_item)
  }

  @inline private def readTableInfoValue(_iprot: TProtocol): scray.service.qmodel.thrifscala.ScrayTTableInfo = {
    scray.service.qmodel.thrifscala.ScrayTTableInfo.decode(_iprot)
  }

  @inline private def writeTableInfoField(tableInfo_item: scray.service.qmodel.thrifscala.ScrayTTableInfo, _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(TableInfoField)
    writeTableInfoValue(tableInfo_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writeTableInfoValue(tableInfo_item: scray.service.qmodel.thrifscala.ScrayTTableInfo, _oprot: TProtocol): Unit = {
    tableInfo_item.write(_oprot)
  }

  @inline private def readColumnsValue(_iprot: TProtocol): Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = {
    val _list = _iprot.readListBegin()
    if (_list.size == 0) {
      _iprot.readListEnd()
      Nil
    } else {
      val _rv = new mutable$ArrayBuffer[scray.service.qmodel.thrifscala.ScrayTColumnInfo](_list.size)
      var _i = 0
      while (_i < _list.size) {
        _rv += {
          scray.service.qmodel.thrifscala.ScrayTColumnInfo.decode(_iprot)
        }
        _i += 1
      }
      _iprot.readListEnd()
      _rv
    }
  }

  @inline private def writeColumnsField(columns_item: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo], _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(ColumnsField)
    writeColumnsValue(columns_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writeColumnsValue(columns_item: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo], _oprot: TProtocol): Unit = {
    _oprot.writeListBegin(new TList(TType.STRUCT, columns_item.size))
    columns_item match {
      case _: IndexedSeq[_] =>
        var _i = 0
        val _size = columns_item.size
        while (_i < _size) {
          val columns_item_element = columns_item(_i)
          columns_item_element.write(_oprot)
          _i += 1
        }
      case _ =>
        columns_item.foreach { columns_item_element =>
          columns_item_element.write(_oprot)
        }
    }
    _oprot.writeListEnd()
  }

  @inline private def readPagesizeValue(_iprot: TProtocol): Int = {
    _iprot.readI32()
  }

  @inline private def writePagesizeField(pagesize_item: Int, _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(PagesizeField)
    writePagesizeValue(pagesize_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writePagesizeValue(pagesize_item: Int, _oprot: TProtocol): Unit = {
    _oprot.writeI32(pagesize_item)
  }

  @inline private def readExpiresValue(_iprot: TProtocol): Long = {
    _iprot.readI64()
  }

  @inline private def writeExpiresField(expires_item: Long, _oprot: TProtocol): Unit = {
    _oprot.writeFieldBegin(ExpiresField)
    writeExpiresValue(expires_item, _oprot)
    _oprot.writeFieldEnd()
  }

  @inline private def writeExpiresValue(expires_item: Long, _oprot: TProtocol): Unit = {
    _oprot.writeI64(expires_item)
  }


  object Immutable extends ThriftStructCodec3[ScrayTQueryInfo] {
    override def encode(_item: ScrayTQueryInfo, _oproto: TProtocol): Unit = { _item.write(_oproto) }
    override def decode(_iprot: TProtocol): ScrayTQueryInfo = ScrayTQueryInfo.decode(_iprot)
    override lazy val metaData: ThriftStructMetaData[ScrayTQueryInfo] = ScrayTQueryInfo.metaData
  }

  /**
   * The default read-only implementation of ScrayTQueryInfo.  You typically should not need to
   * directly reference this class; instead, use the ScrayTQueryInfo.apply method to construct
   * new instances.
   */
  class Immutable(
      val queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID],
      val querySpace: String,
      val tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo,
      val columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo],
      val pagesize: _root_.scala.Option[Int],
      val expires: _root_.scala.Option[Long],
      override val _passthroughFields: immutable$Map[Short, TFieldBlob])
    extends ScrayTQueryInfo {
    def this(
      queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = _root_.scala.None,
      querySpace: String,
      tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo,
      columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo](),
      pagesize: _root_.scala.Option[Int] = _root_.scala.None,
      expires: _root_.scala.Option[Long] = _root_.scala.None
    ) = this(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires,
      Map.empty
    )
  }

  /**
   * This is another Immutable, this however keeps strings as lazy values that are lazily decoded from the backing
   * array byte on read.
   */
  private[this] class LazyImmutable(
      _proto: LazyTProtocol,
      _buf: Array[Byte],
      _start_offset: Int,
      _end_offset: Int,
      val queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID],
      querySpaceOffset: Int,
      val tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo,
      val columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo],
      pagesizeOffset: Int,
      expiresOffset: Int,
      override val _passthroughFields: immutable$Map[Short, TFieldBlob])
    extends ScrayTQueryInfo {

    override def write(_oprot: TProtocol): Unit = {
      _oprot match {
        case i: LazyTProtocol => i.writeRaw(_buf, _start_offset, _end_offset - _start_offset)
        case _ => super.write(_oprot)
      }
    }

    lazy val querySpace: String =
      if (querySpaceOffset == -1)
        null
      else {
        _proto.decodeString(_buf, querySpaceOffset)
      }
    lazy val pagesize: _root_.scala.Option[Int] =
      if (pagesizeOffset == -1)
        None
      else {
        Some(_proto.decodeI32(_buf, pagesizeOffset))
      }
    lazy val expires: _root_.scala.Option[Long] =
      if (expiresOffset == -1)
        None
      else {
        Some(_proto.decodeI64(_buf, expiresOffset))
      }

    /**
     * Override the super hash code to make it a lazy val rather than def.
     *
     * Calculating the hash code can be expensive, caching it where possible
     * can provide significant performance wins. (Key in a hash map for instance)
     * Usually not safe since the normal constructor will accept a mutable map or
     * set as an arg
     * Here however we control how the class is generated from serialized data.
     * With the class private and the contract that we throw away our mutable references
     * having the hash code lazy here is safe.
     */
    override lazy val hashCode = super.hashCode
  }

  /**
   * This Proxy trait allows you to extend the ScrayTQueryInfo trait with additional state or
   * behavior and implement the read-only methods from ScrayTQueryInfo using an underlying
   * instance.
   */
  trait Proxy extends ScrayTQueryInfo {
    protected def _underlying_ScrayTQueryInfo: ScrayTQueryInfo
    override def queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = _underlying_ScrayTQueryInfo.queryId
    override def querySpace: String = _underlying_ScrayTQueryInfo.querySpace
    override def tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = _underlying_ScrayTQueryInfo.tableInfo
    override def columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = _underlying_ScrayTQueryInfo.columns
    override def pagesize: _root_.scala.Option[Int] = _underlying_ScrayTQueryInfo.pagesize
    override def expires: _root_.scala.Option[Long] = _underlying_ScrayTQueryInfo.expires
    override def _passthroughFields = _underlying_ScrayTQueryInfo._passthroughFields
  }
}

trait ScrayTQueryInfo
  extends ThriftStruct
  with _root_.scala.Product6[Option[scray.service.qmodel.thrifscala.ScrayUUID], String, scray.service.qmodel.thrifscala.ScrayTTableInfo, Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo], Option[Int], Option[Long]]
  with HasThriftStructCodec3[ScrayTQueryInfo]
  with java.io.Serializable
{
  import ScrayTQueryInfo._

  def queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID]
  def querySpace: String
  def tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo
  def columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo]
  def pagesize: _root_.scala.Option[Int]
  def expires: _root_.scala.Option[Long]

  def _passthroughFields: immutable$Map[Short, TFieldBlob] = immutable$Map.empty

  def _1 = queryId
  def _2 = querySpace
  def _3 = tableInfo
  def _4 = columns
  def _5 = pagesize
  def _6 = expires

  def toTuple: _root_.scala.Tuple6[Option[scray.service.qmodel.thrifscala.ScrayUUID], String, scray.service.qmodel.thrifscala.ScrayTTableInfo, Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo], Option[Int], Option[Long]] = {
    (
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires
    )
  }


  /**
   * Gets a field value encoded as a binary blob using TCompactProtocol.  If the specified field
   * is present in the passthrough map, that value is returned.  Otherwise, if the specified field
   * is known and not optional and set to None, then the field is serialized and returned.
   */
  def getFieldBlob(_fieldId: Short): _root_.scala.Option[TFieldBlob] = {
    lazy val _buff = new TMemoryBuffer(32)
    lazy val _oprot = new TCompactProtocol(_buff)
    _passthroughFields.get(_fieldId) match {
      case blob: _root_.scala.Some[TFieldBlob] => blob
      case _root_.scala.None => {
        val _fieldOpt: _root_.scala.Option[TField] =
          _fieldId match {
            case 1 =>
              if (queryId.isDefined) {
                writeQueryIdValue(queryId.get, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.QueryIdField)
              } else {
                _root_.scala.None
              }
            case 2 =>
              if (querySpace ne null) {
                writeQuerySpaceValue(querySpace, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.QuerySpaceField)
              } else {
                _root_.scala.None
              }
            case 3 =>
              if (tableInfo ne null) {
                writeTableInfoValue(tableInfo, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.TableInfoField)
              } else {
                _root_.scala.None
              }
            case 4 =>
              if (columns ne null) {
                writeColumnsValue(columns, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.ColumnsField)
              } else {
                _root_.scala.None
              }
            case 5 =>
              if (pagesize.isDefined) {
                writePagesizeValue(pagesize.get, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.PagesizeField)
              } else {
                _root_.scala.None
              }
            case 6 =>
              if (expires.isDefined) {
                writeExpiresValue(expires.get, _oprot)
                _root_.scala.Some(ScrayTQueryInfo.ExpiresField)
              } else {
                _root_.scala.None
              }
            case _ => _root_.scala.None
          }
        _fieldOpt match {
          case _root_.scala.Some(_field) =>
            val _data = Arrays.copyOfRange(_buff.getArray, 0, _buff.length)
            _root_.scala.Some(TFieldBlob(_field, _data))
          case _root_.scala.None =>
            _root_.scala.None
        }
      }
    }
  }

  /**
   * Collects TCompactProtocol-encoded field values according to `getFieldBlob` into a map.
   */
  def getFieldBlobs(ids: TraversableOnce[Short]): immutable$Map[Short, TFieldBlob] =
    (ids flatMap { id => getFieldBlob(id) map { id -> _ } }).toMap

  /**
   * Sets a field using a TCompactProtocol-encoded binary blob.  If the field is a known
   * field, the blob is decoded and the field is set to the decoded value.  If the field
   * is unknown and passthrough fields are enabled, then the blob will be stored in
   * _passthroughFields.
   */
  def setField(_blob: TFieldBlob): ScrayTQueryInfo = {
    var queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = this.queryId
    var querySpace: String = this.querySpace
    var tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = this.tableInfo
    var columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = this.columns
    var pagesize: _root_.scala.Option[Int] = this.pagesize
    var expires: _root_.scala.Option[Long] = this.expires
    var _passthroughFields = this._passthroughFields
    _blob.id match {
      case 1 =>
        queryId = _root_.scala.Some(readQueryIdValue(_blob.read))
      case 2 =>
        querySpace = readQuerySpaceValue(_blob.read)
      case 3 =>
        tableInfo = readTableInfoValue(_blob.read)
      case 4 =>
        columns = readColumnsValue(_blob.read)
      case 5 =>
        pagesize = _root_.scala.Some(readPagesizeValue(_blob.read))
      case 6 =>
        expires = _root_.scala.Some(readExpiresValue(_blob.read))
      case _ => _passthroughFields += (_blob.id -> _blob)
    }
    new Immutable(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires,
      _passthroughFields
    )
  }

  /**
   * If the specified field is optional, it is set to None.  Otherwise, if the field is
   * known, it is reverted to its default value; if the field is unknown, it is removed
   * from the passthroughFields map, if present.
   */
  def unsetField(_fieldId: Short): ScrayTQueryInfo = {
    var queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = this.queryId
    var querySpace: String = this.querySpace
    var tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = this.tableInfo
    var columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = this.columns
    var pagesize: _root_.scala.Option[Int] = this.pagesize
    var expires: _root_.scala.Option[Long] = this.expires

    _fieldId match {
      case 1 =>
        queryId = _root_.scala.None
      case 2 =>
        querySpace = null
      case 3 =>
        tableInfo = null
      case 4 =>
        columns = Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo]()
      case 5 =>
        pagesize = _root_.scala.None
      case 6 =>
        expires = _root_.scala.None
      case _ =>
    }
    new Immutable(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires,
      _passthroughFields - _fieldId
    )
  }

  /**
   * If the specified field is optional, it is set to None.  Otherwise, if the field is
   * known, it is reverted to its default value; if the field is unknown, it is removed
   * from the passthroughFields map, if present.
   */
  def unsetQueryId: ScrayTQueryInfo = unsetField(1)

  def unsetQuerySpace: ScrayTQueryInfo = unsetField(2)

  def unsetTableInfo: ScrayTQueryInfo = unsetField(3)

  def unsetColumns: ScrayTQueryInfo = unsetField(4)

  def unsetPagesize: ScrayTQueryInfo = unsetField(5)

  def unsetExpires: ScrayTQueryInfo = unsetField(6)


  override def write(_oprot: TProtocol): Unit = {
    ScrayTQueryInfo.validate(this)
    _oprot.writeStructBegin(Struct)
    if (queryId.isDefined) writeQueryIdField(queryId.get, _oprot)
    if (querySpace ne null) writeQuerySpaceField(querySpace, _oprot)
    if (tableInfo ne null) writeTableInfoField(tableInfo, _oprot)
    if (columns ne null) writeColumnsField(columns, _oprot)
    if (pagesize.isDefined) writePagesizeField(pagesize.get, _oprot)
    if (expires.isDefined) writeExpiresField(expires.get, _oprot)
    if (_passthroughFields.nonEmpty) {
      _passthroughFields.values.foreach { _.write(_oprot) }
    }
    _oprot.writeFieldStop()
    _oprot.writeStructEnd()
  }

  def copy(
    queryId: _root_.scala.Option[scray.service.qmodel.thrifscala.ScrayUUID] = this.queryId,
    querySpace: String = this.querySpace,
    tableInfo: scray.service.qmodel.thrifscala.ScrayTTableInfo = this.tableInfo,
    columns: Seq[scray.service.qmodel.thrifscala.ScrayTColumnInfo] = this.columns,
    pagesize: _root_.scala.Option[Int] = this.pagesize,
    expires: _root_.scala.Option[Long] = this.expires,
    _passthroughFields: immutable$Map[Short, TFieldBlob] = this._passthroughFields
  ): ScrayTQueryInfo =
    new Immutable(
      queryId,
      querySpace,
      tableInfo,
      columns,
      pagesize,
      expires,
      _passthroughFields
    )

  override def canEqual(other: Any): Boolean = other.isInstanceOf[ScrayTQueryInfo]

  private def _equals(x: ScrayTQueryInfo, y: ScrayTQueryInfo): Boolean =
      x.productArity == y.productArity &&
      x.productIterator.sameElements(y.productIterator)

  override def equals(other: Any): Boolean =
    canEqual(other) &&
      _equals(this, other.asInstanceOf[ScrayTQueryInfo]) &&
      _passthroughFields == other.asInstanceOf[ScrayTQueryInfo]._passthroughFields

  override def hashCode: Int = _root_.scala.runtime.ScalaRunTime._hashCode(this)

  override def toString: String = _root_.scala.runtime.ScalaRunTime._toString(this)


  override def productArity: Int = 6

  override def productElement(n: Int): Any = n match {
    case 0 => this.queryId
    case 1 => this.querySpace
    case 2 => this.tableInfo
    case 3 => this.columns
    case 4 => this.pagesize
    case 5 => this.expires
    case _ => throw new IndexOutOfBoundsException(n.toString)
  }

  override def productPrefix: String = "ScrayTQueryInfo"

  def _codec: ThriftStructCodec3[ScrayTQueryInfo] = ScrayTQueryInfo
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy