1Padre::Autosave(3)    User Contributed Perl Documentation   Padre::Autosave(3)
2
3
4

NAME

6       Padre::Autosave - auto-save and recovery mechanism for Padre
7

SYNOPSIS

9         my $autosave = Padre:Autosave->new( db => 'path/to/database' );
10         $autosave->save_file( $path, $type, $data, $timestamp ) = @_;
11

DESCRIPTION

The longer auto-save plan

14       The following is just a plan that is currently shelved as some people
15       on the Padre development list think this is not necessary and one
16       should use a real version control for this anyway.
17
18       So I leave it here for now, for future exploration.
19
20       I'd like to provide auto-save with some history and recovery service.
21
22       While I am writing this for Padre I'll make the code separate so others
23       can use it.
24
25       An SQLite database will be used for this but theoretically any database
26       could be used. Event plain file system.
27
28       Basically this will provide a versioned file system with metadata and
29       automatic cleanup.
30
31       Besides the content of the file we need to save some meta data:
32
33       path to the file will be the unique identifier
34       timestamp
35       type of save (initial, auto-save, user initiated save, external)
36
37       When opening a file for the first time it is saved in the
38       database.(initial)
39
40       Every N seconds files that are not currently in "saved" situation are
41       auto-saved in the database making sure that they are only saved if they
42       differ from the previous state. (auto-save)
43
44       Evey time a file is saved it is also saved to the database. (user
45       initiated save) Before reloading a file we auto-save it. (auto-save)
46
47       Every time we notice that a file was changed on the disk if the user
48       decides to overwrite it we also save the (external) changed file.
49
50       Before auto-saving a file we make sure it has not changed since the
51       last auto-save.
52
53       In order to make sure the database does not get too big we setup a
54       cleaning mechanism that is executed once in a while.  There might be
55       several options but for now: 1) Every entry older than N days will be
56       deleted.
57
58       Based on the database we'll be able to provide the user recovery in
59       case of crash or accidental overwrite.
60
61       When opening padre we should check if there are files in the database
62       that the last save was not a user initiated save and offer recovery.
63
64       When opening a file we should also check how is it related to the last
65       save in the database.
66
67       For buffers that were never saved and so have no file names we should
68       have some internal identifier in Padre and use that for the auto-save
69       till the first user initiated save.
70
71       The same mechanism will be really useful when we start providing remote
72       editing. Then a file is identified by its URI (
73       ftp://machine/path/to/file or scp://machine/path/to/file )
74
75         my @types = qw(initial, autosave, usersave, external);
76
77         sub save_data {
78             my ($path, $timestamp, $type, $data) = @_;
79         }
80
81
82
83perl v5.28.1                      2011-08-16                Padre::Autosave(3)
Impressum