/usr/include/IcePatch2/ClientUtil.h is in libzeroc-ice35-dev 3.5.1-6.4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | // **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_PATCH2_CLIENT_UTIL_H
#define ICE_PATCH2_CLIENT_UTIL_H
#include <Ice/Ice.h>
#include <IceUtil/Thread.h>
#include <IcePatch2/FileServer.h>
#include <stdio.h>
namespace IcePatch2
{
//
// The IcePatch2::PatcherFeedback class is implemented by IcePatch2 clients to
// allow the user to interact with the patching and report progress
// on the patching.
//
class ICE_PATCH2_API PatcherFeedback : public IceUtil::Shared
{
public:
//
// The summary file can't be loaded for the given reason. This
// should return true to accept doing a thorough patch, false
// otherwise.
//
virtual bool noFileSummary(const std::string& reason) = 0;
//
// If no summary file is found and/or a thorough patch was
// specified, the following checksum methods are called to report
// the progression of the checksum computation for the local data
// directory. These methods should return false to interrupt the
// checksum, false otherwise.
//
virtual bool checksumStart() = 0;
virtual bool checksumProgress(const std::string&) = 0;
virtual bool checksumEnd() = 0;
//
// These methods are called to report on the progression of the
// computation of the list of files to patch. This involves
// comparing the local checksums with the server checksums. These
// methods should return false to interrupt the computation, false
// otherwise.
//
virtual bool fileListStart() = 0;
virtual bool fileListProgress(Ice::Int) = 0;
virtual bool fileListEnd() = 0;
//
// These methods are called to report on the progression of the
// file patching. Files to be updated are downloaded from the
// server, uncompressed and written to the local data directory.
// These methods should return false to interrupt the patching,
// false otherwise.
//
virtual bool patchStart(const std::string&, Ice::Long, Ice::Long, Ice::Long) = 0;
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.
//
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
// specified. This method also computes the list of files to be
// patched. This should be called once before any call to patch().
//
// Returns true if the patch preparation was successful, false if
// preparation failed (for example, because a thorough patch is
// necessary, but the user chose not to patch thorough), or raises
// std::string as an exception if there was an error.
//
bool prepare();
//
// Patch the files from the given path.
//
// Returns true if patching was successful, false if patching was
// aborted by the user, or raises std::string as an exception if
// there was an error.
//
bool patch(const std::string&);
//
// 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;
FileInfoSeq _localFiles;
FileInfoSeq _updateFiles;
FileInfoSeq _updateFlags;
FileInfoSeq _removeFiles;
FILE* _log;
};
typedef IceUtil::Handle<Patcher> PatcherPtr;
}
#endif
|