Initial refactoring of metadata logging.
[cumulus.git] / metadata.h
diff --git a/metadata.h b/metadata.h
new file mode 100644 (file)
index 0000000..7a09c74
--- /dev/null
@@ -0,0 +1,33 @@
+/* LBS: An LFS-inspired filesystem backup system
+ * Copyright (C) 2007  Michael Vrable
+ *
+ * Handling of metadata written to backup snapshots.  This manages the writing
+ * of file metadata into new backup snapshots, including breaking the metadata
+ * log apart across separate objects.  Eventually this should include unified
+ * handling of the statcache, and re-use of metadata between snapshots.
+ */
+
+#ifndef _LBS_METADATA_H
+#define _LBS_METADATA_H
+
+#include <string>
+#include <sstream>
+
+#include "store.h"
+#include "ref.h"
+#include "util.h"
+
+class MetadataWriter {
+public:
+    MetadataWriter(TarSegmentStore *store);
+    void add(const std::string& path, dictionary info);
+    ObjectReference close();
+
+private:
+    void metadata_flush();
+
+    TarSegmentStore *store;
+    std::ostringstream metadata, metadata_root;
+};
+
+#endif // _LBS_METADATA_H