[Kde-pim] Akonadi Resource - setOnline troubles

Daniel Vrátil dvratil at redhat.com
Wed Feb 19 16:31:13 GMT 2014


On Tuesday 18 of February 2014 16:41:35 Kevin Krammer wrote:
> On Tuesday, 2014-02-18, 16:31:43, Daniel Vrátil wrote:
> > On Monday 17 of February 2014 22:21:09 Martin Koller wrote:
> > > In the patch I created for the DAV resource (to make it automatically
> > > offline when it can not reach the server) I see a problem with the
> > > online/offline switching:
> > > When I use setOnline(false), the baseclass stores this as "desired
> > > status
> > > == offline", which also means whenever the network goes away (e.g.
> > > suspend Laptop) and comes again (resume Laptop) detected by Solid, it
> > > would not automatically try to set the resource to online, because the
> > > baseclass still thinks, my desire is to have it offline.
> > > 
> > > How can I overcome this ?
> > > 
> > > I want to set the resource to "temporarily offline" and therefore to
> > > activate the change recorder, but as soon as possible (either via my
> > > QTimer
> > > or when Solid detects network activation) I want that the resource
> > > retries
> > > to go online.
> > > 
> > > I could also listen to the Solid events, but I see this as an ugly
> > > solution, as this is something every network needing resource should do.
> > > 
> > > What about a new method in AgentBase ?, e.g.
> > > void setTemporaryOffline() { setOnlineInternal(false); }  // not storing
> > > state as desired state
> > 
> > Yup, this sounds reasonable. Maybe setTemporaryOffline could even take an
> > argument for timeout, set up a timer internally and then emit a signal,
> > that resource implementations would connect to to check whether we are
> > online already. Afaik this is pretty much what you've done in the DAV
> > resource and similar solution would be used in other resources too, so
> > having this as part of ResourceBase would prevent some code duplication.
> 
> I think we have discussed something similar before, i.e. the need to have
> more states than just online/offline.
> 
> The earlier discussion was mostly about distingushing different forms of
> "offline", i.e. whether the resource or the user is the originator of the
> state.

I found the (rather long :) email from Andreas from December 2012.  What I 
understand from the proposal is to have following states:

TurnedOff 
Akonadi is not allowed to talked to the resource and the resource does 
nothing. But how does the resource get into this state? And when should it 
recover? Is this set by user, server or resource itself?

StayDisconnected
Resource was set offline by user or application. Akonadi can talk to it, but 
resource is not allowed to talk to it's storage (IMAP server, maildir...). 
Resource has to be switched to Connected state manually by user or application 
again.
In this state any attempt to retrieve data from the resource will result in 
ItemRetrievalException on the server, user will be shown a weird error (we 
seriously need Akonadi server to send reasonable error messages we can show to 
users) and KMail will get stuck on "Retrieving email...", because it can only 
tell that ItemFetchJob failed, but does not know why (or has this been fixed 
already?)

Disconnected 
Resource requires access to network, but no network is available. ResourceBase 
automatically moves between Disconnected and Connected states based on network 
availability reported by Solid. There is the same problem with data retrieval 
as in StayDisconnected. 

TemporaryDisconnected ( == BackendNotAvailable? )
Network is available,  but connection to server cannot be established (or 
maildir folder is not available because it's not mounted for instance). 
Resource sets itself to this state and will attempt to reach the backend 
periodically (ResourceBase will emit a "tryReconnect" signal in configurable 
intervals). Once it succeeds, it will switch itself back to Connected.

Connected
Everything is fine.


Is this +- what you and Andreas had in mind?


> Maybe this is just another good reason to get this rolling? :)

Right, I doubt I'll get to do it anytime soon, so if Martin is willing do dig 
deeper into kdepimlibs, why not :-)

Cheers,
Dan

> 
> Cheers,
> Kevin

-- 
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
KDE Desktop Team
Associate Software Engineer, Red Hat, Inc.

GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140219/cf4ff73f/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