Data synchronization method, device, cloud platform, system and storage medium
1. A data synchronization method is applied to a cloud platform and comprises the following steps:
receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries a file name of a file to be synchronized;
forwarding the data synchronization request to a data storage terminal;
and receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
2. The method of claim 1, wherein forwarding the data synchronization request to a data store comprises:
and when the predefined bucket does not comprise the file name of the file to be synchronized, forwarding the data synchronization request to a data storage end.
3. The method of claim 1, wherein forwarding the data synchronization request to a data store comprises:
and when the predefined bucket comprises the file name of the file to be synchronized and a preset forcing parameter corresponding to the file name of the file to be synchronized, forwarding the data synchronization request to a data storage terminal based on the value of the preset forcing parameter.
4. The method according to claim 1, wherein the data synchronization request further carries a check code corresponding to the file name;
wherein, the forwarding the data synchronization request to a data storage end includes:
and when the predefined storage bucket comprises the file name of the file to be synchronized and the check code carried by the data synchronization request is inconsistent with the check code pre-stored in the storage bucket, forwarding the data synchronization request to a data storage end.
5. The method according to claim 2, wherein the data synchronization request further carries a check code corresponding to the file name;
wherein, the executing the storage operation to the file to be synchronized comprises:
and when the check code carried by the data synchronization request is consistent with the check code carried by the file to be synchronized, executing storage operation on the file to be synchronized.
6. The method according to claim 4, wherein the performing a storage operation on the file to be synchronized comprises:
determining whether a check code carried by the data synchronization request is consistent with a check code carried by the file to be synchronized returned by the data storage end;
and when the check code carried by the data synchronization request is consistent with the check code carried by the file to be synchronized returned by the data storage end, executing storage operation on the file to be synchronized.
7. The method of claim 1, further comprising:
determining an execution result of executing storage operation on the file to be synchronized and feedback information corresponding to the execution result;
and feeding back feedback information corresponding to the execution result to the terminal.
8. The method of claim 1, further comprising:
when the network state among the terminal, the cloud platform and the data storage end is abnormal, the address of the data storage end is wrong, and/or the source station of the data storage end is abnormal, corresponding abnormal feedback information is generated, and the abnormal feedback information is fed back to the terminal.
9. The method of claim 1, wherein forwarding the data synchronization request to a data store comprises:
determining whether a same request as the data synchronization request is being executed;
and when the same request as the data synchronization request is not executed, forwarding the data synchronization request to a data storage terminal.
10. A data synchronization apparatus configured on a cloud platform, the apparatus comprising:
the data synchronization request receiving module is used for receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries the file name of a file to be synchronized;
the data synchronization request forwarding module is used for forwarding the data synchronization request to a data storage terminal;
the file to be synchronized pulling module is used for receiving the file to be synchronized corresponding to the file name returned by the data storage end;
and the file to be synchronized storage module is used for executing storage operation on the file to be synchronized.
11. A cloud platform, the cloud platform comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a data synchronization method as recited in any of claims 1-9.
12. A data synchronization system, comprising:
the system comprises a terminal, a cloud platform and a data storage terminal;
the terminal receives a data synchronization request input from the outside and forwards the data synchronization request to the cloud platform, wherein the data synchronization request carries the file name of a file to be synchronized;
the cloud platform receives a data synchronization request sent by a terminal;
forwarding the data synchronization request to a data storage terminal;
receiving a file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized;
the data storage end receives a data synchronization request sent by the cloud platform;
matching the file name of the file to be synchronized carried by the data synchronization request with the file names of the pre-stored files, and screening out the file to be synchronized corresponding to the file name;
and sending the file to be synchronized to the cloud platform.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the data synchronization method according to any one of claims 1 to 9.
Background
The terminal generally needs to maintain data synchronization with the server. For example, a contact list stored by the terminal needs to be synchronized with a contact list of the latest version stored by the server; the files stored locally at the terminal need to be kept in sync with the latest version of the files stored at the server.
In the prior art, a synchronization mode of data on a terminal is to upload data to a cloud for data synchronization through a general basic upload interface. Such interfaces can well support the synchronization process of data stored locally at the terminal. When the data is stored in the data storage end of the third party, the user needs to pull the non-local data to the local first, and then upload the pulled data to the cloud storage to realize data synchronization.
However, for a service scenario in which data synchronization is performed on non-local data, a network overhead of a user is additionally increased in a process of pulling the non-local data to a local storage, a pulling logic of the non-local data and a data uploading logic need to be maintained in the service logic, and when the service scenarios are the same, a large amount of manpower is wasted if the logic needs to be maintained for different clients.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the present disclosure provides a data synchronization method, apparatus, cloud platform, system, and storage medium, so as to greatly reduce network overhead and labor cost of a user.
The present disclosure provides a data synchronization method, applied to a cloud platform, the method including:
receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries a file name of a file to be synchronized;
forwarding the data synchronization request to a data storage terminal;
and receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
The present disclosure provides a data synchronization apparatus configured on a cloud platform, the apparatus including:
the data synchronization request receiving module is used for receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries the file name of a file to be synchronized;
the data synchronization request forwarding module is used for forwarding the data synchronization request to a data storage terminal;
the file to be synchronized pulling module is used for receiving the file to be synchronized corresponding to the file name returned by the data storage end;
and the file to be synchronized storage module is used for executing storage operation on the file to be synchronized.
An embodiment of the present invention further provides a cloud platform, where the cloud platform includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the data synchronization method provided by any embodiment of the present invention.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data synchronization method provided in any embodiment of the present invention.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
after receiving a data synchronization request sent by a terminal, the cloud platform forwards the synchronization request to a data storage end so as to search a file to be synchronized corresponding to the file name from the data storage end, and uploads the received file to be synchronized to a storage bucket so as to upload the file to be synchronized stored in the data storage end to the cloud platform for storage. The method and the system have the advantages that non-local data are pulled to the local and then uploaded to the cloud platform for object storage without user intervention, the cloud platform shares a set of pulling and uploading logic, namely data synchronization logic, and when the scenes are the same, the data synchronization logic of each user in the same scene does not need to be maintained, so that network overhead and labor cost of the users are greatly reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a logic diagram of a data synchronization method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a data synchronization method according to an embodiment of the present disclosure;
FIG. 3 is another logical schematic diagram of data synchronization provided by embodiments of the present disclosure;
fig. 4 is a schematic flow chart of another data synchronization method provided in the embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a cloud platform according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
The current data synchronization mode is that data on a terminal is uploaded to a cloud for data synchronization through a general basic uploading interface. The interface supports data stored locally in the terminal well, and cannot synchronize data stored in a data storage end of a third party across platforms. For example, when data is stored in a third-party server or other platforms such as a machine room, a user needs to manually pull data stored in a data storage terminal to a local terminal, and upload the local data of the terminal to a cloud platform through a general basic upload interface for object storage. The object storage is distributed storage facing to the internet, also called object-oriented storage. The method supports reading, writing and managing files at any time and place through an http protocol, supports a standard Rest API (Representational State transfer Programming Interface), provides an infinite storage space for a user through a flat storage framework, is a storage mode with high reliability, high availability, low cost and wireless expansion, is suitable for massive unstructured data storage, and can support elastic expansion of resources.
Object storage represents "buckets," which are used to store data, and which may also be referred to as buckets. The data stored in the data storage end of the third party is synchronized to the cloud platform for object storage.
However, the foregoing data synchronization method has a disadvantage that, for a service scenario in which data synchronization is performed on non-local data, the non-local data needs to be pulled to the local and then uploaded to the cloud platform under user intervention, which increases network overhead of the user; moreover, the background needs to maintain the data synchronization logic of each user in the above scenario, and if the number of users is large, a large amount of human resources need to be wasted to maintain the data synchronization logic.
In order to solve the above problem, embodiments of the present disclosure provide a data synchronization method, apparatus, cloud platform, system, and storage medium capable of reducing network overhead and human cost. The data synchronization method provided by the embodiment of the present disclosure may refer to a logic schematic diagram of the data synchronization method shown in fig. 1. Referring to fig. 1, first, a terminal 200 receives a data synchronization request input from the outside, and forwards the data synchronization request to a cloud platform 400 through a fetch interface (which may provide an interface for acquiring resources (including a cross-domain request)), where the data synchronization request carries a file name of a file to be synchronized; then, the cloud platform 400 notifies the data pulling service, and forwards the data synchronization request to the data storage 600 through the data pulling service, so as to initiate a data downloading request to the data storage 600, where the data storage 600 may be a third-party server or another platform for storing data; the data storage end 600 matches the file name with the file names of the pre-stored files according to the received data synchronization request, screens out the files to be synchronized corresponding to the file names, and returns the files to be synchronized to the cloud platform 400; further, after receiving the file to be synchronized, the cloud platform 400 transfers the file to be synchronized to the cloud platform 400 through the data pull service, and stores the file to be synchronized in a predefined storage bucket, thereby completing the data synchronization process. The terminal 200 may establish a communication connection with the cloud platform through a network protocol, such as hypertext transfer protocol security protocol (HTTPS), and perform information interaction; the cloud platform 400 may establish a connection with a data storage terminal through a network protocol, such as HTTPS, and perform information interaction. The terminal 200 and the cloud platform 400 perform ordered communication and information interaction, and the cloud platform 400 and the data storage terminal 200 perform ordered communication and information interaction, so that ordered execution of the pull service can be ensured, and the execution efficiency of the data pull service can be ensured.
Through the method, when data synchronization operation is performed on the data stored in the data storage end, non-local data is pulled to the local and then uploaded to the cloud platform for object storage without user intervention, and the cloud platform shares a set of pulling uploading logic, namely data synchronization logic.
Hereinafter, a data synchronization method provided by the embodiment of the present disclosure is specifically explained, and the method is applied to a cloud platform.
Fig. 2 is a flow chart of the data synchronization method. Referring to fig. 2, the method includes:
s110, receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries the file name of a file to be synchronized.
In the embodiment of the present disclosure, the terminal may include a desktop computer, a tablet computer, a desktop computer, a notebook computer, a vehicle-mounted terminal, a wearable device, an all-in-one machine, an intelligent home device, and other devices or servers having a communication function.
In the embodiment of the disclosure, the cloud platform may receive a data synchronization request sent by the terminal through the fetch interface, and extract a file name from the data synchronization request. It should be noted that the file to be synchronized may be stored in the terminal, the cloud platform, or in the data storage. For a file to be synchronized stored in the terminal, the cloud platform can directly store the file to be synchronized into the cloud platform without pulling data from a data storage end; for a file to be synchronized stored in the cloud platform, the cloud platform may not perform a storage operation on the file to be synchronized, that is, the cloud platform does not perform a data synchronization operation in an actual sense. For a file to be synchronized stored in a data storage end, the cloud platform needs to pull the file to be synchronized from the data storage end, and upload the pulled file to be synchronized to a storage bucket for storage.
And S120, forwarding the data synchronization request to a data storage terminal.
In the embodiment of the present disclosure, the cloud platform may pre-define relevant parameters for executing the data synchronization request. For example, interface parameters defining the fetch interface and related parameters of the bucket. The interface parameters of the fetch interface may include a third party address of the data store, data encryption parameters, and mandatory override parameters. The third party address may be a Uniform Resource Locator (URL) address, and the URL is encoded in the third party address; the data encryption parameter may be an MD5(Message-Digest Algorithm) parameter, and is to encrypt each file based on the MD5 Algorithm to generate a check code corresponding to the file name, where the check code may include 128 bits of check data of the file corresponding to the file name, and is used to perform data integrity check, so as to check whether the file corresponding to the file name remains intact during transmission and confirm that transmission arrives, and the data type of the data encryption parameter may be a character string type, and the default is null. The mandatory override parameter is used for judging whether to enforce the data stored on the cloud platform to be overridden by the data pulled from the data storage end, the data type of the mandatory override parameter may be a character string type, and whether the default value is true or false. The bucket's associated parameters may include the name of the bucket. In addition, the cloud platform may also predefine parameters such as a domain name of the storage service.
In an optional embodiment, forwarding the data synchronization request to the data storage includes: and when the predefined bucket does not comprise the file name of the file to be synchronized, forwarding the data synchronization request to the data storage terminal.
Specifically, referring to fig. 3, when the data synchronization request only carries the file name, it is described that the data synchronization request does not carry other information, and when the bucket does not include the file name, it is described that the file name and the file to be synchronized corresponding to the file name are not stored in the cloud platform, the file to be synchronized corresponding to the file name needs to be pulled from the data storage end, and an operation of forwarding the data synchronization request to the data storage end is performed, so as to pull the file to be synchronized corresponding to the file name from the data storage end.
In another alternative embodiment, forwarding the data synchronization request to the data storage includes: and when the predefined bucket comprises the file name of the file to be synchronized and a preset forcing parameter corresponding to the file name of the file to be synchronized, forwarding the data synchronization request to a data storage terminal based on the value of the preset forcing parameter.
Specifically, referring to fig. 3, in a case that the data synchronization request only carries the file name, when the data synchronization request only carries the file name, it indicates that the data synchronization request does not carry other information, and when the bucket includes the file name, it indicates that the file name is stored in the cloud platform, or the file name and the corresponding data thereof are stored in the cloud platform; further, when the predefined bucket further includes a preset mandatory parameter corresponding to the file name of the file to be synchronized, and the value of the preset mandatory parameter is true, it indicates that the file to be synchronized corresponding to the file name needs to be pulled from the data storage end, the file to be synchronized pulled from the data storage end covers the file name and the data corresponding to the file name in the cloud platform, and the step of forwarding the data synchronization request to the data storage end is executed, so that the data corresponding to the file name is pulled from the data storage end and serves as the file to be synchronized.
S130, receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
In the embodiment of the disclosure, after the cloud platform forwards the data synchronization request to the data storage end, the data storage end matches the file name carried in the data synchronization request with the file names of the pre-stored files, screens out the files to be synchronized corresponding to the file names, returns the files to be synchronized to the cloud platform through the URL address, and stores the received files to be synchronized in the storage bucket, thereby completing the storage operation of the files to be synchronized.
Specifically, referring to fig. 3, in a case that the data synchronization request only carries the file name, when the predefined bucket does not include the file name, or when the predefined bucket includes the file name and includes a preset mandatory parameter corresponding to the file name, the cloud platform receives, through the URL address, the file to be synchronized corresponding to the file name returned by the data storage end, and directly stores the file to be synchronized into the bucket, thereby completing a process of performing data synchronization on data stored in the data storage end.
Further, after the storage operation is performed on the file to be synchronized, the method further includes: determining an execution result of executing storage operation on a file to be synchronized and feedback information corresponding to the execution result; and feeding back feedback information corresponding to the execution result to the terminal.
In the embodiment of the disclosure, the cloud platform may pre-define state codes corresponding to the execution results under different conditions, and generate feedback information corresponding to the execution results after the storage operation is performed on the file to be synchronized, where the feedback information may include the state codes and the operation state values, and feed the feedback information back to the terminal, so that a terminal user determines the result of data synchronization according to the feedback information.
Referring to fig. 3, in an optional embodiment, when the data synchronization request only carries the file name, and when the predefined bucket does not include the file name, after the file to be synchronized is pulled from the data storage and the storage operation is performed on the file to be synchronized, the generated feedback information has a status code of 200 and an operation status of 0, and is used to remind a user that the file to be synchronized corresponding to the file name is successfully pulled and stored, and to prompt file size information of the file to be synchronized.
Referring to fig. 3, in another optional embodiment, when the data synchronization request only carries the file name, when the predefined bucket includes the file name of the file to be synchronized and includes a preset mandatory parameter corresponding to the file name of the file to be synchronized, if the value of the preset mandatory parameter is true, the file to be synchronized is pulled from the data storage end to perform overlay storage on the data stored in the cloud platform, a state code in the generated feedback information is 200, and an operation state is 0, which is used to remind a user that the file to be synchronized corresponding to the file name is pulled and stored successfully and prompt file size information of the file to be synchronized; when the predefined storage bucket comprises the file name of the file to be synchronized and does not comprise the preset mandatory parameter corresponding to the file name of the file to be synchronized, the file to be synchronized is not pulled from the data storage end and the file to be synchronized is stored, the generated feedback information has a status code of 403 and an operating status of 4, and the status code is used for reminding a user that the data synchronization is unsuccessful and the data synchronization in the actual sense is not performed.
According to the technical scheme provided by the embodiment of the disclosure, after the cloud platform receives a data synchronization request sent by the terminal, the data synchronization request carries the file name of a file to be synchronized, the synchronization request is forwarded to the data storage end, the file to be synchronized corresponding to the file name is searched from the data storage end, the received file to be synchronized is uploaded to the storage bucket, and the file to be synchronized stored in the data storage end is uploaded to the cloud platform for storage. The method and the system have the advantages that non-local data are pulled to the local and then uploaded to the cloud platform for storage without user intervention, the cloud platform shares a set of pulling and uploading logic, namely data synchronization logic, and when the scenes are the same, the data synchronization logic of each user in the same scene does not need to be maintained, so that network overhead and labor cost of the users are greatly reduced.
Fig. 4 is a flow chart of another data synchronization method. Referring to fig. 4, the method includes:
s210, receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries a file name of a file to be synchronized and a check code corresponding to the file name.
S220, the data synchronization request is forwarded to a data storage end.
In an optional embodiment, forwarding the data synchronization request to the data storage includes:
determining whether the file name is included in the bucket;
when the bucket does not contain the file name, the data synchronization request is forwarded to the data storage end, so that the file to be synchronized corresponding to the file name is pulled from the data storage end.
Specifically, referring to fig. 3, under the condition that the data synchronization request also carries the check code corresponding to the file name, when the storage bucket does not include the file name, it indicates that the file name and the file to be synchronized corresponding to the file name are not stored in the cloud platform, and the file to be synchronized corresponding to the file name needs to be pulled from the data storage end, and the operation of forwarding the data synchronization request to the data storage end is executed, so as to pull the file to be synchronized corresponding to the file name from the data storage end.
In another alternative embodiment, forwarding the data synchronization request to the data storage includes: and when the predefined storage bucket comprises the file name of the file to be synchronized and the check code carried by the data synchronization request is inconsistent with the check code pre-stored in the storage bucket, forwarding the data synchronization request to a data storage end.
Specifically, referring to fig. 3, under the condition that the data synchronization request also carries a check code corresponding to the file name, when the predefined bucket includes the file name and the check code in the data synchronization request is inconsistent with the predefined check code in the bucket, it is indicated that the file name is stored in the cloud platform, but the file to be synchronized corresponding to the file name is not stored in the cloud platform, and the file to be synchronized corresponding to the file name needs to be pulled from the data storage end, and an operation of forwarding the data synchronization request to the data storage end is executed, so that the file to be synchronized corresponding to the file name is pulled from the data storage end.
Through the mode, the cloud platform can check based on the check code carried by the data synchronization request, so that the data to be synchronized is pulled from the data storage end according to the check result, and the accuracy of data synchronization can be improved.
And S230, receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
In an optional embodiment, the performing the storage operation on the file to be synchronized includes: and when the check code carried by the data synchronization request is consistent with the check code carried by the file to be synchronized, executing storage operation on the file to be synchronized.
Specifically, referring to fig. 3, under the condition that the data synchronization request also carries the check code corresponding to the file name, when the predefined bucket does not include the file name, the file to be synchronized corresponding to the file name is pulled from the data storage end, and when the check code carried by the file to be synchronized is consistent with the check code pre-stored in the bucket, the file to be synchronized passes the check, the file to be synchronized is stored in the predefined bucket, and the storage operation of the file to be synchronized is completed.
In another optional embodiment, the performing the storage operation on the file to be synchronized includes:
determining whether a check code carried by the data synchronization request is consistent with a check code carried by the file to be synchronized returned by the data storage end;
and when the check code carried by the data synchronization request is consistent with the check code carried by the file to be synchronized returned by the data storage end, executing storage operation on the file to be synchronized.
Specifically, referring to fig. 3, under the condition that the data synchronization request also carries the check code corresponding to the file name, when the predefined storage bucket includes the file name and the check code carried by the data synchronization request is inconsistent with the check code carried by the file to be synchronized, it is indicated that the file to be synchronized is not stored in the cloud platform, the file to be synchronized corresponding to the file name is pulled from the data storage end, and when the check code carried by the file to be synchronized is consistent with the check code stored in the storage bucket in advance, the file to be synchronized passes through the check, the file to be synchronized is stored in the predefined storage bucket, and the storage operation of the file to be synchronized is completed.
Through the mode, the cloud platform can verify the check code carried by the file to be synchronized and the check code pre-stored in the storage bucket based on the check code, the file to be synchronized passing the verification is stored, and the accuracy of a data synchronization result is improved.
As described above, after the storage operation is performed on the file to be synchronized, the method further includes: determining an execution result of executing storage operation on a file to be synchronized and feedback information corresponding to the execution result; and feeding back feedback information corresponding to the execution result to the terminal.
Referring to fig. 3, in an optional embodiment, when the data synchronization request further carries a check code corresponding to the file name, and when the predefined storage bucket does not include the file name of the file to be synchronized, after the file to be synchronized is pulled from the data storage end and the storage operation is performed on the file to be synchronized, it is determined that the check code carried by the data synchronization request is consistent with the check code pre-stored in the storage bucket, the status code in the generated feedback information is 200, and the operation status is 0, which is used to remind a user that the file to be synchronized corresponding to the file name is successfully pulled and stored, and to prompt file size information of the file to be synchronized; when the predefined storage barrel does not contain the file name of the file to be synchronized, the file to be synchronized is pulled from the data storage end, the check code carried by the data synchronization request is determined to be inconsistent with the check code pre-stored in the storage barrel, the state code in the generated feedback information is 200, the operation state is 3, the operation state is used for reminding a user that the file to be synchronized corresponding to the file name does not pass the check, the operation of pulling the file to be synchronized from the data storage end is repeatedly executed, the check operation is repeatedly executed based on the check code carried by the data synchronization request and the check code pre-stored in the storage barrel until the check codes are consistent, the file to be synchronized is stored in the predefined storage barrel, the feedback information is generated, the state code in the feedback information is 200, the operation state is 0, and the user is reminded that the file to be synchronized corresponding to the file name is successfully pulled and stored, and prompting the file size information of the file to be synchronized.
Referring to fig. 3, in another optional embodiment, in the case that the data synchronization request further carries a check code corresponding to the file name, when a predefined bucket includes the file name of the file to be synchronized, it is determined that the check code carried by the data synchronization request is consistent with the check code pre-stored in the bucket, and when the check code is consistent, the status code in the generated feedback information is 200, and the operation status is 4, which is used to remind the user that the data synchronization is successful but not performed in an actual sense; when the predefined bucket comprises the file name of the file to be synchronized and the check code carried by the data synchronization request is inconsistent with the check code pre-stored in the storage bucket, after the file to be synchronized is pulled from the data storage end, when the check code carried by the data synchronization request is determined to be inconsistent with the check code pre-stored in the storage bucket, the state code in the generated feedback information is 200, the operation state is 3, the operation state is used for reminding a user that the file to be synchronized corresponding to the file name does not pass the check, the operation of pulling the file to be synchronized from the data storage end is repeatedly executed, the check operation is repeatedly executed based on the check code carried by the data synchronization request and the check code pre-stored in the storage bucket until the check codes are consistent, the file to be synchronized is stored in the predefined storage bucket, the feedback information is generated, the state code in the feedback information is 200, and the operation state is 0, the file size reminding method is used for reminding a user that the file to be synchronized corresponding to the file name is successfully pulled and stored, and reminding the user of the file size information of the file to be synchronized.
By the method, the cloud platform executes the data synchronization operation according to different conditions, the data synchronization operation process is guaranteed to be executed orderly, execution abnormity is avoided, a user does not need to pay attention to the service implementation process, and the network overhead of the user is reduced; and by generating the feedback information and feeding the feedback information back to the terminal, the user can know the data synchronization result in time, and the user experience is improved.
In the embodiment of the disclosure, the cloud platform may further detect a network state among the terminal, the cloud platform, and the data storage end, an address of the data storage end, and a source station of the data storage end in real time, and when the network state among the terminal, the cloud platform, and the data storage end is abnormal, an address error of the data storage end, and/or the source station of the data storage end is abnormal, generate corresponding abnormal feedback information, and feed the abnormal feedback information back to the terminal.
In an optional embodiment, when a network state between the terminal, the cloud platform, and the data storage terminal is abnormal or a synchronization program is abnormal, which results in a data synchronization process failure, abnormal feedback information is generated, where a state code of the abnormal feedback information is 500, and an operation state is 2, and is used to remind a user that the data synchronization process failure and please retry later.
In another optional embodiment, when an address error of the data storage end and/or a source station of the data storage end is abnormal, a data synchronization process is failed, and abnormal feedback information is generated, where a status code of the abnormal feedback information is 424, an operation status is 1, and is used to remind a user of the address error of the data storage end and/or the source station of the data storage end being abnormal, check whether the address of the data storage end is erroneous and/or check whether the source station of the data storage end is abnormal.
In this embodiment of the present disclosure, forwarding the data synchronization request to a data storage end includes: determining whether a request identical to the data synchronization request is being performed; when the same request as the data synchronization request is not executed, the data synchronization request is forwarded to the data storage.
Optionally, when a request identical to the data synchronization request is being executed, feedback information to be executed is generated, where a status code of the feedback information to be executed is 403, and an operation status is 5, and is used to remind a user that the data synchronization operation corresponding to the file name is being executed.
By the aid of the method, when the data synchronization process fails, a user can timely acquire the abnormal reason, timely take measures to reply the data synchronization process, and orderly execution of the data synchronization process is guaranteed.
The following is an embodiment of a data synchronization apparatus provided in an embodiment of the present invention, and the apparatus and the data synchronization method of the foregoing embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the data synchronization apparatus may refer to the embodiment of the data synchronization method.
As shown in fig. 5, the data synchronization apparatus includes: a data synchronization request receiving module 301, a data synchronization request forwarding module 302, a to-be-synchronized file pulling module 303, and a to-be-synchronized file storing module 304.
The data synchronization request receiving module 301 is configured to receive a data synchronization request sent by a terminal, where the data synchronization request carries a file name of a file to be synchronized;
a data synchronization request forwarding module 302, configured to forward the data synchronization request to a data storage end;
a to-be-synchronized file pulling module 303, configured to receive a to-be-synchronized file corresponding to the file name returned by the data storage end;
a file to be synchronized storage module 304, configured to perform a storage operation on the file to be synchronized.
According to the technical scheme provided by the embodiment of the disclosure, after the cloud platform receives a data synchronization request sent by the terminal, the cloud platform forwards the synchronization request to the data storage end so as to search the file to be synchronized corresponding to the file name from the data storage end, and uploads the received file to be synchronized to the storage bucket so as to upload the file to be synchronized stored in the data storage end to the cloud platform for storage. The method and the system have the advantages that non-local data are pulled to the local and then uploaded to the cloud platform for object storage without user intervention, the cloud platform shares a set of pulling and uploading logic, namely data synchronization logic, and when the scenes are the same, the data synchronization logic of each user in the same scene does not need to be maintained, so that network overhead and labor cost of the users are greatly reduced.
Optionally, the data synchronization request forwarding module 302 is further configured to forward the data synchronization request to the data storage end when the predefined bucket does not include the file name of the file to be synchronized.
Optionally, the data synchronization request forwarding module 302 is further configured to, when a predefined bucket includes the file name of the file to be synchronized and includes a preset enforcement parameter corresponding to the file name of the file to be synchronized, forward the data synchronization request to the data storage end based on a value of the preset enforcement parameter.
Optionally, the data synchronization request further carries a check code corresponding to the file name;
correspondingly, the data synchronization request forwarding module 302 is further configured to forward the data synchronization request to the data storage end when a predefined bucket includes the file name of the file to be synchronized and the check code carried in the data synchronization request is inconsistent with the check code pre-stored in the bucket.
Optionally, the data synchronization request further carries a check code corresponding to the file name;
correspondingly, the to-be-synchronized file storage module 304 is further configured to, when the check code carried by the data synchronization request is consistent with the check code carried by the to-be-synchronized file, perform a storage operation on the to-be-synchronized file.
Optionally, the to-be-synchronized file storage module 304 is further configured to determine whether a check code carried by the data synchronization request is consistent with a check code carried by the to-be-synchronized file returned by the data storage end;
and when the check code carried by the data synchronization request is consistent with the check code carried by the file to be synchronized returned by the data storage end, executing storage operation on the file to be synchronized.
Optionally, the apparatus further comprises: a first feedback information generation module; the first feedback information generation module is used for determining an execution result of executing storage operation on the file to be synchronized and feedback information corresponding to the execution result;
and feeding back feedback information corresponding to the execution result to the terminal.
Optionally, the apparatus further comprises: a second feedback information generation module; the second feedback information generation module is configured to generate corresponding abnormal feedback information when a network state between the terminal, the cloud platform, and the data storage end is abnormal, an address of the data storage end is incorrect, and/or a source station of the data storage end is abnormal, and feed back the abnormal feedback information to the terminal.
Optionally, the data synchronization request forwarding module 302 is further configured to determine whether the same request as the data synchronization request is being executed;
and when the same request as the data synchronization request is not executed, forwarding the data synchronization request to a data storage terminal.
Through the data synchronization device provided by the embodiment of the disclosure, the effects of greatly reducing the network overhead and the labor cost of a user are achieved.
The data synchronization device provided by the embodiment of the invention can execute the data synchronization method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
The following is an embodiment of the cloud platform provided in the embodiments of the present invention, the cloud platform and the data synchronization method in the embodiments described above belong to the same inventive concept, and details that are not described in detail in the embodiments of the cloud platform may refer to the embodiments of the data synchronization method described above.
Referring to fig. 6, the present embodiment provides a cloud platform 400, which includes: one or more processors 420; the storage device 410 is used for storing one or more programs, and when the one or more programs are executed by the one or more processors 420, the one or more processors 420 implement the data synchronization method provided by the embodiment of the present invention, including:
receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries a file name of a file to be synchronized;
forwarding the data synchronization request to a data storage terminal;
and receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
Of course, those skilled in the art will understand that the processor 420 may also implement the technical solution of the data synchronization method provided in any embodiment of the present invention.
The cloud platform 400 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the cloud platform 400 includes a processor 420, a storage device 410, an input device 430, and an output device 440; the number of the processors 420 in the cloud platform may be one or more, and one processor 420 is taken as an example in fig. 6; the processor 420, the storage device 410, the input device 430, and the output device 440 in the cloud platform may be connected by a bus or other means, and fig. 6 illustrates an example of a connection by a bus.
The storage device 410, as a computer-readable storage medium, can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the data synchronization method in the embodiment of the present invention (for example, a data synchronization request receiving module, a data synchronization request forwarding module, a to-be-synchronized file pulling module, and a to-be-synchronized file storing module in the data synchronization device).
The storage device 410 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 410 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage 410 may further include memory located remotely from processor 420, which may be connected to the cloud platform over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cloud platform, and may include at least one of a mouse, a keyboard, and a touch screen, for example. Output device 440 may include a display cloud platform such as a display screen.
The following is an embodiment of the data synchronization system provided in the embodiments of the present invention, the data synchronization system and the data synchronization method in the embodiments described above belong to the same inventive concept, and details that are not described in detail in the embodiments of the data synchronization system may refer to the embodiments of the data synchronization method described above.
Referring to fig. 1, the system includes: terminal 200, cloud platform 400, and data storage 600.
The terminal 200 receives a data synchronization request input from the outside, and forwards the data synchronization request to the cloud platform 400, wherein the data synchronization request carries a file name of a file to be synchronized;
the cloud platform 400 receives a data synchronization request sent by a terminal;
forwarding the data synchronization request to a data storage terminal;
receiving a file to be synchronized corresponding to a file name returned by a data storage end, and executing storage operation on the file to be synchronized;
the data storage terminal 600 receives a data synchronization request sent by the cloud platform 400;
matching the file name of the file to be synchronized carried by the data synchronization request with the file names of the pre-stored files, and screening out the file to be synchronized corresponding to the file name;
and sending the file to be synchronized to the cloud platform 400.
The following is an embodiment of a computer-readable storage medium provided by an embodiment of the present invention, the computer-readable storage medium and the data synchronization method of the foregoing embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the computer-readable storage medium may refer to the embodiment of the data synchronization method.
The present embodiments provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a data synchronization method applied to a cloud platform, the method comprising:
receiving a data synchronization request sent by a terminal, wherein the data synchronization request carries a file name of a file to be synchronized;
forwarding the data synchronization request to a data storage terminal;
and receiving the file to be synchronized corresponding to the file name returned by the data storage end, and executing storage operation on the file to be synchronized.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the data synchronization method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk, or an optical disk of a computer, and includes several instructions to enable a computer cloud platform (which may be a personal computer, a server, or a network cloud platform) to execute the data synchronization method provided in the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:物理隔离的内外网网间数据自动传输系统