Bug 303374 - [api] IMetadataRepository and progress monitors
Summary: [api] IMetadataRepository and progress monitors
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 303269
  Show dependency tree
 
Reported: 2010-02-19 16:26 EST by DJ Houghton CLA
Modified: 2010-02-22 15:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2010-02-19 16:26:17 EST
When reviewing the API for IMetadataRepository, it was noticed that only one method takes an IProgressMonitor as an argument. (#removeIUs)

We need to be consistent and either remove it or add it to other methods. Note that if we decide to add it then we also need to think about adding it to the property set methods as well. (name, description, etc)
Comment 1 Thomas Hallgren CLA 2010-02-19 17:18:52 EST
A related observation is how progress monitors are used in IQueryable.query(). Most of the methods does not use it all. All in all, it's more or less impossible to determine how long a query will take and how far it has progressed.

It would be feasible to start a query by asking for a monitor with IProgressMonitor.UNKNOWN. The expression evaluator could then tick this monitor and check it for cancellation on a regular basis until the query is complete. That would mean that no monitor needs to be passed down to the actual evaluation methods (this would slow things down significantly). Instead, the monitor can be kept in the evaluation context. No "progress" is reported, but at least there would be an indication that it is alive and can be cancelled.
Comment 2 Pascal Rapicault CLA 2010-02-19 17:57:24 EST
Please let's keep the discussion focused. There is already a bug about reporting progress monitoring in the context of query https://bugs.eclipse.org/bugs/show_bug.cgi?id=249670.
Comment 3 John Arthorne CLA 2010-02-22 10:54:22 EST
I think we should just remove the progress monitor argument from the removeIUs method at this point, rather than adding it to all other modifying methods. Currently our API design assumes repository modification is fast (i.e., only local repositories are modifiable). If we branched out into modifiable remote repositories we would likely want different API for executing a set of changes all at once. For example, instead of:

repo.addIUs(...)
repo.removeIUs(...)
repo.setDescription(...)

Where each method results in a round trip, we would want some kind of batching mechanism to make the communication more efficient:

repo.executeBatch(new Runnable() {
  public void run() {
    repo.addIUs(...)
    repo.removeIUs(...)
    repo.setDescription(...)
  }
}, progressMonitor);

I don't think this is something for 3.6 as we don't currently have any mutable remote repositories, but just illustrating why adding a monitor to every single repository mutator method likely isn't the best approach.
Comment 4 DJ Houghton CLA 2010-02-22 15:14:26 EST
I agree with John. I released the change for this as part of my patch for bug 303269. The new API removes the progress monitor.
Closing.