Laying groundwork

Thomas Jarosch thomas.jarosch at intra2net.com
Tue May 26 11:50:15 EDT 2015


Hi Bron,

On Saturday, 16. May 2015 09:46:40 Bron Gondwana wrote:
> So the way to work through all the records in a mailbox was:
> 
> int r;
> uint32_t recno;
> struct index_record record;
> 
> for (recno = 1; recno <= mailbox->i.num_records; recno++) {
>     r = mailbox_read_index_record(mailbox, recno, &record);
>     if (r) continue;
> 
>     /* if not looking at expunged records */
>     if (record.system_flags & FLAG_EXPUGNED) continue;


[new API]
> const struct index_record *record;
> struct mailbox_iter *iter = mailbox_iter_init(mailbox, modseq, iterflags);
> while ((record = mailbox_iter_step(iter))) {
>    ...
> }
> mailbox_iter_done(&iter);
> 
> This allows both a fetch of only records changed since a particular
> modseq, or a fetch of only records without certain flags - check some of
> the uses for examples.  A common pattern is init(mailbox, 0,
> ITER_SKIP_EXPUNGED).

that's a sound API improvement. I already reviewed the concept
last week but never gotten around to actually send the email :)

Cheers,
Thomas



More information about the Cyrus-devel mailing list