diff options
Diffstat (limited to 'cpp/include/IcePatch2/ClientUtil.h')
-rw-r--r-- | cpp/include/IcePatch2/ClientUtil.h | 86 |
1 files changed, 32 insertions, 54 deletions
diff --git a/cpp/include/IcePatch2/ClientUtil.h b/cpp/include/IcePatch2/ClientUtil.h index 6026b489756..b8739aff9ff 100644 --- a/cpp/include/IcePatch2/ClientUtil.h +++ b/cpp/include/IcePatch2/ClientUtil.h @@ -68,12 +68,8 @@ public: virtual bool patchProgress(Ice::Long, Ice::Long, Ice::Long, Ice::Long) = 0; virtual bool patchEnd() = 0; }; - typedef IceUtil::Handle<PatcherFeedback> PatcherFeedbackPtr; -class Decompressor; -typedef IceUtil::Handle<Decompressor> DecompressorPtr; - // // IcePatch2 clients instantiate the IcePatch2::Patcher class to patch // a given local data directory. @@ -81,30 +77,6 @@ typedef IceUtil::Handle<Decompressor> DecompressorPtr; class ICE_PATCH2_API Patcher : public IceUtil::Shared { public: - - // - // Create a patcher using configuration properties. The following - // properties are used to configure the patcher: - // - // - IcePatch2.InstanceName - // - IcePatch2.Endpoints - // - IcePatch2.Directory - // - IcePatch2.Thorough - // - IcePatch2.ChunkSize - // - IcePatch2.Remove - // - // See the Ice manual for more information on these properties. - // - Patcher(const Ice::CommunicatorPtr&, const PatcherFeedbackPtr&); - - // - // Create a patcher with the given parameters. These parameters - // are equivalent to the configuration properties described above. - // - Patcher(const FileServerPrx&, const PatcherFeedbackPtr&, const std::string&, bool, Ice::Int, Ice::Int); - - virtual ~Patcher(); - // // Prepare the patching. This involves creating the local checksum // files if no summary file exists or if a thorough patch was @@ -116,7 +88,7 @@ public: // necessary, but the user chose not to patch thorough), or raises // std::string as an exception if there was an error. // - bool prepare(); + virtual bool prepare() = 0; // // Patch the files from the given path. @@ -125,41 +97,47 @@ public: // aborted by the user, or raises std::string as an exception if // there was an error. // - bool patch(const std::string&); + virtual bool patch(const std::string&) = 0; // // Finish the patching. This needs to be called once when the // patching is finished to write the local checksum files to the // disk. // - void finish(); - -private: - - void init(const FileServerPrx&); - bool removeFiles(const FileInfoSeq&); - bool updateFiles(const FileInfoSeq&); - bool updateFilesInternal(const FileInfoSeq&, const DecompressorPtr&); - bool updateFlags(const FileInfoSeq&); - - const PatcherFeedbackPtr _feedback; - const std::string _dataDir; - const bool _thorough; - const Ice::Int _chunkSize; - const Ice::Int _remove; - const FileServerPrx _serverCompress; - const FileServerPrx _serverNoCompress; + virtual void finish() = 0; +}; +typedef IceUtil::Handle<Patcher> PatcherPtr; - FileInfoSeq _localFiles; - FileInfoSeq _updateFiles; - FileInfoSeq _updateFlags; - FileInfoSeq _removeFiles; +// +// IcePatch2 clients instantiate the IcePatch2::Patcher class +// using the patcher factory. +// +class ICE_PATCH2_API PatcherFactory : public IceUtil::noncopyable +{ +public: + + // + // Create a patcher using configuration properties. The following + // properties are used to configure the patcher: + // + // - IcePatch2.InstanceName + // - IcePatch2.Endpoints + // - IcePatch2.Directory + // - IcePatch2.Thorough + // - IcePatch2.ChunkSize + // - IcePatch2.Remove + // + // See the Ice manual for more information on these properties. + // + static PatcherPtr create(const Ice::CommunicatorPtr&, const PatcherFeedbackPtr&); - FILE* _log; + // + // Create a patcher with the given parameters. These parameters + // are equivalent to the configuration properties described above. + // + static PatcherPtr create(const FileServerPrx&, const PatcherFeedbackPtr&, const std::string&, bool, Ice::Int, Ice::Int); }; -typedef IceUtil::Handle<Patcher> PatcherPtr; - } #endif |