/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.execution.resourceGroups;

import io.airlift.units.DataSize;
import io.airlift.units.Duration;

import javax.annotation.concurrent.ThreadSafe;

@ThreadSafe
public interface ResourceGroup
{
    ResourceGroupId getId();

    DataSize getSoftMemoryLimit();

    void setSoftMemoryLimit(DataSize limit);

    Duration getSoftCpuLimit();

    void setSoftCpuLimit(Duration limit);

    Duration getHardCpuLimit();

    void setHardCpuLimit(Duration limit);

    long getCpuQuotaGenerationMillisPerSecond();

    void setCpuQuotaGenerationMillisPerSecond(long rate);

    int getMaxRunningQueries();

    void setMaxRunningQueries(int maxRunningQueries);

    int getMaxQueuedQueries();

    void setMaxQueuedQueries(int maxQueuedQueries);

    int getSchedulingWeight();

    void setSchedulingWeight(int weight);

    SchedulingPolicy getSchedulingPolicy();

    void setSchedulingPolicy(SchedulingPolicy policy);

    boolean getJmxExport();

    void setJmxExport(boolean export);
}

@@ -846,158 +846,528 @@
     
-void setSoftMemoryLimit(DataSize limit);%0A%0A    Duration getSoftCpuLimit();%0A%0A    void setSoftCpuLimit(Duration limit);%0A%0A    Duration getHardCpuLimit();%0A
+/**%0A     * Threshold on total distributed memory usage after which new queries%0A     * will queue instead of starting.%0A     */%0A    void setSoftMemoryLimit(DataSize limit);%0A%0A    Duration getSoftCpuLimit();%0A%0A    /**%0A     * Threshold on total distributed CPU usage after which max running queries will be reduced.%0A     */%0A    void setSoftCpuLimit(Duration limit);%0A%0A    Duration getHardCpuLimit();%0A%0A    /**%0A     * Threshold on total distributed CPU usage after which new queries%0A     * will queue instead of starting.%0A     */
 %0A   
@@ -1452,24 +1452,102 @@
 rSecond();%0A%0A
+    /**%0A     * Rate at which distributed CPU usage quota regenerates.%0A     */%0A
     void set
@@ -1634,90 +1634,328 @@
     
-void setMaxRunningQueries(int maxRunningQueries);%0A%0A    int getMaxQueuedQueries();%0A
+/**%0A     * Maximum number of concurrently running queries, after which%0A     * new queries will queue instead of starting.%0A     */%0A    void setMaxRunningQueries(int maxRunningQueries);%0A%0A    int getMaxQueuedQueries();%0A%0A    /**%0A     * Maximum number of queued queries after which submitted queries will be rejected.%0A     */
 %0A   
@@ -2032,24 +2032,100 @@
 gWeight();%0A%0A
+    /**%0A     * Scheduling weight of this group in its parent group.%0A     */%0A
     void set
@@ -2208,88 +2208,340 @@
     
-void setSchedulingPolicy(SchedulingPolicy policy);%0A%0A    boolean getJmxExport();%0A
+/**%0A     * Scheduling policy to use when dividing resources among child resource groups,%0A     * or among queries submitted to this group.%0A     */%0A    void setSchedulingPolicy(SchedulingPolicy policy);%0A%0A    boolean getJmxExport();%0A%0A    /**%0A     * Whether to export statistics about this group and allow configuration via JMX.%0A     */
 %0A   

Add JavaDoc to ResourceGroup