Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Equinox/p2/Proposals/Query Management and Optimization

< Equinox‎ | p2
Revision as of 19:03, 1 January 2009 by Remy.suen.gmail.com (Talk | contribs) (Non Opaque Queries)


While p2 was designed to support a number of different repositories, there are a few areas of p2 that could be enhanced to improve the performance of database backed repositories. This (working draft) proposal will help identify these areas and present concrete suggestions on how to address these issues.

There are currently six (6) areas that we have identified that can be improved:

  1. Define standard queries as "non-opaque" meaning repository implementors could supply custom implementations using SQL or some other query language
  2. Remove the complexities surrounding collectors. Many collectors act as queries, hampering the repositories ability to create custom implementations
  3. Add "lazy" or "asynchronous" query results
  4. Query result life cycle. Callers of a query will need to specify when / how the results are available, and what happens if the query gets restarted, or enhanced
  5. Provide query result Status (likely MultiStatus)
  6. Make query results queryable. In many instances, it would be convenient to re-query a set of query results. This may have performance implications with respect to the non-opaque queries.

Non Opaque Queries

To help repository implementors craft custom queries to represent many of the "standard" p2 queries, a set of non-opaque queries should be provided. These can be specified using a QueryDescriptor, and a QueryFactory could be used to generate a concrete query based on the descriptor.

/**
 * A query descriptor is an abstract class that represents a query 
 * through a series of parameters. Concrete subclasses should define
 * these parameters.
 */
public abstract QueryDescriptor {
    public void setParameter(String parameter, Object value) {
    }
 
    public Object getParameter(String parameter) {
    }
}
/**
 * A query that searches for {@link IInstallableUnit} instances that provide
 * capabilities that match one or more required capabilities.
 */
public class CapabilityQueryDescriptor extends QueryDescriptor {
 
    // Capability Queries can be parametrized by required capabilities
    public final static String REQURIED_CAPABILITIES = "required_capabilities";
}

For opaque queries (that is queries that are not parametrized nor expected to be optimized) they will implement OpaqueQueryDescriptor.

/**
 * An opaque query is one that has not yet been parametrized, and those implementing IQueryable cannot 
 * optimize these.
 */
public class OpaqueQueryDescriptor extends QueryDescriptor {
    public OpaqueQueryDescriptor(Query concreteQuery)
 
    public Query getQuery() 
}

The IQueryable interface will be changed as follows:

public interface IQueryable {
 
    public Collector query(QueryDescriptor query, Collector collector, IProgressMonitor monitor);
 
    public QueryFactory getQueryFactory(); 
 
}

Back to the top