Bug 82773 - RFE: Make it easy for applications to save state
Summary: RFE: Make it easy for applications to save state
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-18 14:06 UTC by Bastien Nocera
Modified: 2014-08-21 19:12 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2014-08-18 14:06:38 UTC
As discussed on IRC, it would be useful for systemd to lend a hand to applications that want to save state in the event that they crash.

1. Application will save state every 5/10 seconds when needed to its run-time directory
2. If the application crashes, systemd would move the application's state file to permanent storage under the data-dir.
3. If the application is closed properly, the state file would be removed

systemd could help by providing an equivalent to ExecStopPost that would move files with an app-specific name.

For example, totem saves a state playlist (including current playback position) to /run/user/1000/org.gnome.Totem/org.gnome.Totem.state.xspf. If totem crashes, then that file is moved to ~/.local/share/org.gnome.Totem/org.gnome.Totem.state.xspf so that it can re-read it when restarted.
Comment 1 Bastien Nocera 2014-08-18 14:13:13 UTC
<desrt> hadess: .local/share isn't going to get you invited to anybody's parties :)
Comment 2 Lennart Poettering 2014-08-18 20:28:28 UTC
Hmm, isn't this something dconf or so should cover instead?

THis would only protect against totem dying, but not against the system entirely dying...
Comment 3 Bastien Nocera 2014-08-21 19:12:04 UTC
(In reply to comment #2)
> Hmm, isn't this something dconf or so should cover instead?

dconf isn't there to store random blobs. systemd is the one that knows whether the application has crashed or quit correctly.

> THis would only protect against totem dying, but not against the system
> entirely dying...

True, but that would require us forcing a sync write to the disk, which is exactly what I'm trying to avoid.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.