X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=metadata.h;h=858a94d1f179b6da9435b08bec6d64b8880dad6d;hb=38ae53bac981d564d9f04c038a88d727289db5c8;hp=7a09c7445b60330e7eb1796e8670b0b5a3cce001;hpb=6bb973b965a30832c3e2d9f6a24e80d3309ef89e;p=cumulus.git diff --git a/metadata.h b/metadata.h index 7a09c74..858a94d 100644 --- a/metadata.h +++ b/metadata.h @@ -10,6 +10,10 @@ #ifndef _LBS_METADATA_H #define _LBS_METADATA_H +#include +#include +#include +#include #include #include @@ -17,17 +21,55 @@ #include "ref.h" #include "util.h" +extern bool flag_full_metadata; + +/* Metadata for a single inode, ready to be written out. */ +struct MetadataItem { + int offset; + std::string text; + + bool reused; + ObjectReference ref; +}; + class MetadataWriter { public: - MetadataWriter(TarSegmentStore *store); - void add(const std::string& path, dictionary info); + MetadataWriter(TarSegmentStore *store, const char *path, + const char *snapshot_name, const char *snapshot_scheme); + void add(dictionary info); ObjectReference close(); + bool find(const std::string& path); + ObjectReference old_ref() const { + return ObjectReference::parse(old_metadata_loc); + } + + bool is_unchanged(const struct stat *stat_buf); + + dictionary get_old_metadata() const { return old_metadata; } + std::list get_blocks(); + std::string get_checksum() { return old_metadata["checksum"]; } + private: void metadata_flush(); + void read_statcache(); + // Where are objects eventually written to? TarSegmentStore *store; - std::ostringstream metadata, metadata_root; + + // File descriptors for reading/writing local statcache data + std::string statcache_path, statcache_tmp_path; + FILE *statcache_in, *statcache_out; + + // Metadata not yet written out to the segment store + size_t chunk_size; + std::list items; + std::ostringstream metadata_root; + + // Statcache information read back in from a previous run + bool old_metadata_eof; + dictionary old_metadata; + std::string old_metadata_loc; // Reference to where the metadata is found }; #endif // _LBS_METADATA_H