projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Database rebuilder fixes.
[cumulus.git]
/
subfile.cc
diff --git
a/subfile.cc
b/subfile.cc
index
f365c4b
..
70e1727
100644
(file)
--- a/
subfile.cc
+++ b/
subfile.cc
@@
-1,7
+1,6
@@
-/* Cumulus: Smart Filesystem Backup to Dumb Servers
- *
- * Copyright (C) 2008 The Regents of the University of California
- * Written by Michael Vrable <mvrable@cs.ucsd.edu>
+/* Cumulus: Efficient Filesystem Backup to the Cloud
+ * Copyright (C) 2008 The Cumulus Developers
+ * See the AUTHORS file for a list of contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-23,12
+22,13
@@
* referenced from the new metadata log. */
#include <stdlib.h>
* referenced from the new metadata log. */
#include <stdlib.h>
+#include <string.h>
#include <assert.h>
#include <arpa/inet.h>
#include "subfile.h"
#include <assert.h>
#include <arpa/inet.h>
#include "subfile.h"
-#include "chunk.h"
-#include "sha1.h"
+#include "
third_party/
chunk.h"
+#include "
third_party/
sha1.h"
using std::list;
using std::map;
using std::list;
using std::map;
@@
-194,6
+194,12
@@
void Subfile::store_block_signatures(ObjectReference ref, block_summary summary)
free(packed);
}
free(packed);
}
+void Subfile::store_analyzed_signatures(ObjectReference ref)
+{
+ if (analyzed_len >= 16384)
+ store_block_signatures(ref, new_block_summary);
+}
+
/* Compute an incremental representation of the most recent block analyzed. */
enum subfile_item_type { SUBFILE_COPY, SUBFILE_NEW };
/* Compute an incremental representation of the most recent block analyzed. */
enum subfile_item_type { SUBFILE_COPY, SUBFILE_NEW };
@@
-256,15
+262,11
@@
list<ObjectReference> Subfile::create_incremental(TarSegmentStore *tss,
// No data was matched. The entire block can be written out as is into a
// new object, and the new_block_summary used to save chunk signatures.
if (!matched_old) {
// No data was matched. The entire block can be written out as is into a
// new object, and the new_block_summary used to save chunk signatures.
if (!matched_old) {
- SHA1Checksum block_hash;
- block_hash.process(analyzed_buf, analyzed_len);
- string block_csum = block_hash.checksum_str();
-
- o->set_data(analyzed_buf, analyzed_len);
+ o->set_age(block_age);
+ o->set_data(analyzed_buf, analyzed_len, NULL);
o->write(tss);
ObjectReference ref = o->get_ref();
o->write(tss);
ObjectReference ref = o->get_ref();
- db->StoreObject(ref, block_csum, analyzed_len, block_age);
- store_block_signatures(ref, new_block_summary);
+ store_analyzed_signatures(ref);
refs.push_back(ref);
delete o;
return refs;
refs.push_back(ref);
delete o;
return refs;
@@
-288,7
+290,7
@@
list<ObjectReference> Subfile::create_incremental(TarSegmentStore *tss,
string block_csum = block_hash.checksum_str();
o->set_group("data");
string block_csum = block_hash.checksum_str();
o->set_group("data");
- o->set_data(literal_buf, new_data);
+ o->set_data(literal_buf, new_data
, NULL
);
o->write(tss);
ObjectReference ref = o->get_ref();
for (i = items.begin(); i != items.end(); ++i) {
o->write(tss);
ObjectReference ref = o->get_ref();
for (i = items.begin(); i != items.end(); ++i) {
@@
-298,7
+300,7
@@
list<ObjectReference> Subfile::create_incremental(TarSegmentStore *tss,
}
}
}
}
-
db->StoreObject(ref, block_csum, new_data
, 0.0);
+
//db->StoreObject(ref
, 0.0);
block_summary summary;
summary.ref = ref;
block_summary summary;
summary.ref = ref;