1 /* 2 * Copyright 2004 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 package org.apache.ldap.server.db; 18 19 20 import org.apache.ldap.common.filter.ExprNode; 21 22 import javax.naming.NamingException; 23 24 25 /** 26 * An optimizer applies heuristics to determine best execution path to a search 27 * filter based on scan counts within database indices. It annotates the nodes 28 * of an expression subtree by setting a "count" key in the node. Its goal is 29 * to annotate nodes with counts to indicate which nodes to iterate over thereby 30 * minimizing the number cycles in a search. The SearchEngine relies on these 31 * count markers to determine the appropriate path. 32 * 33 * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a> 34 * @version $Rev: 169198 $ 35 */ 36 public interface Optimizer 37 { 38 /** 39 * Annotates the expression node tree for optimized traversal metrics. 40 * 41 * @param node the root of the expression node tree 42 * @throws NamingException if there are failures while optimizing 43 */ 44 void annotate( ExprNode node ) throws NamingException; 45 } 46