/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.jackrabbit.oak.plugins.index.counter.jmx;

import org.apache.jackrabbit.oak.commons.jmx.Description;
import org.apache.jackrabbit.oak.commons.jmx.Name;

/**
 * An MBean that provides an approximate node count for a given path.
 */
public interface NodeCounterMBean {
    
    String TYPE = "NodeCounter";

    /**
     * Get the estimated number of nodes below a given path.
     * 
     * @param path the path
     * @return the estimated number of nodes, or -1 if unknown (if not index is
     *         available)
     */
    @Description("Get the estimated number of nodes below a given path.")
    long getEstimatedNodeCount(
            @Description("the path")
            @Name("path")
            String path);
    
    /**
     * Get the estimated number of nodes for the child nodes of a given path.
     * 
     * @param path the path
     * @param level the depth of the child nodes to list
     * @return a comma separated list of child nodes with the respective
     *         estimated counts
     */    
    @Description("Get the estimated number of nodes below a given path.")
    String getEstimatedChildNodeCounts(
            @Description("the path")
            @Name("path")
            String path, 
            @Description("the depth of the child nodes to list (the higher the number, the slower)")
            @Name("level")
            int level);
    
}
