X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=store.cc;h=ce91e55621d210f82df9a06f9cbaa3c08eb2ff5c;hb=08147fb0bc1d09610b05f3f7d54eda88ef5776ec;hp=0533630757e81ce74a19a5fa024f010e669d6f10;hpb=c26f44fe8cd3eeec0d9d849cb2e639d484de5887;p=cumulus.git diff --git a/store.cc b/store.cc index 0533630..ce91e55 100644 --- a/store.cc +++ b/store.cc @@ -26,8 +26,6 @@ using std::list; using std::set; using std::string; -list TarSegmentStore::norefs; - Tarfile::Tarfile(const string &path, const string &segment) : size(0), segment_name(segment) @@ -39,9 +37,6 @@ Tarfile::Tarfile(const string &path, const string &segment) Tarfile::~Tarfile() { - string checksum_list = checksums.str(); - internal_write_object(segment_name + "/checksums", - checksum_list.data(), checksum_list.size()); tar_append_eof(t); if (tar_close(t) != 0) @@ -55,13 +50,6 @@ void Tarfile::write_object(int id, const char *data, size_t len) string path = segment_name + "/" + buf; internal_write_object(path, data, len); - - // Compute a checksum for the data block, which will be stored at the end - // of the TAR file. - SHA1Checksum hash; - hash.process(data, len); - sprintf(buf, "%08x", id); - checksums << buf << " " << hash.checksum_str() << "\n"; } void Tarfile::internal_write_object(const string &path, @@ -106,8 +94,7 @@ void Tarfile::internal_write_object(const string &path, static const size_t SEGMENT_SIZE = 4 * 1024 * 1024; string TarSegmentStore::write_object(const char *data, size_t len, const - std::string &group, - const std::list &refs) + std::string &group) { struct segment_info *segment; @@ -137,12 +124,6 @@ string TarSegmentStore::write_object(const char *data, size_t len, const string full_name = segment->name + "/" + id_buf; - // Store any dependencies this object has on other segments, so they can be - // written when the segment is closed. - for (list::const_iterator i = refs.begin(); i != refs.end(); ++i) { - segment->refs.insert(*i); - } - // If this segment meets or exceeds the size target, close it so that // future objects will go into a new segment. if (segment->file->size_estimate() >= SEGMENT_SIZE) @@ -163,14 +144,6 @@ void TarSegmentStore::close_segment(const string &group) fprintf(stderr, "Closing segment group %s (%s)\n", group.c_str(), segment->name.c_str()); - string reflist; - for (set::iterator i = segment->refs.begin(); - i != segment->refs.end(); ++i) { - reflist += *i + "\n"; - } - segment->file->internal_write_object(segment->name + "/references", - reflist.data(), reflist.size()); - delete segment->file; segments.erase(segments.find(group)); delete segment; @@ -190,22 +163,12 @@ LbsObject::~LbsObject() { } -void LbsObject::add_reference(const LbsObject *o) -{ - refs.insert(o->get_name()); -} - void LbsObject::write(TarSegmentStore *store) { assert(data != NULL); assert(!written); - list reflist; - for (set::iterator i = refs.begin(); i != refs.end(); ++i) { - reflist.push_back(*i); - } - - name = store->write_object(data, data_len, group, reflist); + name = store->write_object(data, data_len, group); written = true; data = NULL;