All pastes #948127 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-18 22:15 UTC
rendered paste body
Target:
Make it possible doing a 'online' backup even of Desktop applications' configuration files

Why is this needed?
If you backup a file while there's another process writing to it, a restoration of this file will be useless because it's in an inconsistent state, e.g. Amarok changes some data of a track in table A of the database, the backup runs, some more information that refers to the entry in table A is written _after_ the backup to table B => result .. unclean database

How could this be done?
As I'm not a programmer, I just put some concepts here, that I thought might work, please correct, what's not right or when it should be done in another way/other terms should be used:
Add virtual functions like this to KApplication to force every app inheriting KApplication to implement this:
SetSyncState() (0 = offline, 1 = online)
  While an application is offline, it doesn't write any application related data (~/.kde/share/{config,apps}, maybe this could be extended to data affected by the application like KGet -> Downloaded Files) to disk
GetSyncState() this is needed, to make the backup application aware of the state.. it might be possible, the application first needs to write some buffers to disk, before it goes 'offline'

This functions should be exposed to external interfaces (DBUS, Scripting API, etc.) to create a universal interface that can be used by backup applications, e.g.

Backup application foo runs a shell script like this:
for application in amarok akregator konqueror;
do
  ${application} --setsyncstate 0
  while [ ${application} --getsyncstate -eq 1 ];
  do
    sleep 2
  done
  cp ~/.kde/share/{apps,config}/${application} /foo/backupspace
  ${application} --setsyncstate 1
done