projects
/
cumulus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cbcd656
)
Wait to write the backup description until a backup is finished.
author
Michael Vrable
<mvrable@cs.ucsd.edu>
Sat, 16 Jun 2007 02:29:54 +0000
(19:29 -0700)
committer
Michael Vrable
<mvrable@beleg.vrable.net>
Sat, 16 Jun 2007 02:29:54 +0000
(19:29 -0700)
scandir.cc
patch
|
blob
|
history
diff --git
a/scandir.cc
b/scandir.cc
index
3d4dcb5
..
0f4ba4e
100644
(file)
--- a/
scandir.cc
+++ b/
scandir.cc
@@
-458,17
+458,13
@@
int main(int argc, char *argv[])
tss = new TarSegmentStore(backup_dest);
block_buf = new char[LBS_BLOCK_SIZE];
tss = new TarSegmentStore(backup_dest);
block_buf = new char[LBS_BLOCK_SIZE];
- /* Write a backup descriptor file, which says which segments are needed and
- * where to start to restore this snapshot. The filename is based on the
- * current time. */
+ /* Store the time when the backup started, so it can be included in the
+ * snapshot name. */
time_t now;
struct tm time_buf;
char desc_buf[256];
time(&now);
localtime_r(&now, &time_buf);
time_t now;
struct tm time_buf;
char desc_buf[256];
time(&now);
localtime_r(&now, &time_buf);
- strftime(desc_buf, sizeof(desc_buf), "%Y%m%dT%H%M%S", &time_buf);
- string desc_filename = backup_dest + "/" + desc_buf + ".lbs";
- std::ofstream descriptor(desc_filename.c_str());
/* Open the local database which tracks all objects that are stored
* remotely, for efficient incrementals. Provide it with the name of this
/* Open the local database which tracks all objects that are stored
* remotely, for efficient incrementals. Provide it with the name of this
@@
-491,8
+487,15
@@
int main(int argc, char *argv[])
root->set_data(md.data(), md.size());
root->write(tss);
root->checksum();
root->set_data(md.data(), md.size());
root->write(tss);
root->checksum();
-
segment_list.insert(root->get_ref().get_segment());
segment_list.insert(root->get_ref().get_segment());
+
+ /* Write a backup descriptor file, which says which segments are needed and
+ * where to start to restore this snapshot. The filename is based on the
+ * current time. */
+ strftime(desc_buf, sizeof(desc_buf), "%Y%m%dT%H%M%S", &time_buf);
+ string desc_filename = backup_dest + "/" + desc_buf + ".lbs";
+ std::ofstream descriptor(desc_filename.c_str());
+
descriptor << "Format: LBS Snapshot v0.1\n";
strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
descriptor << "Date: " << desc_buf << "\n";
descriptor << "Format: LBS Snapshot v0.1\n";
strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
descriptor << "Date: " << desc_buf << "\n";