Solution for deploying icepatch2 + icegrid

Source: Internet
Author: User

First introduce icepatch2

Icepatch2 is a service used in ice to upgrade file synchronization. I don't know whether there is any deviation. I understand it in this way. icepatch2 can synchronize content in a directory on the server to the client. In actual development, icepatch2 can be used for Synchronous policy delivery, upgrade, and other operations.

Icepatch2 displays icepatch2calc.exe icepatch2server.exe icepatch2server.exe icepatch2client.exe in the bindirectory to simulate a small scenario where icepatch2 is synchronously downloaded. If you need further programming, You need to refer to the relevant documentation of ice. The first-level demo contains an icepatch2 example of MFC.

 

Next, let's introduce icegrid.

Icegrid is called grid computing. In large projects, server resources can be balanced, but in my opinion, in the icegrid project, icegrid itself may also become a bottleneck of server performance.

Nothing else is nonsense. Please refer to the ice user manual for more icegrid functions and usage. There is a Chinese version online, but the version is old. It is suitable for beginners to take a look, I have read it several times. The latest document needs to be downloaded at zeroc. Currently, it seems to be 3.4.

 

In my current project, the server uses icegrid. The client needs to encode icepatch2 to synchronize a folder from the server. Then the problem arises.

Icepatch2 must specify the server endpoints to locate the server.

However, icegrid uses a locator attribute such as ice. Default. locator to specify a locator, which then locates and starts the server.

Therefore, in myProgramOnly ice. Default. locator does not have the endpoints of the server.CodeThere is no way to locate the server. In fact, the locator section is not set in the code given by icepatch2.

 

To solve this problem, I had to modify the ice source code. Ice provides two versions of the ice distribution package. One is source distributions, which has source code, and the other is Windows installers, which has no source code, fortunately, I downloaded the source code. The following code is a function used by icepatch2 in c: \ ice-3.4.0 \ CPP \ SRC \ icepatch2lib \ clientutil. cpp. I modified the red part and forgot the initial code.

 

After the modification, icepatch2. on the client, you can set only locator, instead of endpoints.

 

 

Code

Icepatch2: Patcher ( Const Communicatorptr & Communicator, Const Patcherfeedbackptr & Feedback ):
_ Feedback (feedback ),
_ Datadir (Communicator -> Getproperties () -> Getpropertywithdefault ( " Icepatch2.directory " , " . " )),
_ Thorough (Communicator -> Getproperties () -> Getpropertyasint ( " Icepatch2.thorough " ) >   0 ),
_ Chunksize (Communicator -> Getproperties () -> Getpropertyasintwithdefault ( " Icepatch2.chunksize " , 100 )),
_ Remove (Communicator -> Getproperties () -> Getpropertyasintwithdefault ( " Icepatch2.remove " , 1 )),
_ Log ( 0 )
{
Propertiesptr Properties = Communicator -> Getproperties ();

Const   Char * Endpointsproperty =   " Icepatch2.endpoints " ;
String Endpoints = Properties -> Getproperty (endpointsproperty );
Objectprx serverbase;
Identity ID;
Id. Category = Properties -> Getpropertywithdefault ( " Icepatch2.instancename " , " Icepatch2 " );
Id. Name =   " Server " ;
If (Endpoints. Empty ())
Serverbase = Communicator -> Stringtoproxy ( " \ "" + Communicator-> identitytostring (ID) + " \ "   " );
Else
Serverbase = Communicator -> Stringtoproxy ( " \ "" + Communicator-> identitytostring (ID) + " \ " : "   + Endpoints );
Fileserverprx Server = Fileserverprx: checkedcast (serverbase );
If ( ! Server)
{
Throw   " Proxy' "   + Communicator -> Identitytostring (ID) +   ' : '   + Endpoints +   " 'Is not a file server. " ;
}

Init (server );
}

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.