Archived

This forum has been archived. Please start a new discussion on GitHub.

Getting the progress information from IcePatch2

Hello:) What is the API of IcePatch2 for mapping of the patch progression? I mean how can I derive the information about the state of the patch progression while IcePatch2-Client is running? You present your own graphical client for IcePatch2 in the manual, but I couldn't find any information about how it derives the progression state from the underlying IcePatch2-application.

Best regards
Ewgenij

Comments

  • IcePatch2::PatcherFeedback

    Ice for C++ provides a include/IcePatch2/ClientUtil.h implementing an asynchronous IcePatch2 client. There are hooks for providing feedback at several points.

    See demo/IcePatch2/MFC/PatchClientDlg.{h,cpp} for an example of this.

    Regards,
    Paco
  • Hello, thanks for your remarks. I looked at the corresponding sources before posting my question. But the problem is that the hooks are not marked there and I do not know where exactly the information is derived. So I thought it would be a great help if somebody could name and describe the hooks shortly so I can localize and use them. It would save me a lot of time to search and understand the way of working of these classes.

    Greetings
    Ewgenij
  • Did you look at the code?

    From the include/IcePatch2/ClientUtil.h:
    class ICE_PATCH2_API PatcherFeedback : public IceUtil::Shared
    {
    public:
        virtual bool noFileSummary(const std::string&) = 0;
    
        virtual bool checksumStart() = 0;
        virtual bool checksumProgress(const std::string&) = 0;
        virtual bool checksumEnd() = 0;
    
        virtual bool fileListStart() = 0;
        virtual bool fileListProgress(Ice::Int) = 0;
        virtual bool fileListEnd() = 0;
    
        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;
    };
    

    I think it is pretty straightforward:
    • noFileSummary: The checksum file is missing at the client side.
    • checksumStart: Starting the checksum computation phase.
    • checksumProgress: Invoked whenever a new checksum is computed.
    • checksumEnd: End of checksum computation phase.
    • fileListStart: Starting the file list preparation phase.
    • fileListProgress: Progress in this phase (as a percentage).
    • fileListEnd: End of file list preparation phase.
    • patchStart: Started patching a file.
    • patchProgress: Progress in current file patching.
    • patchEnd: Finished patching current file.

    If you want the details read src/IcePatch2/ClientUtil.cpp and src/IcePatch2/Util.cpp.

    If you just want to use it read src/IcePatch2/Client.cpp or demo/IcePatch2/MFC/PatchClientDlg.*

    Regards,
    Paco
  • Hey, and what are the arguments of

    virtual bool fileListProgress(Ice::Int),
    virtual bool patchStart(const std::string&, Ice::Long, Ice::Long, Ice::Long) and

    virtual bool patchProgress(Ice::Long, Ice::Long, Ice::Long, Ice::Long)?

    Ewgenij
  • matthew
    matthew NL, Canada
    As mentioned you should look at demo/IcePatch2/MFC for details on this stuff.
    virtual bool
    fileListProgress(Ice::Int percent)
    
    virtual bool
    patchStart(const string& path, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
    
    virtual bool
    patchProgress(Ice::Long progress, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
    
  • Why don't you read the code?

    I must over stress that Ice is very well written. If you are coding an application with Ice you can read C++. Besides, Ice code is very readable. Besides, I told you what to look at. Besides, it takes less than a minute to answer your question by reading the code and a few hours to get a response in the forums. Is this some kind of allergy to foreign code ;-) ?

    From demo/IcePatch2/MFC/PatchClientDlg.cpp:
    class DialogPatcherFeedback ...
    { ...
        virtual bool fileListProgress(Ice::Int percent) ...
        virtual bool patchStart(const string& path, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize) ...
        virtual bool patchProgress(Ice::Long progress, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize) ...
    };
    

    If you want the details, again, src/IcePatch2/ClientUtil.cpp
    • percent is the percentage of FileInfo structures got.
    • path is the file that is going to be patched now.
    • size is the size of the file to be patched.
    • totalProgress is the overall number of bytes already updated.
    • totalSize is the overall patch size, including all files to be patched.

    Regards,
    F. Moya
  • Is this some kind of allergy to foreign code?

    Indeed it is. Remember, real programmers use...
    C:\PROJECT>COPY CON PROGRAM.EXE
    

    Also, does that mean people who are hyper-allergenic are allergic to multi-threading?
  • Thank you!:) OK, I see there is no other way than reading foreign code...

    One more question. After I read the code I didn't find a possibility to retrieve the lists of deleted and updated files. There are FileInfo structures in the Patcher class

    FileInfoSeq _localFiles;
    FileInfoSeq _updateFiles;
    FileInfoSeq _updateFlags;
    FileInfoSeq _removeFiles;

    which contain the required information, but they are private and there are no functions available to access their contents. So if I want to get the lists of deleted and updated files I have to make changes to the sources of IcePatch2. Or is there another way?

    Regards
    Ewgenij
  • ClientUtil is just an example

    Please, note that ClientUtil has nothing to do with the IcePatch service itself. If you do not like the abstraction provided by Patcher class do not hesitate to build your own.
    Many of my students (third year undergrad) didn't feel comfortable with C++ and they built their own abstractions using just the IcePatch Slice interfaces. Most of them came up with different ways to build and save the lists themselves.