<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/bigtable/v2/session.proto

namespace Google\Cloud\Bigtable\V2\SessionClientConfiguration;

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

/**
 * Configuration for the session pools. Session pools are tied to a scope
 * like a table, an app profile, and a permission.
 *
 * Generated from protobuf message <code>google.bigtable.v2.SessionClientConfiguration.SessionPoolConfiguration</code>
 */
class SessionPoolConfiguration extends \Google\Protobuf\Internal\Message
{
    /**
     * Fraction of idle sessions to keep in order to manage an increase in
     * requests-in-flight. For example, a headroom of 0.5 will keep enough
     * sessions to deal with a 50% increase in QPS.
     *
     * Generated from protobuf field <code>float headroom = 1;</code>
     */
    protected $headroom = 0.0;
    /**
     * The minimum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 min_session_count = 2;</code>
     */
    protected $min_session_count = 0;
    /**
     * The maximum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 max_session_count = 3;</code>
     */
    protected $max_session_count = 0;
    /**
     * Number of vRPCs that can be queued per starting session.
     *
     * Generated from protobuf field <code>int32 new_session_queue_length = 4;</code>
     */
    protected $new_session_queue_length = 0;
    /**
     * How many concurrent session establishments are allowed. The client will
     * hold onto a count against this budget whenever it is establishing a new
     * session, and release that count once the session is successfully
     * established or failed to establish.
     *
     * Generated from protobuf field <code>int32 new_session_creation_budget = 5;</code>
     */
    protected $new_session_creation_budget = 0;
    /**
     * How long to penalize the creation budget for a failed session creation
     * attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration new_session_creation_penalty = 6;</code>
     */
    protected $new_session_creation_penalty = null;
    /**
     * A threshold for cancelling all pending vRPCs based on how many
     * consecutive session establishment errors have been observed. The client
     * will eagerly cancel queued vRPCs after this threshold is met to avoid
     * them waiting their entire deadlines before terminating (while waiting for
     * any session to establish to actually send the vRPC).
     *
     * Generated from protobuf field <code>int32 consecutive_session_failure_threshold = 8;</code>
     */
    protected $consecutive_session_failure_threshold = 0;
    /**
     * How to balance vRPC load over connections to AFEs.
     * Set only if session_load > 0.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.LoadBalancingOptions load_balancing_options = 9;</code>
     */
    protected $load_balancing_options = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type float $headroom
     *           Fraction of idle sessions to keep in order to manage an increase in
     *           requests-in-flight. For example, a headroom of 0.5 will keep enough
     *           sessions to deal with a 50% increase in QPS.
     *     @type int $min_session_count
     *           The minimum number of sessions for a given scope.
     *     @type int $max_session_count
     *           The maximum number of sessions for a given scope.
     *     @type int $new_session_queue_length
     *           Number of vRPCs that can be queued per starting session.
     *     @type int $new_session_creation_budget
     *           How many concurrent session establishments are allowed. The client will
     *           hold onto a count against this budget whenever it is establishing a new
     *           session, and release that count once the session is successfully
     *           established or failed to establish.
     *     @type \Google\Protobuf\Duration $new_session_creation_penalty
     *           How long to penalize the creation budget for a failed session creation
     *           attempt.
     *     @type int $consecutive_session_failure_threshold
     *           A threshold for cancelling all pending vRPCs based on how many
     *           consecutive session establishment errors have been observed. The client
     *           will eagerly cancel queued vRPCs after this threshold is met to avoid
     *           them waiting their entire deadlines before terminating (while waiting for
     *           any session to establish to actually send the vRPC).
     *     @type \Google\Cloud\Bigtable\V2\LoadBalancingOptions $load_balancing_options
     *           How to balance vRPC load over connections to AFEs.
     *           Set only if session_load > 0.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Bigtable\V2\Session::initOnce();
        parent::__construct($data);
    }

    /**
     * Fraction of idle sessions to keep in order to manage an increase in
     * requests-in-flight. For example, a headroom of 0.5 will keep enough
     * sessions to deal with a 50% increase in QPS.
     *
     * Generated from protobuf field <code>float headroom = 1;</code>
     * @return float
     */
    public function getHeadroom()
    {
        return $this->headroom;
    }

    /**
     * Fraction of idle sessions to keep in order to manage an increase in
     * requests-in-flight. For example, a headroom of 0.5 will keep enough
     * sessions to deal with a 50% increase in QPS.
     *
     * Generated from protobuf field <code>float headroom = 1;</code>
     * @param float $var
     * @return $this
     */
    public function setHeadroom($var)
    {
        GPBUtil::checkFloat($var);
        $this->headroom = $var;

        return $this;
    }

    /**
     * The minimum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 min_session_count = 2;</code>
     * @return int
     */
    public function getMinSessionCount()
    {
        return $this->min_session_count;
    }

    /**
     * The minimum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 min_session_count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setMinSessionCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->min_session_count = $var;

        return $this;
    }

    /**
     * The maximum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 max_session_count = 3;</code>
     * @return int
     */
    public function getMaxSessionCount()
    {
        return $this->max_session_count;
    }

    /**
     * The maximum number of sessions for a given scope.
     *
     * Generated from protobuf field <code>int32 max_session_count = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxSessionCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_session_count = $var;

        return $this;
    }

    /**
     * Number of vRPCs that can be queued per starting session.
     *
     * Generated from protobuf field <code>int32 new_session_queue_length = 4;</code>
     * @return int
     */
    public function getNewSessionQueueLength()
    {
        return $this->new_session_queue_length;
    }

    /**
     * Number of vRPCs that can be queued per starting session.
     *
     * Generated from protobuf field <code>int32 new_session_queue_length = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setNewSessionQueueLength($var)
    {
        GPBUtil::checkInt32($var);
        $this->new_session_queue_length = $var;

        return $this;
    }

    /**
     * How many concurrent session establishments are allowed. The client will
     * hold onto a count against this budget whenever it is establishing a new
     * session, and release that count once the session is successfully
     * established or failed to establish.
     *
     * Generated from protobuf field <code>int32 new_session_creation_budget = 5;</code>
     * @return int
     */
    public function getNewSessionCreationBudget()
    {
        return $this->new_session_creation_budget;
    }

    /**
     * How many concurrent session establishments are allowed. The client will
     * hold onto a count against this budget whenever it is establishing a new
     * session, and release that count once the session is successfully
     * established or failed to establish.
     *
     * Generated from protobuf field <code>int32 new_session_creation_budget = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setNewSessionCreationBudget($var)
    {
        GPBUtil::checkInt32($var);
        $this->new_session_creation_budget = $var;

        return $this;
    }

    /**
     * How long to penalize the creation budget for a failed session creation
     * attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration new_session_creation_penalty = 6;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getNewSessionCreationPenalty()
    {
        return $this->new_session_creation_penalty;
    }

    public function hasNewSessionCreationPenalty()
    {
        return isset($this->new_session_creation_penalty);
    }

    public function clearNewSessionCreationPenalty()
    {
        unset($this->new_session_creation_penalty);
    }

    /**
     * How long to penalize the creation budget for a failed session creation
     * attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration new_session_creation_penalty = 6;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setNewSessionCreationPenalty($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->new_session_creation_penalty = $var;

        return $this;
    }

    /**
     * A threshold for cancelling all pending vRPCs based on how many
     * consecutive session establishment errors have been observed. The client
     * will eagerly cancel queued vRPCs after this threshold is met to avoid
     * them waiting their entire deadlines before terminating (while waiting for
     * any session to establish to actually send the vRPC).
     *
     * Generated from protobuf field <code>int32 consecutive_session_failure_threshold = 8;</code>
     * @return int
     */
    public function getConsecutiveSessionFailureThreshold()
    {
        return $this->consecutive_session_failure_threshold;
    }

    /**
     * A threshold for cancelling all pending vRPCs based on how many
     * consecutive session establishment errors have been observed. The client
     * will eagerly cancel queued vRPCs after this threshold is met to avoid
     * them waiting their entire deadlines before terminating (while waiting for
     * any session to establish to actually send the vRPC).
     *
     * Generated from protobuf field <code>int32 consecutive_session_failure_threshold = 8;</code>
     * @param int $var
     * @return $this
     */
    public function setConsecutiveSessionFailureThreshold($var)
    {
        GPBUtil::checkInt32($var);
        $this->consecutive_session_failure_threshold = $var;

        return $this;
    }

    /**
     * How to balance vRPC load over connections to AFEs.
     * Set only if session_load > 0.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.LoadBalancingOptions load_balancing_options = 9;</code>
     * @return \Google\Cloud\Bigtable\V2\LoadBalancingOptions|null
     */
    public function getLoadBalancingOptions()
    {
        return $this->load_balancing_options;
    }

    public function hasLoadBalancingOptions()
    {
        return isset($this->load_balancing_options);
    }

    public function clearLoadBalancingOptions()
    {
        unset($this->load_balancing_options);
    }

    /**
     * How to balance vRPC load over connections to AFEs.
     * Set only if session_load > 0.
     *
     * Generated from protobuf field <code>.google.bigtable.v2.LoadBalancingOptions load_balancing_options = 9;</code>
     * @param \Google\Cloud\Bigtable\V2\LoadBalancingOptions $var
     * @return $this
     */
    public function setLoadBalancingOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\LoadBalancingOptions::class);
        $this->load_balancing_options = $var;

        return $this;
    }

}

