[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    Re: [Kde-pim] Syncing and KResources again
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2003-04-24 9:31:49
[Download RAW message or body]

On Wednesday 23 April 2003 11:02, Holger Freyther wrote:
>
> while KResources are a nice thing it does not handle the Sync case quite
> well.

At the moment KResources don't handle syncing at all ;-)

> Process A got organizer access
>
> it puts two Events into the organizer
>
> and stays opens
>
>
> Now Process B syncs organizer with his fridge
> four newly created important tasks like buying milk and throw away the 5
> week old rumpsteak were added.
> and then writes organizer back to disk

When the events are written back all process having a copy of the data opened 
are notified and have to reload the changed events.

> now user closes A and A flushes its copy of the calendar
> This means the important synced events are gone on the Desktop

This shouldn't happen without notice.

> Now Process C syncs again organizer and fridge
> The events vanished on the desktop and where unchanged on the fridge cause
> of the smart syncer logic it will delete them on the fridge as well.

This logic is a bit too smart, I would suppose. If something is deleted it 
should be stored that this happened. I wouldn't delete events when syncing 
(at least not without asking) unless I know that the user has explicitly 
deleted the events.

> Now it's weekend and your completely pissed off. The odour of the fridge is
> just annoying and you don't even have milk for your chocolate cornflakes.

Ok, time to leave the kitchen, go back to your computer and fix the problem 
;-)

> How is guilty for that? I think KResource is not guilty for giving multiple
> access but it could handle it internally well.
>
> Now imagine we've a simple KDED module which knows which processes
> currently use which family and which file.

I don't think we reliably can handle this situation with a KDED module. Take 
for example an NFS mounted home directory. Now you login at two different 
machines and open KOrganizer. There is no way kded can know about that. The 
only way I see is to watch the file and emit a signal when it has changed.

> Now another process is coming and wants to sync. It would open up the file.
> before DISK IO KResource would ask the KDED module to flush running
> resources.
>
> We've two resource registered in example
>     So KDED talks to the 1. and does a flush()
>    After flush it talks to the 2nd resource reload and apply the changeset
>    Then it would flush this resource too
>    Now it would return to the 3rd one
>
> No it's safe to read the file from DISK. It would apply changes and save
> them. Now KResource would call the KDED module and say hey man tell others
> to reload and all appointments show up refreshed inside korg.
>
> The idea is that the handling of multiple access and assuring that the data
> is right is part of KResource. So you only do open() and know that the data
> is consistent. If it was changed externally you get a reload() and you
> reload the file and apply your changes again. But everything is handled
> internally.

There are situations which can't be handled internally, because they need user 
interaction. For example if you have opened an event in an editor dialog and 
have changed some data what should happen, when the same event is changed on 
disk? There is no other way than asking the user what should happen.

> Is this already possible? Thoughts opinions? How does KPilot handle it?

Change notification is already supported by the concrete resources. Perhaps we 
could move some code or at least an interface to the general framework.

In addition to that we need proper locking mechanisms. Again parts of the 
implementation or at least an interface could be part of the general 
framework.

-- 
Cornelius Schumacher <schumacher@kde.org>

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic