Initial refactoring of metadata logging.
[cumulus.git] / metadata.h
1 /* LBS: An LFS-inspired filesystem backup system
2  * Copyright (C) 2007  Michael Vrable
3  *
4  * Handling of metadata written to backup snapshots.  This manages the writing
5  * of file metadata into new backup snapshots, including breaking the metadata
6  * log apart across separate objects.  Eventually this should include unified
7  * handling of the statcache, and re-use of metadata between snapshots.
8  */
9
10 #ifndef _LBS_METADATA_H
11 #define _LBS_METADATA_H
12
13 #include <string>
14 #include <sstream>
15
16 #include "store.h"
17 #include "ref.h"
18 #include "util.h"
19
20 class MetadataWriter {
21 public:
22     MetadataWriter(TarSegmentStore *store);
23     void add(const std::string& path, dictionary info);
24     ObjectReference close();
25
26 private:
27     void metadata_flush();
28
29     TarSegmentStore *store;
30     std::ostringstream metadata, metadata_root;
31 };
32
33 #endif // _LBS_METADATA_H