[Kde-pim] Re: Does Akonadi::CollectionDeleteJob delete the backend data?

Volker Krause vkrause at kde.org
Fri Nov 12 08:08:23 GMT 2010


On Friday 12 November 2010 02:03:43 Sérgio Martins wrote:
> 2010/11/11 David Jarvie <djarvie at kde.org>:
> > On Thursday 11 November 2010 20:31:53 Sérgio Martins wrote:
> >> 2010/11/11 David Jarvie <djarvie at kde.org>:
> >> > On Thursday 11 November 2010 19:24:43 Sérgio Martins wrote:
> >> >> 2010/11/11 David Jarvie <djarvie at kde.org>:
> >> >> > When I call CollectionDeleteJob, the backend data is deleted. (To
> >> >> > be precise, the backend calendar is emptied of all events, but the
> >> >> > empty calendar file remains.) Is this the intended behaviour, or
> >> >> > should it simply delete the collection from Akonadi storage and
> >> >> > leave the backend untouched? The apidox is unclear on this. As far
> >> >> > as I can tell, I'm not doing anything else to cause the data to be
> >> >> > lost.
> >> >>
> >> >> No, you're not doing anything else, I remember we had the same
> >> >> problem in korganizer.
> >> >>
> >> >> We ended up deleting the agent instead ( which removes collections
> >> >> too, and doesn't touch backend data ):
> >> >>
> >> >>       const Akonadi::AgentInstance instance =
> >> >> Akonadi::AgentManager::self()->instance( collection.resource() );
> >> >>       if ( instance.isValid() ) {
> >> >>         Akonadi::AgentManager::self()->removeInstance( instance );
> >> >>       }
> >> >
> >> > Thanks Sérgio, that does the trick. I'll update the apidox to clarify
> >> > this.
> >>
> >> Note that if it's a sub-collection you probably don't want to delete
> >> the agent ( will delete parent collection ), and just want to delete
> >> collection+data.
> >
> > Can you please clarify how to delete a sub-collection. Do you mean that
> > it isn't possible to delete a sub-collection without deleting its backend
> > data, or what?
>
> I haven't looked at the API for some time now, but I think it's not
> possible to delete a sub-collection without deleting its backend data.
>
> I also can't think of any use case where you might want to do that.
> What does it even mean?
> IMHO, the collection hierarchy that an akonadi resource provides
> always reflects the data structures that exist in the backend.

right, that's the idea. Akonadi should reflect the state of the resource data 
as closely as possible (and it does that apart from delays due to change 
replay/polling the backend etc). So, any deletion operation triggered by a 
client will be executed on the backend and thus actually delete data. 
Removing a resource entirely OTOH will not touch the data and only remove all 
references of it in Akonadi. Anything inbetween would leave Akonadi with an 
inconsistent representation of the backend data.

There is however a way to hide entire sub-trees from applications, using local 
subscription, see Akonadi::SubscriptionJob/Model/Dialog and 
Akonadi::CollectionFetchScope::includeUnsubscribed().

regards
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20101112/4c11e21e/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list