X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=scandir.cc;h=043d35eeba637f2cba740c7ae0ef0d5ac5d96596;hb=358b7ac6f741088838fb84979c9127976eb34fdf;hp=d0ed67d5167bc59e620d8442acc101afa64f11a5;hpb=25b6639fb1783e0061affa177e6d6d2131c457f5;p=cumulus.git diff --git a/scandir.cc b/scandir.cc index d0ed67d..043d35e 100644 --- a/scandir.cc +++ b/scandir.cc @@ -20,8 +20,11 @@ using std::string; using std::vector; +static SegmentStore *segment_store; static OutputStream *info_dump = NULL; +static SegmentPartitioner *index_segment, *data_segment; + void scandir(const string& path); /* Converts time to microseconds since the epoch. */ @@ -55,6 +58,8 @@ void dumpfile(int fd, dictionary &file_info) break; } else { hash.process(buf, res); + OutputStream *block = data_segment->new_object(); + block->write(buf, res); size += res; } } @@ -201,10 +206,13 @@ void scandir(const string& path) int main(int argc, char *argv[]) { - SegmentStore ss("."); - SegmentWriter *sw = ss.new_segment(); + segment_store = new SegmentStore("."); + SegmentWriter *sw = segment_store->new_segment(); info_dump = sw->new_object(); + index_segment = new SegmentPartitioner(segment_store); + data_segment = new SegmentPartitioner(segment_store); + string uuid = SegmentWriter::format_uuid(sw->get_uuid()); printf("Backup UUID: %s\n", uuid.c_str()); @@ -214,6 +222,8 @@ int main(int argc, char *argv[]) fprintf(stderr, "IOException: %s\n", e.getError().c_str()); } + delete index_segment; + delete data_segment; delete sw; return 0;