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

List:       kde-pim
Subject:    Re: [Kde-pim] Proposal: KSharedFile
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2001-12-07 13:30:53
[Download RAW message or body]

On Friday 07 December 2001 07:11, Holger Freyther wrote:
> Am Donnerstag, 6. Dezember 2001 21:09 schrieb Cornelius Schumacher:
>
> > To solve this problem I would like to porpose a new class KSharedFile,
> > which is used to access the file on both sides. KPilot would use the
> > class and KOrganizer would also use the class. This class has to make
> > sure that no two applications are writing to the file at the same time
> > and that all applications having opened the file get notified, when the
> > file is changed.
>
> qt tries to solve this problem different. For the QPE they developed qcop.
> If the pda want's to think it sends a signal called flush() and if syncing
> it's done it sends a reload(). This way it's much better. KSharedFile will
> not easy to be made. There has to be a lot of locking. Ok KDE3 will use the
> threaded version of qt3 and will get the mutexes for free.

You presume that it is clear, who has to be notified. It is simple, if only 
two apps can be participants in a syncing process, but in our case this is 
not the case, we can have several different apps operating on the same file 
at the same time. (see also my response to Adriaans mail for some more 
details about this scenario).

The implementation of KSharedFile is not difficult. You write a lock file, if 
an application requests write access to the file, which prevents all other 
apps of getting write access. After writing, the lock file is deleted and 
other apps are free to require write access. For the notification, when the 
file is changed you setup a QTimer, which periodically checks, if the file 
has changed on disk. If it has the notification is sent.

> This is where a SyncServer :) comes in handy.

You could also let a server process handle the locking (e.g. a special kded 
module). But the advantage of using a lock file is that it also works across 
different machines, e.g. over NFS.

-- 
Cornelius Schumacher <schumacher@kde.org>
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim

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

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