<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/dataflow/v1beta3/metrics.proto

namespace Google\Cloud\Dataflow\V1beta3\HotKeyDebuggingInfo;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * Information about a hot key.
 *
 * Generated from protobuf message <code>google.dataflow.v1beta3.HotKeyDebuggingInfo.HotKeyInfo</code>
 */
class HotKeyInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The age of the hot key measured from when it was first detected.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration hot_key_age = 1;</code>
     */
    protected $hot_key_age = null;
    /**
     * A detected hot key that is causing limited parallelism. This field will
     * be populated only if the following flag is set to true:
     * "--enable_hot_key_logging".
     *
     * Generated from protobuf field <code>string key = 2;</code>
     */
    protected $key = '';
    /**
     * If true, then the above key is truncated and cannot be deserialized. This
     * occurs if the key above is populated and the key size is >5MB.
     *
     * Generated from protobuf field <code>bool key_truncated = 3;</code>
     */
    protected $key_truncated = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Duration $hot_key_age
     *           The age of the hot key measured from when it was first detected.
     *     @type string $key
     *           A detected hot key that is causing limited parallelism. This field will
     *           be populated only if the following flag is set to true:
     *           "--enable_hot_key_logging".
     *     @type bool $key_truncated
     *           If true, then the above key is truncated and cannot be deserialized. This
     *           occurs if the key above is populated and the key size is >5MB.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Dataflow\V1Beta3\Metrics::initOnce();
        parent::__construct($data);
    }

    /**
     * The age of the hot key measured from when it was first detected.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration hot_key_age = 1;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getHotKeyAge()
    {
        return $this->hot_key_age;
    }

    public function hasHotKeyAge()
    {
        return isset($this->hot_key_age);
    }

    public function clearHotKeyAge()
    {
        unset($this->hot_key_age);
    }

    /**
     * The age of the hot key measured from when it was first detected.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration hot_key_age = 1;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setHotKeyAge($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->hot_key_age = $var;

        return $this;
    }

    /**
     * A detected hot key that is causing limited parallelism. This field will
     * be populated only if the following flag is set to true:
     * "--enable_hot_key_logging".
     *
     * Generated from protobuf field <code>string key = 2;</code>
     * @return string
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * A detected hot key that is causing limited parallelism. This field will
     * be populated only if the following flag is set to true:
     * "--enable_hot_key_logging".
     *
     * Generated from protobuf field <code>string key = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * If true, then the above key is truncated and cannot be deserialized. This
     * occurs if the key above is populated and the key size is >5MB.
     *
     * Generated from protobuf field <code>bool key_truncated = 3;</code>
     * @return bool
     */
    public function getKeyTruncated()
    {
        return $this->key_truncated;
    }

    /**
     * If true, then the above key is truncated and cannot be deserialized. This
     * occurs if the key above is populated and the key size is >5MB.
     *
     * Generated from protobuf field <code>bool key_truncated = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setKeyTruncated($var)
    {
        GPBUtil::checkBool($var);
        $this->key_truncated = $var;

        return $this;
    }

}

