Closed Bug 296832 Opened 20 years ago Closed 17 years ago

need a synchronous interface to the storage provider

Categories

(Calendar :: Provider: Local Storage, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: mvl, Unassigned)

Details

I'm planning to use the storage calendar for the cache. The code is getting
really unreadable due to the async nature of calICalendar.

I suggest to add a calISynchronousCalendar interface, only implemented by the
storage calendar, and only to be used by the cache.

Then code can look like this:

 var orig = cachecal.getItem(id)
 othercal.addItem(orig);

instead of some long unreadable code with listeners. (and cache needs to work
with 3 calendars in other places, where the code will be totally unreadable)
This is some other (pseudo)code i need:

var items = origcal.getItems(ALL);
for each (item in items) {
  var cacheitem = cachecal.getItems(item.id);
  if (cacheitem) {
    // do stuff with cacheitem
  }
}

with the async api, it needs two listeners, and the code-flow would be a
mystery. Also you don't want to hammer the provider with a ton of requests in
the loop before there is an answer. Preventing that async is a pain.
mvl, since we now have a tagging interface calISyncCalendar for the exact same purpose you described in this bug, isn't this one obsolete now?
Yeah, I guess so.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.