X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=store.h;h=580881cff4b1d77ea596a8b4330d54539796b745;hb=f1f817df56ce99ea544569635698df55d72bd1ee;hp=956a1b51b950c1759dbf75d38f305e794be3e3f2;hpb=dbba40b5a3722e4acb0cc043f0be1bebff872f27;p=cumulus.git diff --git a/store.h b/store.h index 956a1b5..580881c 100644 --- a/store.h +++ b/store.h @@ -18,6 +18,7 @@ #include #include "localdb.h" +#include "remote.h" #include "sha1.h" #include "ref.h" @@ -69,7 +70,7 @@ struct tar_header * first; incremental writing is not supported. */ class Tarfile { public: - Tarfile(const std::string &path, const std::string &segment); + Tarfile(RemoteFile *file, const std::string &segment); ~Tarfile(); void write_object(int id, const char *data, size_t len); @@ -81,6 +82,8 @@ private: size_t size; std::string segment_name; + RemoteFile *file; + /* Filter support. */ int real_fd, filter_fd; pid_t filter_pid; @@ -92,9 +95,9 @@ private: class TarSegmentStore { public: // New segments will be stored in the given directory. - TarSegmentStore(const std::string &path, + TarSegmentStore(RemoteStore *remote, LocalDb *db = NULL) - { this->path = path; this->db = db; } + { this->remote = remote; this->db = db; } ~TarSegmentStore() { sync(); } // Writes an object to segment in the store, and returns the name @@ -115,11 +118,12 @@ private: Tarfile *file; std::string name; // UUID int count; // Objects written to this segment + int size; // Combined size of objects written std::string basename; // Name of segment without directory - std::string fullname; // Full path to stored segment + RemoteFile *rf; }; - std::string path; + RemoteStore *remote; std::map segments; LocalDb *db;