WO2018219178A1 - Data synchronization method and apparatus, server, and storage medium - Google Patents

Data synchronization method and apparatus, server, and storage medium Download PDF

Info

Publication number
WO2018219178A1
WO2018219178A1 PCT/CN2018/087867 CN2018087867W WO2018219178A1 WO 2018219178 A1 WO2018219178 A1 WO 2018219178A1 CN 2018087867 W CN2018087867 W CN 2018087867W WO 2018219178 A1 WO2018219178 A1 WO 2018219178A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
server
version identifier
data version
timestamp
Prior art date
Application number
PCT/CN2018/087867
Other languages
French (fr)
Chinese (zh)
Inventor
林立安
刘金
谢世营
陆居洪
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2018219178A1 publication Critical patent/WO2018219178A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Definitions

  • an embodiment of the present application provides a data synchronization method, including:
  • the data synchronization method further includes:
  • a data synchronization method that can be applied to a server. As shown in FIG. 1, the data synchronization method may include the following steps:
  • the plurality of user devices when the server receives the data synchronization request, the plurality of user devices that establish a data synchronization mechanism with the server under the account that the current user has logged in acquires the data version identifier of the data to be synchronized of the plurality of user devices.
  • the plurality of user devices include, but are not limited to, electronic devices such as smart phones, tablet computers, and personal PCs.
  • a data version identifier is preset in each of the plurality of user devices and on the server.
  • the data version identifier is used to record a version of the data on the device to compare the difference between the data on the device and the data on the server.
  • the data version identifier can include the version number of the data. The higher the version number of the data, the shorter the time the data was last updated from the current time.
  • the version number of the data can be associated with the time when the data was changed.
  • the data version number is different when the data on the same device changes at different times.
  • the data version number is different when the same type of data on different devices changes at different times. Whenever a device synchronizes data with the server, it updates the data version identifier on the device and the server.
  • a unified data version identifier can be set for all data on each device, that is, one device has only one data version identifier. It is also possible to set the data version identifier separately for different types of data on each device. For example, a data version identifier is set for the communication data, a data version identifier is set for the album data, and a data version identifier is set for other data. At this point, whenever data synchronization occurs on the server, only the type data that has changed is synchronized.
  • a server and a plurality of electronic devices A, B, C, and D form a data synchronization system.
  • Devices A, B, C, and D all establish communication with the server.
  • a data version identifier is set on each device and the server, and the data version identifier may include a time stamp. This timestamp can be the time when a device last synchronized data with the server.
  • the user can operate on data on any of the devices A, B, C, and D, but cannot directly operate on the data on the server.
  • This operation includes, but is not limited to, adding, deleting, modifying, accessing files, and the like.
  • a user may log into a personal account in the server via a personal PC (or other device) and operate on files in the personal account. This operation is considered as a user's operation on a personal PC (or other device), and the personal PC (or other device) is understood as a device in the data synchronization system.
  • acquiring the data version identifiers of the plurality of user equipments may include the following steps:
  • the user can set a preset period on the server.
  • the server automatically generates a data synchronization request every time the preset period is interrupted, and then acquires the data version identifiers of the plurality of user equipments according to the data synchronization request.
  • the preset period can be 10 minutes.
  • the server automatically generates a data synchronization request every 10 minutes, and performs data synchronization operation.
  • the latest data version identifier is determined from the plurality of data version identifiers.
  • the latest data version identifier indicates that in the above data synchronization system, the data on the device corresponding to the latest data version identifier is the latest.
  • the user has performed operations on the data on the device A, and then has performed operations on the data on the device B. Finally, the data on the device C has been operated. Thereafter, none of the devices A, B, C, and D are operated.
  • the data on device C is the latest data, and the data version corresponding to device C is identified as the latest data version identifier.
  • the server After the server obtains the data version identifiers of the multiple user devices, the time stamp of each data version identifier is extracted from the multiple data version identifiers. Then, the time represented by the extracted timestamp is compared with the current time, so that the timestamp closest to the current time is determined, and the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
  • the time stamp 201702140800 in the data version identifier of the device D is closest to the current time, the time stamp may be determined to be the timestamp closest to the current time. Subsequently, the data version identification of device D is determined to be the latest data version identification.
  • the server may check the extracted multiple timestamps to determine a timestamp that meets the preset condition from the extracted plurality of timestamps.
  • the preset condition may be a condition such as a format set in advance for the time stamp.
  • the preset condition can limit the length of the timestamp to 12 digits. Because the server or multiple user devices may have errors during the update and management of the timestamp, or an error occurs during the data transmission between the server and the user device, the timestamp format extracted by the server is not Eligible, for example, the extracted timestamp is not 12 digits.
  • the server After verifying the extracted multiple timestamps, the server determines the latest data version identifier according to the timestamp that meets the preset condition. For example, the timestamp closest to the current time is determined from the timestamps that meet the preset conditions, and then the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
  • the data to be synchronized can be obtained from the source device corresponding to the latest data version identifier, and the data to be synchronized on the server is updated.
  • the data synchronization method may further include the following steps:
  • S160 Modify a timestamp of the data to be synchronized on the server to a current time.
  • the timestamp of the data to be synchronized on the server may be updated.
  • the device may send a data synchronization request to the server.
  • the server completes data synchronization with the device, the timestamp in the data version identifier of the server itself is changed to the current time.
  • the server can also send a timestamp modification instruction to the device.
  • the device modifies the timestamp in the data version identifier of the data to the current time according to the instruction. At this point, the timestamp update in the data version ID of the server and source device is complete.
  • the data synchronization method may further include the following steps:
  • data synchronization with the remaining devices can be further completed.
  • the target device is a device in which the data version identifier of the plurality of user devices is different from the data version identifier of the source device.
  • the device D is the source device, and the data version identifiers of the devices A, B, and C are different from the data version identifiers of the device D, and the target device includes the devices A and B. C.
  • the server can determine the target device by using the timestamp in the data version identifier. For example, if the device D is the source device and the time stamp in the data version identifier of the device A, B, and C is different from the time stamp in the data version identifier of the device D, the devices A, B, and C may be determined as the target device.
  • the server After the server determines the target device, it pushes data update information to the target device.
  • the data update information is used to enable the target device to acquire the data to be synchronized from the server.
  • the target device After receiving the data update information pushed by the server, the target device acquires the data to be synchronized from the server to complete data synchronization on the target device. Further, after the target device completes the data synchronization, the timestamp in the data version identifier may be updated, and the timestamp is modified to be the timestamp in the data version identifier of the server.
  • the data synchronization process in the data synchronization system can be divided into two stages: server data synchronization and target device data synchronization.
  • the server receives the data synchronization request sent by the source device, or receives the data synchronization request generated by the server itself, and then acquires the data to be synchronized from the source device, and then performs data update on the server.
  • the target device receives the data update information pushed by the server, and then the target device acquires the data to be synchronized from the server, and then performs data update on the target device.
  • the data on the server, the source device, and the target device are consistent, and the data version identifiers on the server, the source device, and the target device are also consistent.
  • the timestamps in the data version identifiers on the server, the source device, and the target device are consistent.
  • the server when the server receives the album synchronization request sent by the user's mobile phone, the album version identifiers on the respective devices are respectively obtained from the mobile phone, the tablet computer, and the personal computer. Subsequently, the latest version identifier is determined from the obtained plurality of album version identifiers. For example, if the album version of the mobile phone is identified as the latest version identifier, the photos to be synchronized are acquired from the mobile phone, and then the photos to be synchronized are stored to the server. Further, after completing the synchronization on the server side, the server may separately send the photos to be synchronized to the tablet computer and the personal computer. Subsequently, the tablet and the personal computer store the received photos separately.
  • the server when the server receives the address book synchronization request sent by the user's mobile phone, the server obtains the address book version identifier on each device from the mobile phone, the tablet computer, and the personal computer. Subsequently, the latest version identifier is determined from the obtained plurality of address book version identifiers. For example, if the address book version of the mobile phone is identified as the latest version identifier, the address book information to be synchronized is obtained from the mobile terminal, and then the address book information to be synchronized is stored in the server. Further, after completing the synchronization on the server side, the server may separately send the address book information to be synchronized to the tablet computer or the personal computer. Subsequently, the tablet computer and the personal computer respectively store the received address book information.
  • the data synchronization method when receiving the data synchronization request, acquires the data version identifier of the data to be synchronized of the plurality of user equipments in the current account; and determines from the obtained multiple data version identifiers.
  • the latest data version identifier is obtained; the source device corresponding to the latest data version identifier is obtained from the current account, and the to-be-synchronized data on the server is updated.
  • the solution obtains the data version identifiers of the plurality of user equipments, and determines the latest data version identifier, and then obtains the data to be synchronized and updates the data from the source device corresponding to the latest data version identifier.
  • the data update in multiple user devices can be synchronized to the server in time, thereby improving the timeliness of server data synchronization.
  • the embodiment of the present application provides a data synchronization apparatus, including:
  • a first acquiring module configured to acquire, when receiving a data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
  • a first determining module configured to determine a latest data version identifier from the obtained multiple data version identifiers
  • a second acquiring module configured to acquire the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account
  • a synchronization module configured to update the to-be-synchronized data on the server.
  • the data synchronization device further includes:
  • a second determining module configured to determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device in the multiple user devices;
  • a pushing module configured to push data update information to the target device.
  • the data version identifier includes a timestamp
  • the first determining module includes:
  • a verification submodule configured to check the obtained multiple timestamps to determine a timestamp that meets a preset condition
  • the determining submodule is configured to determine the latest data version identifier according to the timestamp that meets the preset condition.
  • the data synchronization device further includes:
  • a third obtaining module configured to acquire a timestamp of the to-be-synchronized data on the server
  • a modifying module configured to modify a timestamp of the to-be-synchronized data on the server to a current time.
  • the data version identifier includes a timestamp
  • the first determining module is configured to:
  • the data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
  • the first obtaining module is configured to:
  • the embodiment of the present application further provides a data synchronization device, which can be applied to a server.
  • the data synchronization apparatus 200 includes a first acquisition module 201, a first determination module 202, a second acquisition module 203, and a synchronization module 204.
  • the first obtaining module 201 is configured to acquire, when receiving the data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server.
  • the plurality of user devices that establish a data synchronization mechanism with the server under the account that the current user has logged in acquire the data to be synchronized of the plurality of user devices.
  • Data version identifier The plurality of user devices include, but are not limited to, electronic devices such as smart phones, tablet computers, and personal PCs.
  • the data to be synchronized may include one or more of an album, an address book, a call record, a short message, a browser record, a note, and the like.
  • the data synchronization request is used to complete data synchronization between the server and multiple user devices of the current user. It can be understood that the current user is the user to which the account currently logged in on the server belongs.
  • the data synchronization request may be sent by one of the multiple user equipments to the server, or may be initiated by the server. For example, whenever data on one of the plurality of user devices changes, the device automatically sends a data synchronization request to the server. For another example, whenever the time reaches the preset timing, the server initiates a data synchronization request and processes the data synchronization request.
  • the data synchronization mechanism is used to establish a data synchronization relationship between the plurality of user equipments and the server. That is, whenever the data on one of the plurality of user devices changes, the corresponding modification is also performed on the server; or each time the data on the server is changed, the corresponding information is also performed on the multiple user devices. Modifications.
  • a data version identifier is preset in each of the plurality of user devices and on the server.
  • the data version identifier is used to record a version of the data on the device to compare the difference between the data on the device and the data on the server.
  • the data version identifier can include the version number of the data. The higher the version number of the data, the shorter the time the data was last updated from the current time.
  • the version number of the data can be associated with the time when the data was changed.
  • the data version number is different when the data on the same device changes at different times.
  • the data version number is different when the same type of data on different devices changes at different times. Whenever a device synchronizes data with the server, it updates the data version identifier on the device and the server.
  • a unified data version identifier can be set for all data on each device, that is, one device has only one data version identifier. It is also possible to set the data version identifier separately for different types of data on each device. For example, a data version identifier is set for the communication data, a data version identifier is set for the album data, and a data version identifier is set for other data. At this point, whenever data synchronization occurs on the server, only the type data that has changed is synchronized.
  • a user may log into a personal account in the server via a personal PC (or other device) and operate on files in the personal account. This operation is considered as a user's operation on a personal PC (or other device), and is not an operation on the server, which is understood as a device in a data synchronization system.
  • the first obtaining module 201 is configured to:
  • timing can be set on the server, and whenever the time reaches the timing, the server automatically triggers a data synchronization operation. For example, the user can set the server to automatically perform data synchronization operations at 8 am every day.
  • the first obtaining module 201 continuously determines whether the current time is the preset time. If the time is preset, the first obtaining module 201 automatically generates a data synchronization request, and acquires the data version identifiers of the plurality of user equipments according to the data synchronization request.
  • the user can set a preset period on the server.
  • the first obtaining module 201 automatically generates a data synchronization request, and then acquires the data version identifiers of the plurality of user equipments according to the data synchronization request.
  • the preset period can be 10 minutes.
  • the first obtaining module 201 automatically generates a data synchronization request every 10 minutes, and performs a data synchronization operation.
  • the first determining module 202 is configured to determine the latest data version identifier from the obtained multiple data version identifiers.
  • the first determining module 202 determines the latest data version identifier from the plurality of data version identifiers.
  • the latest data version identifier indicates that in the above data synchronization system, the data on the device corresponding to the latest data version identifier is the latest.
  • the data synchronization system is composed of a server, devices A, B, C, and D.
  • the user performs operations on the data on the device A, and then performs operations on the data on the device B, and finally performs data on the device C.
  • the data on the device C is the latest data
  • the data version corresponding to the device C is the latest data version identifier.
  • the data version identifier may include a time stamp
  • the first determining module 202 includes: an extraction submodule 2021 , a verification submodule 2022 , and a determination submodule 2023 .
  • the extraction sub-module 2021 is configured to extract a respective timestamp from the plurality of data version identifiers
  • the verification sub-module 2022 is configured to check the extracted multiple timestamps to determine a timestamp that meets a preset condition
  • the determining sub-module 2023 is configured to determine a latest data version identifier according to a timestamp that meets a preset condition.
  • the data version identifier may include a timestamp, where the timestamp may be the time when a device last synchronized data with the server. For example, the last time that device A synchronizes data with the server is 8:00 am on February 10, 2017, the time stamp in the data version identifier of device A may be 201702100800.
  • the time stamps of the respective data version identifiers may be extracted from the plurality of data version identifiers.
  • the verification sub-module 2021 verifies the extracted multiple timestamps to determine a timestamp that meets the preset condition.
  • the determining sub-module 2023 determines the latest data version identifier based on the timestamp that meets the preset condition.
  • the time stamp 201702140800 in the data version identifier of the device D is closest to the current time, the time stamp may be determined to be the timestamp closest to the current time. Subsequently, the data version identification of device D is determined to be the latest data version identification.
  • the verification sub-module 2022 can check the extracted multiple timestamps to determine a timestamp that meets the preset condition from the extracted multiple timestamps.
  • the preset condition may be a condition such as a format set in advance for the time stamp.
  • the preset condition can limit the length of the timestamp to 12 digits. Because the server or multiple user devices may have errors during the update and management of the timestamp, or an error occurs during the data transmission between the server and the user device, the timestamp format extracted by the server is not Eligible, for example, the extracted timestamp is not 12 digits.
  • the determination sub-module 2023 determines the latest data version identifier according to the timestamp that meets the preset condition. For example, the timestamp closest to the current time is determined from the timestamps that meet the preset conditions, and then the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
  • the following steps are performed:
  • the data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
  • the second obtaining module 203 is configured to acquire the to-be-synchronized data from the source device corresponding to the latest data version identifier.
  • the synchronization module 204 is configured to update the to-be-synchronized data on the server.
  • the second obtaining module 203 can obtain the data to be synchronized from the source device corresponding to the latest data version identifier, and the synchronization module 204 will be on the server.
  • the data to be synchronized is updated.
  • the source device is a device corresponding to the latest data version identifier among the plurality of user equipments.
  • the data to be synchronized is all data on the source device.
  • the data to be synchronized is the type data that has changed on the source device.
  • the user account on the server can remain logged in.
  • the synchronization module 204 stores the data to be synchronized into the file directory under the current user account, and the data synchronization between the server and the source device can be completed.
  • the data synchronization apparatus 200 further includes: a third acquisition module 205, a modification module 206.
  • the third obtaining module 205 is configured to acquire a timestamp of the to-be-synchronized data on the server.
  • the modification module 206 is configured to modify a timestamp of the data to be synchronized on the server to a current time.
  • the third obtaining module 205 acquires the timestamp of the data to be synchronized on the server, and the modification module 206 can update the timestamp of the data to be synchronized on the server.
  • the device may send a data synchronization request to the server.
  • the modification module 206 modifies the timestamp in the data version identifier of the server itself to the current time.
  • the modification module 206 can also send a timestamp modification instruction to the device.
  • the device modifies the timestamp in the data version identifier of the data to the current time according to the instruction. At this point, the timestamp update in the data version ID of the server and source device is complete.
  • the data synchronization apparatus 200 further includes: a second determination module 207, a push module 208.
  • the second determining module 207 is configured to determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device.
  • the pushing module 208 is configured to push data update information to the target device.
  • data synchronization with the remaining devices can be further completed.
  • the second determining module 207 can determine the target device.
  • the target device is a device in which the data version identifier of the plurality of user devices is different from the data version identifier of the source device.
  • the device D is the source device, and the data version identifiers of the devices A, B, and C are different from the data version identifiers of the device D, and the target device includes the devices A and B. C.
  • the second determining module 207 can determine the target device by using a timestamp in the data version identifier. For example, if the device D is the source device and the time stamp in the data version identifier of the device A, B, and C is different from the time stamp in the data version identifier of the device D, the devices A, B, and C may be determined as the target device.
  • the pushing module 208 pushes the data update information to the target device.
  • the data update information is used to cause the target device to acquire the data to be synchronized from the server.
  • the target device acquires the data to be synchronized from the server to complete data synchronization on the target device. Further, after the target device completes data synchronization, the timestamp in the data version identifier may be updated, and the timestamp is modified to be a timestamp in the data version identifier of the server.
  • each of the above modules may be implemented as a separate entity, or may be implemented in any combination as one or several entities.
  • the first obtaining module 201 obtains the album version identifiers on the respective devices from the mobile phone, the tablet computer, and the personal computer. Subsequently, the first determining module 202 determines the latest version identifier from the obtained plurality of album version identifiers. For example, the album version of the mobile phone is identified as the latest version identifier, and the second obtaining module 203 obtains the photos to be synchronized from the mobile terminal, and then the synchronization module 204 stores the photos to be synchronized to the server. Further, after completing the synchronization on the server side, the server may separately send the photos to be synchronized to the tablet computer and the personal computer. Subsequently, the tablet and the personal computer store the received photos separately.
  • the first obtaining module 201 obtains the address book version identifiers on the respective devices from the mobile phone, the tablet computer, and the personal computer. Subsequently, the first determining module 202 determines the latest version identifier from the obtained plurality of address book version identifiers. For example, the address book version of the mobile phone is identified as the latest version identifier, and the second obtaining module 203 obtains the address book information to be synchronized from the mobile phone end, and then the synchronization module 204 stores the address book information to be synchronized to the server. Further, after completing the synchronization on the server side, the server may separately send the address book information to be synchronized to the tablet computer or the personal computer. Subsequently, the tablet computer and the personal computer respectively store the received address book information.
  • the data synchronization apparatus 200 obtains the data version identifier of the data to be synchronized of the plurality of user equipments in the current account when the first synchronization module 201 receives the data synchronization request; the first determining module 202: The latest data version identifier is determined from the obtained multiple data version identifiers; the second obtaining module 203 obtains the to-be-synchronized data from the source device corresponding to the latest data version identifier in the current account; the synchronization module 204 The data to be synchronized on the server is updated.
  • the solution When receiving the data synchronization request, the solution obtains the data version identifiers of the plurality of user equipments, and determines the latest data version identifier, and then obtains the data to be synchronized and updates the data from the source device corresponding to the latest data version identifier.
  • the data update in multiple user devices can be synchronized to the server in time, thereby improving the timeliness of server data synchronization.
  • the embodiment of the present application further relates to a server, which may be a server located on a network, or may be a computer device such as a personal PC.
  • a server which may be a server located on a network, or may be a computer device such as a personal PC.
  • the server 300 includes a memory 301 and a processor 302.
  • the memory 301 is connected to the processor 302.
  • the memory 301 has one or more computer readable storage media.
  • Memory 301 can be used to store applications and data.
  • the application stored in the memory 301 contains executable program code.
  • Applications can form various functional modules.
  • the processor 302 executes various functional applications and data processing by running an application stored in the memory 301.
  • the memory 301 can mainly include a storage program area and a storage data area.
  • the storage program area may store an operating system, an application required for at least one function, and the like, and the storage data area may store data created by the server 300 or exchanged with other electronic devices.
  • the processor 302 is a control center of the server 300, and connects various parts of the entire server 300 by various interfaces and lines, executes the server 300 by running or executing an application stored in the memory 301, and calling data stored in the memory 301.
  • the various functions and processing data are used to monitor the server 300 as a whole.
  • the processor 302 can include one or more processing cores.
  • the processor 302 in the server 300 can load the executable program code corresponding to the process of one or more applications into the memory 301 according to the following instructions, and is stored and stored by the processor 302.
  • the application in memory 301 thereby implementing various functions:
  • the data to be synchronized on the server is updated.
  • the data version identifier includes a timestamp
  • the processor 302 when determining the latest data version identifier from the obtained plurality of data version identifiers, the processor 302 is configured to perform the following steps: A check is made to determine a timestamp that meets the preset condition; the latest data version identifier is determined based on the timestamp that meets the preset condition.
  • the processor 302 is further configured to: obtain a timestamp of the data to be synchronized on the server; a timestamp of the data to be synchronized on the server Change to the current time.
  • the processor 302 is further configured to: determine a target device, where the target device identifies a data version different from the source device in the plurality of user devices. The identified device; pushes data update information to the target device.
  • the data version identifier includes a timestamp
  • the processor 302 when determining the latest data version identifier from the obtained plurality of data version identifiers, the processor 302 is configured to perform the following steps: extracting from the plurality of data version identifiers a timestamp of each data version identifier; determining a timestamp that is closest to the current time from the extracted plurality of timestamps; determining a data version identifier corresponding to the timestamp closest to the current time as the latest data version identifier .
  • the processor 302 when the data synchronization request is received, the data version identifiers of the plurality of user equipments are acquired, and the processor 302 is configured to: generate a data synchronization request every preset period; according to the data synchronization request Get the data version identifier of multiple user devices.
  • the server 300 further includes a communication unit 303.
  • the communication unit 303 is connected to the processor 302.
  • the communication unit 303 can communicate with the network device or other electronic devices through the network to complete the information transmission and reception between the server 300 and the network device or other electronic devices.
  • the communication unit 303 can communicate with other servers or electronic devices such as smart phones, tablets, and the like through a network.
  • the medium may include: a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.

Abstract

A data synchronization method and apparatus, a server, and a storage medium. The data synchronization method comprises: obtaining data version identifiers of data to be synchronized of multiple pieces of user equipment under a current account when a data synchronization request is received; determining the latest data version identifier from the multiple obtained data version identifiers; obtaining the data to be synchronized from a source device corresponding to the latest data version identifier under the current account; and updating the data to be synchronized on a server.

Description

数据同步方法、装置、服务器及存储介质Data synchronization method, device, server and storage medium
本申请要求于2017年05月27日提交中国专利局、申请号为201710392634.X、发明名称为“数据同步方法、装置、服务器及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on May 27, 2017, the Chinese Patent Office, Application No. 201710392634.X, entitled "Data Synchronization Method, Apparatus, Server, and Storage Medium", the entire contents of which are incorporated by reference. Combined in this application.
技术领域Technical field
本申请涉及通信技术领域,特别涉及一种数据同步方法、装置、服务器及存储介质。The present application relates to the field of communications technologies, and in particular, to a data synchronization method, apparatus, server, and storage medium.
背景技术Background technique
近年来,随着通信技术的发展以及数字设备硬件性能的快速更新,越来越多的用户拥有多台数字设备。例如,同一用户可以拥有一台办公PC、一台家庭娱乐PC以及一部智能手机,甚至还有一台平板电脑。In recent years, with the development of communication technology and the rapid update of digital device hardware performance, more and more users have multiple digital devices. For example, the same user can have an office PC, a home entertainment PC, a smartphone, and even a tablet.
另一方面,用户在多个不同设备上使用同一文件的需求日益增长。例如,用户需要在不同设备上实现对同一文件的编辑操作。为了提高多个用户设备之间对同一文件进行操作的安全性,将不同设备上对同一文件的操作同步到服务器上显得必要。On the other hand, there is a growing need for users to use the same file on multiple different devices. For example, users need to implement editing of the same file on different devices. In order to improve the security of operations on the same file between multiple user devices, it is necessary to synchronize the operations of the same file on different devices to the server.
发明内容Summary of the invention
本申请实施例提供一种数据同步方法、装置、服务器及存储介质,可以提高数据同步的及时性。The embodiment of the present application provides a data synchronization method, device, server, and storage medium, which can improve the timeliness of data synchronization.
第一方面,本申请实施例提供一种数据同步方法,包括:In a first aspect, an embodiment of the present application provides a data synchronization method, including:
当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,该多个用户设备为与该服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the to-be-synchronized data of the plurality of user equipments in the current account, where the plurality of user equipments are devices that establish a data synchronization mechanism with the server;
从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
从当前账户下与该最新的数据版本标识对应的源设备获取该待同步数据;Obtaining the to-be-synchronized data from the source device corresponding to the latest data version identifier in the current account;
将该服务器上的该待同步数据进行更新。The data to be synchronized on the server is updated.
第二方面,本申请实施例还提供一种数据同步装置,包括:In a second aspect, the embodiment of the present application further provides a data synchronization apparatus, including:
第一获取模块,用于当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,该多个用户设备为与该服务器建立数据同步机制的设备;a first acquiring module, configured to acquire, when receiving a data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
第一确定模块,用于从获取到的多个数据版本标识中确定出最新的数据版本标识;a first determining module, configured to determine a latest data version identifier from the obtained multiple data version identifiers;
第二获取模块,用于从当前账户下与该最新的数据版本标识对应的源设备获取该待同步数据;a second acquiring module, configured to acquire the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
同步模块,用于将该服务器上的该待同步数据进行更新。a synchronization module, configured to update the to-be-synchronized data on the server.
第三方面,本申请实施例还提供一种服务器,包括存储有可执行程序代码的存储器以及与所述存储器耦合的处理器,其中,所述处理器调用所述可执行程序代码实现以下步骤:In a third aspect, the embodiment of the present application further provides a server, including a memory storing executable program code and a processor coupled to the memory, wherein the processor invokes the executable program code to implement the following steps:
当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;Obtaining the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
将所述服务器上的所述待同步数据进行更新。The to-be-synchronized data on the server is updated.
第四方面,本申请实施例还提供一种存储介质,该存储介质中存储有多条指令,该指令适于由处理器加载以执行上述数据同步方法。In a fourth aspect, the embodiment of the present application further provides a storage medium, where the storage medium stores a plurality of instructions, and the instruction is adapted to be loaded by a processor to execute the data synchronization method.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments will be briefly described below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to the drawings without any creative work.
图1是本申请实施例提供的数据同步方法的流程示意图。FIG. 1 is a schematic flowchart diagram of a data synchronization method provided by an embodiment of the present application.
图2是本申请实施例提供的数据同步方法的另一流程示意图。FIG. 2 is another schematic flowchart of a data synchronization method provided by an embodiment of the present application.
图3是本申请实施例提供的数据同步方法的又一流程示意图。FIG. 3 is still another schematic flowchart of a data synchronization method provided by an embodiment of the present application.
图4是本申请实施例提供的数据同步方法的应用场景示意图。FIG. 4 is a schematic diagram of an application scenario of a data synchronization method according to an embodiment of the present application.
图5是本申请实施例提供的数据同步方法的另一应用场景示意图。FIG. 5 is a schematic diagram of another application scenario of the data synchronization method provided by the embodiment of the present application.
图6是本申请实施例提供的数据同步方法的又一应用场景示意图。FIG. 6 is a schematic diagram of still another application scenario of the data synchronization method provided by the embodiment of the present application.
图7是本申请实施例提供的数据同步装置的结构示意图。FIG. 7 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application.
图8是本申请实施例提供的数据同步装置的另一结构示意图。FIG. 8 is another schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application.
图9是本申请实施例提供的数据同步装置的又一结构示意图。FIG. 9 is still another schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application.
图10是本申请实施例提供的数据同步装置的再一结构示意图。FIG. 10 is a schematic diagram of still another structure of a data synchronization apparatus according to an embodiment of the present application.
图11是本申请实施例提供的服务器的结构示意图。FIG. 11 is a schematic structural diagram of a server provided by an embodiment of the present application.
图12是本申请实施例提供的服务器的另一结构示意图。FIG. 12 is another schematic structural diagram of a server provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described in the following with reference to the accompanying drawings in the embodiments. It is apparent that the described embodiments are only a part of the embodiments of the present application, and not all of them. All other embodiments obtained by a person skilled in the art based on the embodiments of the present application without creative efforts are within the scope of the present application.
本申请的说明书和权利要求书以及上述附图中的术语“第一”、“第二”、“第三”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应当理解,这样描述的对象在适当情况下可以互换。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含。例如,包含了一系列步骤的过程、方法或包含了一系列模块或单元的装置、计算机设备、系统不必限于清楚地列出的那些步骤或模块或单元,还可以包括没有清楚地列出的步骤或模块或单元,也可以包括对于这些过程、方法、装置、计算机设备或系统固有的其它步骤或模块或单元。The terms "first", "second", "third", etc. (if present) in the specification and claims of the present application and the above figures are used to distinguish similar objects, and are not necessarily used to describe a particular order. Or prioritization. It should be understood that the objects so described are interchangeable where appropriate. Moreover, the terms "comprising" and "having" and "the" are intended For example, a process, method, or apparatus, computer device, system that comprises a series of modules or units, is not necessarily limited to those steps or modules or units that are clearly listed, and may include steps that are not explicitly listed Or modules or units may also include other steps or modules or units inherent to such processes, methods, apparatus, computer devices or systems.
本申请实施例提供一种数据同步方法,包括:An embodiment of the present application provides a data synchronization method, including:
当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;Obtaining the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
将所述服务器上的所述待同步数据进行更新。The to-be-synchronized data on the server is updated.
在一些实施例中,所述将所述服务器上的所述待同步数据进行更新的步骤后,所述数据同步方法还包括:In some embodiments, after the step of updating the data to be synchronized on the server, the data synchronization method further includes:
确定目标设备,所述目标设备为所述多个用户设备中数据版本标识不同于所述源设备的数据版本标识的设备;Determining, by the target device, a device whose data version identifier in the plurality of user devices is different from the data version identifier of the source device;
向所述目标设备推送数据更新信息。Pushing data update information to the target device.
在一些实施例中,所述数据版本标识包括时间戳,所述从获取到的多个数据版本标识中确定出最新的数据版本标识的步骤包括:In some embodiments, the data version identifier includes a timestamp, and the step of determining the latest data version identifier from the obtained plurality of data version identifiers includes:
对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;Checking the obtained multiple timestamps to determine a timestamp that meets the preset condition;
根据符合预设条件的时间戳确定最新数据版本标识。The latest data version identifier is determined based on the timestamp that meets the preset conditions.
在一些实施例中,所述将所述服务器上的所述待同步数据进行更新的步骤后,所述数据同步方法还包括:In some embodiments, after the step of updating the data to be synchronized on the server, the data synchronization method further includes:
获取所述服务器上的所述待同步数据的时间戳;Obtaining a timestamp of the to-be-synchronized data on the server;
将所述服务器上的所述待同步数据的时间戳修改为当前时间。The timestamp of the data to be synchronized on the server is modified to the current time.
在一些实施例中,所述数据版本标识包括时间戳,所述从获取到的多个数据版本标识 中确定出最新的数据版本标识的步骤包括:In some embodiments, the data version identifier includes a timestamp, and the step of determining the latest data version identifier from the obtained plurality of data version identifiers includes:
从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
在一些实施例中,所述当接收到数据同步请求时,获取多个用户设备的数据版本标识的步骤包括:In some embodiments, when the data synchronization request is received, the step of acquiring data version identifiers of the plurality of user equipments includes:
每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
根据所述数据同步请求获取多个用户设备的数据版本标识。Obtaining data version identifiers of the plurality of user equipments according to the data synchronization request.
一种数据同步方法,该方法可以应用于服务器中。如图1所示,该数据同步方法,可以包括以下步骤:A data synchronization method that can be applied to a server. As shown in FIG. 1, the data synchronization method may include the following steps:
S110,当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,该多个用户设备为与服务器建立数据同步机制的设备。S110. Acquire, when receiving the data synchronization request, a data version identifier of the to-be-synchronized data of the multiple user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server.
在一些实施例中,当服务器接收到数据同步请求时,从当前用户已经登录的账户下与该服务器建立数据同步机制的多个用户设备获取该多个用户设备的待同步数据的数据版本标识。该多个用户设备包括但不限于智能手机、平板电脑、个人PC等电子设备。In some embodiments, when the server receives the data synchronization request, the plurality of user devices that establish a data synchronization mechanism with the server under the account that the current user has logged in acquires the data version identifier of the data to be synchronized of the plurality of user devices. The plurality of user devices include, but are not limited to, electronic devices such as smart phones, tablet computers, and personal PCs.
其中,待同步数据可以包括相册、通讯录、通话记录、短信、浏览器记录、便签等数据中的一种或多种。The data to be synchronized may include one or more of an album, an address book, a call record, a short message, a browser record, a note, and the like.
其中,该数据同步请求用于完成服务器与当前用户的多个用户设备之间的数据同步。可以理解的,当前用户为当前在该服务器上登录的账户所属的用户。该数据同步请求可以是该多个用户设备中的某个设备发送给服务器的,也可以是该服务器自行发起的。例如,每当该多个用户设备中的某个设备上的数据发生更改时,该设备自动向服务器发送数据同步请求。再例如,每当时间到达预设定时时,服务器自行发起数据同步请求,并对该数据同步请求进行处理。The data synchronization request is used to complete data synchronization between the server and multiple user devices of the current user. It can be understood that the current user is the user to which the account currently logged in on the server belongs. The data synchronization request may be sent by one of the multiple user equipments to the server, or may be initiated by the server. For example, whenever data on one of the plurality of user devices changes, the device automatically sends a data synchronization request to the server. For another example, whenever the time reaches the preset timing, the server initiates a data synchronization request and processes the data synchronization request.
数据同步机制用于在该多个用户设备与服务器之间建立数据同步关系。即每当该多个用户设备中的某个设备上的数据发生更改时,也在服务器上进行对应的修改;或者每当服务器上的数据发生更改时,也在该多个用户设备上进行对应的修改。The data synchronization mechanism is used to establish a data synchronization relationship between the plurality of user equipments and the server. That is, whenever the data on one of the plurality of user devices changes, the corresponding modification is also performed on the server; or each time the data on the server is changed, the corresponding information is also performed on the multiple user devices. Modifications.
该多个用户设备中的每个设备以及服务器上都预先设置有数据版本标识。数据版本标识用于记录设备上的数据版本,以通过该数据版本标识对比该设备上的数据与服务器上的数据之间的差异。例如,数据版本标识可以包括数据的版本号。数据的版本号越高,表示数据最后更新的时间距离当前时间越短。其中,数据的版本号可以与该数据发生更改时的时刻相关联。同一个设备上的数据在不同时刻发生更改时,数据版本号是不同的。不同设备上的同一类数据在不同时刻发生更改时,数据版本号也是不同的。每当某个设备与服务器进行过数据同步后,即对该设备与服务器上的数据版本标识进行更新。A data version identifier is preset in each of the plurality of user devices and on the server. The data version identifier is used to record a version of the data on the device to compare the difference between the data on the device and the data on the server. For example, the data version identifier can include the version number of the data. The higher the version number of the data, the shorter the time the data was last updated from the current time. Wherein, the version number of the data can be associated with the time when the data was changed. The data version number is different when the data on the same device changes at different times. The data version number is different when the same type of data on different devices changes at different times. Whenever a device synchronizes data with the server, it updates the data version identifier on the device and the server.
其中,可以对每个设备上的所有数据设置一个统一的数据版本标识,也即一个设备只有一个数据版本标识。也可以对每个设备上不同类型的数据分别设置数据版本标识。例如,对通讯数据设置一个数据版本标识,对相册数据设置一个数据版本标识,对其他数据设置一个数据版本标识。此时,每当在服务器上进行数据同步时,只对发生更改的类型数据进行同步。Among them, a unified data version identifier can be set for all data on each device, that is, one device has only one data version identifier. It is also possible to set the data version identifier separately for different types of data on each device. For example, a data version identifier is set for the communication data, a data version identifier is set for the album data, and a data version identifier is set for other data. At this point, whenever data synchronization occurs on the server, only the type data that has changed is synchronized.
参考图4,服务器与多个电子设备A、B、C、D之间组成数据同步系统。设备A、B、C、D都与服务器之间建立通讯。每个设备以及服务器上都设置有数据版本标识,该数据版本标识可以包括时间戳。该时间戳可以是某个设备最近一次与服务器进行数据同步的时间。Referring to FIG. 4, a server and a plurality of electronic devices A, B, C, and D form a data synchronization system. Devices A, B, C, and D all establish communication with the server. A data version identifier is set on each device and the server, and the data version identifier may include a time stamp. This timestamp can be the time when a device last synchronized data with the server.
需要注意的是,在上述数据同步系统中,用户可以对设备A、B、C、D中任一设备上的数据进行操作,但不能对服务器上的数据直接进行操作。该操作包括但不限于添加、删除、修改、访问文件等操作。It should be noted that in the above data synchronization system, the user can operate on data on any of the devices A, B, C, and D, but cannot directly operate on the data on the server. This operation includes, but is not limited to, adding, deleting, modifying, accessing files, and the like.
在一些实施例中,用户可以通过个人PC(或者其他设备)登录到服务器中的个人账户,并对个人账户中的文件进行操作。该操作视为用户对个人PC(或者其他设备)的操作,而不是对服务器的操作,该个人PC(或者其他设备)理解为数据同步系统中的设备。In some embodiments, a user may log into a personal account in the server via a personal PC (or other device) and operate on files in the personal account. This operation is considered as a user's operation on a personal PC (or other device), and the personal PC (or other device) is understood as a device in the data synchronization system.
在一些实施例中,如图2所示,当接收到数据同步请求时,获取多个用户设备的数据版本标识可以包括以下步骤:In some embodiments, as shown in FIG. 2, when receiving the data synchronization request, acquiring the data version identifiers of the plurality of user equipments may include the following steps:
S111,每间隔预设周期时,生成数据同步请求;S111. Generate a data synchronization request every preset period.
S112,根据该数据同步请求获取多个用户设备的数据版本标识。S112. Acquire a data version identifier of multiple user equipments according to the data synchronization request.
在一些实施例中,可以在服务器上设置定时,每当时间到达该定时,服务器即自动触发数据同步操作。例如,用户可以设置服务器每天上午8时自动进行数据同步操作。则服务器在运行过程中,定时系统持续判断当前时间是否为该预设时间。若是预设时间,则服务器的定时系统自动生成数据同步请求。服务器的处理器接收该数据同步请求,并根据该数据同步请求获取上述多个用户设备的数据版本标识。In some embodiments, timing can be set on the server, and whenever the time reaches the timing, the server automatically triggers a data synchronization operation. For example, the user can set the server to automatically perform data synchronization operations at 8 am every day. Then, during the running of the server, the timing system continuously determines whether the current time is the preset time. If it is a preset time, the server's timing system automatically generates a data synchronization request. The processor of the server receives the data synchronization request, and acquires a data version identifier of the plurality of user equipments according to the data synchronization request.
需要说明的是,上述定时同步操作仅为举例。在一些实施例中,用户可以在服务器上设置一个预设周期。每间隔该预设周期时,服务器即自动生成数据同步请求,随后根据该数据同步请求获取上述多个用户设备的数据版本标识。例如,该预设周期可以为10分钟。则服务器每间隔10分钟即自动生成数据同步请求,并进行数据同步操作。It should be noted that the above timing synchronization operation is only an example. In some embodiments, the user can set a preset period on the server. The server automatically generates a data synchronization request every time the preset period is interrupted, and then acquires the data version identifiers of the plurality of user equipments according to the data synchronization request. For example, the preset period can be 10 minutes. Then, the server automatically generates a data synchronization request every 10 minutes, and performs data synchronization operation.
S120,从获取到的多个数据版本标识中确定出最新的数据版本标识。S120. Determine a latest data version identifier from the obtained multiple data version identifiers.
在一些实施例中,服务器获取到多个用户设备的数据版本标识后,从该多个数据版本标识中确定出最新的数据版本标识。该最新的数据版本标识表示在上述数据同步系统中,与该最新的数据版本标识对应的设备上的数据是最新的。In some embodiments, after the server obtains the data version identifiers of the plurality of user devices, the latest data version identifier is determined from the plurality of data version identifiers. The latest data version identifier indicates that in the above data synchronization system, the data on the device corresponding to the latest data version identifier is the latest.
例如,用户对设备A上的数据进行过操作,随后又对设备B上的数据进行过操作,最后对设备C上的数据进行过操作,此后未对设备A、B、C、D中的任一设备进行过操作,则设备C上的数据是最新的数据,设备C对应的数据版本标识为最新的数据版本标识。For example, the user has performed operations on the data on the device A, and then has performed operations on the data on the device B. Finally, the data on the device C has been operated. Thereafter, none of the devices A, B, C, and D are operated. When a device has been operated, the data on device C is the latest data, and the data version corresponding to device C is identified as the latest data version identifier.
在一些实施例中,如图2所示,数据版本标识可以包括时间戳,从获取到的多个数据版本标识中确定出最新的数据版本标识可以包括以下步骤:In some embodiments, as shown in FIG. 2, the data version identifier may include a timestamp, and determining the latest data version identifier from the obtained plurality of data version identifiers may include the following steps:
S121,从多个数据版本标识中提取各自的时间戳;S121. Extract respective timestamps from multiple data version identifiers.
S122,从提取到的多个时间戳中确定出距离当前时间最近的时间戳;S122. Determine, from the extracted multiple timestamps, a timestamp that is closest to the current time.
S123,将该距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。S123: Determine the data version identifier corresponding to the timestamp closest to the current time as the latest data version identifier.
其中,数据版本标识中可以包括时间戳,该时间戳可以是某个设备最近一次与服务器进行数据同步的时间。例如,设备A最近一次与服务器进行数据同步的时间为2017年2月10日上午8时,则设备A的数据版本标识中的时间戳可以是201702100800。The data version identifier may include a timestamp, where the timestamp may be the time when a device last synchronized data with the server. For example, the last time that device A synchronizes data with the server is 8:00 am on February 10, 2017, the time stamp in the data version identifier of device A may be 201702100800.
服务器获取到多个用户设备的数据版本标识后,从多个数据版本标识中提取各个数据版本标识的时间戳。随后,将提取到的时间戳所表示的时间与当前时间进行比较,从而确定出距离当前时间最近的时间戳,并将该时间戳对应的数据版本标识确定为最新的数据版本标识。After the server obtains the data version identifiers of the multiple user devices, the time stamp of each data version identifier is extracted from the multiple data version identifiers. Then, the time represented by the extracted timestamp is compared with the current time, so that the timestamp closest to the current time is determined, and the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
例如,设备D的数据版本标识中的时间戳201702140800所表示的时间距离当前时间最近,则可以确定出该时间戳为距离当前时间最近的时间戳。随后,将设备D的数据版本标识确定为最新的数据版本标识。For example, if the time represented by the time stamp 201702140800 in the data version identifier of the device D is closest to the current time, the time stamp may be determined to be the timestamp closest to the current time. Subsequently, the data version identification of device D is determined to be the latest data version identification.
在一些实施例中,服务器可以对提取到的多个时间戳进行校验,以从提取到的多个时间戳中确定出符合预设条件的时间戳。其中,预设条件可以是预先针对时间戳设置的格式等条件。In some embodiments, the server may check the extracted multiple timestamps to determine a timestamp that meets the preset condition from the extracted plurality of timestamps. The preset condition may be a condition such as a format set in advance for the time stamp.
例如,预设条件可以限定时间戳的长度为12位数。由于服务器或多个用户设备在对时间戳进行更新和管理的过程中可能会出现错误,又或者在服务器与用户设备之间的数据传 输过程中出现错误,会导致服务器提取到的时间戳格式不符合条件,例如,提取到的时间戳不是12位数。For example, the preset condition can limit the length of the timestamp to 12 digits. Because the server or multiple user devices may have errors during the update and management of the timestamp, or an error occurs during the data transmission between the server and the user device, the timestamp format extracted by the server is not Eligible, for example, the extracted timestamp is not 12 digits.
服务器对提取到的多个时间戳进行校验后,根据符合预设条件的时间戳来确定最新的数据版本标识。例如,从符合预设条件的时间戳中确定出与当前时间最近的时间戳,然后将该时间戳对应的数据版本标识确定为最新的数据版本标识。After verifying the extracted multiple timestamps, the server determines the latest data version identifier according to the timestamp that meets the preset condition. For example, the timestamp closest to the current time is determined from the timestamps that meet the preset conditions, and then the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
S130,从该最新的数据版本标识对应的源设备获取该待同步数据;S130. Acquire the to-be-synchronized data from the source device corresponding to the latest data version identifier.
S140,将该服务器上的该待同步数据进行更新。S140. Update the to-be-synchronized data on the server.
在一些实施例中,服务器确定出最新的数据版本标识后,即可从该最新的数据版本标识对应的源设备获取待同步数据,并将服务器上的该待同步数据进行更新。In some embodiments, after the server determines the latest data version identifier, the data to be synchronized can be obtained from the source device corresponding to the latest data version identifier, and the data to be synchronized on the server is updated.
其中,源设备为该多个用户设备中与该最新的数据版本标识对应的设备。当一个设备只有一个数据版本标识时,待同步数据为源设备上的所有数据。当一个设备上不同类型的数据具有不同的数据版本标识时,待同步数据为源设备上发生更改的类型数据。The source device is a device corresponding to the latest data version identifier among the plurality of user equipments. When a device has only one data version identifier, the data to be synchronized is all data on the source device. When different types of data on a device have different data version identifiers, the data to be synchronized is the type data that has changed on the source device.
其中,服务器上的用户账户可以保持登录状态。服务器获取到待同步数据后,将该待同步数据存储到当前用户账户下的文件目录,此时即可完成服务器与源设备之间的数据同步。Among them, the user account on the server can remain logged in. After the server obtains the data to be synchronized, the data to be synchronized is stored in the file directory under the current user account, and the data synchronization between the server and the source device can be completed.
在一些实施例中,如图3所示,将该待同步数据存储到服务器后,该数据同步方法还可以包括以下步骤:In some embodiments, as shown in FIG. 3, after the data to be synchronized is stored in the server, the data synchronization method may further include the following steps:
S150,获取该服务器上的该待同步数据的时间戳;S150. Obtain a timestamp of the to-be-synchronized data on the server.
S160,将该服务器上的该待同步数据的时间戳修改为当前时间。S160. Modify a timestamp of the data to be synchronized on the server to a current time.
在一些实施例中,服务器完成数据同步后,可以对服务器上的待同步数据的时间戳进行更新。In some embodiments, after the server completes the data synchronization, the timestamp of the data to be synchronized on the server may be updated.
其中,当多个用户设备中的某个设备上的数据发生更改时,该设备可以向服务器发送数据同步请求。服务器完成与该设备之间的数据同步后,将服务器自身的数据版本标识中的时间戳修改为当前时间。同时,服务器还可以向该设备发送时间戳修改指令。该设备接收到该时间戳修改指令后,根据该指令将自身数据版本标识中的时间戳修改为当前时间。此时,即可完成服务器和源设备的数据版本标识中的时间戳更新。Wherein, when data on one of the plurality of user devices changes, the device may send a data synchronization request to the server. After the server completes data synchronization with the device, the timestamp in the data version identifier of the server itself is changed to the current time. At the same time, the server can also send a timestamp modification instruction to the device. After receiving the timestamp modification instruction, the device modifies the timestamp in the data version identifier of the data to the current time according to the instruction. At this point, the timestamp update in the data version ID of the server and source device is complete.
在一些实施例中,如图3所示,将该待同步数据存储到服务器后,该数据同步方法还可以包括以下步骤:In some embodiments, as shown in FIG. 3, after the data to be synchronized is stored in the server, the data synchronization method may further include the following steps:
S170,确定目标设备,该目标设备为该多个用户设备中数据版本标识不同于该源设备的数据版本标识的设备;S170. Determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device.
S180,向目标设备推送数据更新信息。S180. Push data update information to the target device.
在一些实施例中,服务器完成与源设备之间的数据同步后,可以进一步完成与剩余设备之间的数据同步。In some embodiments, after the server completes data synchronization with the source device, data synchronization with the remaining devices can be further completed.
其中,服务器完成数据同步后,可以确定目标设备。目标设备即为该多个用户设备中数据版本标识不同于该源设备的数据版本标识的设备。例如,设备A、B、C、D中,设备D为源设备,设备A、B、C的数据版本标识都与设备D的数据版本标识不同,则可以确定出目标设备包括设备A、B、C。After the server completes the data synchronization, the target device can be determined. The target device is a device in which the data version identifier of the plurality of user devices is different from the data version identifier of the source device. For example, in the devices A, B, C, and D, the device D is the source device, and the data version identifiers of the devices A, B, and C are different from the data version identifiers of the device D, and the target device includes the devices A and B. C.
其中,服务器可以通过数据版本标识中的时间戳来确定目标设备。例如,设备D为源设备,设备A、B、C的数据版本标识中的时间戳都与设备D的数据版本标识中的时间戳不同,则可以将设备A、B、C确定为目标设备。The server can determine the target device by using the timestamp in the data version identifier. For example, if the device D is the source device and the time stamp in the data version identifier of the device A, B, and C is different from the time stamp in the data version identifier of the device D, the devices A, B, and C may be determined as the target device.
服务器确定目标设备后,向该目标设备推送数据更新信息。该数据更新信息用于使该目标设备从该服务器获取上述待同步数据。目标设备接收到服务器推送的数据更新信息后,从服务器获取待同步数据,以完成目标设备上的数据同步。进一步的,目标设备完成数据同步后,可以更新数据版本标识中的时间戳,将该时间戳修改为服务器的数据版本标识中 的时间戳。After the server determines the target device, it pushes data update information to the target device. The data update information is used to enable the target device to acquire the data to be synchronized from the server. After receiving the data update information pushed by the server, the target device acquires the data to be synchronized from the server to complete data synchronization on the target device. Further, after the target device completes the data synchronization, the timestamp in the data version identifier may be updated, and the timestamp is modified to be the timestamp in the data version identifier of the server.
参考图5,数据同步系统中的数据同步过程可以分为服务器数据同步与目标设备数据同步两个阶段。服务器数据同步阶段,服务器接收源设备发送的数据同步请求,或者接收服务器自身生成的数据同步请求,然后从源设备获取待同步数据,随后进行服务器上的数据更新。Referring to FIG. 5, the data synchronization process in the data synchronization system can be divided into two stages: server data synchronization and target device data synchronization. In the server data synchronization phase, the server receives the data synchronization request sent by the source device, or receives the data synchronization request generated by the server itself, and then acquires the data to be synchronized from the source device, and then performs data update on the server.
目标设备数据同步阶段,目标设备接收服务器推送的数据更新信息,然后目标设备从服务器获取待同步数据,随后进行目标设备上的数据更新。In the target device data synchronization phase, the target device receives the data update information pushed by the server, and then the target device acquires the data to be synchronized from the server, and then performs data update on the target device.
参考图6,服务器与目标设备都完成数据同步后,服务器、源设备、目标设备上的数据都保持一致,并且服务器、源设备、目标设备上的数据版本标识也都保持一致。其中,可以使服务器、源设备、目标设备上的数据版本标识中的时间戳都保持一致。Referring to FIG. 6, after the data synchronization is completed between the server and the target device, the data on the server, the source device, and the target device are consistent, and the data version identifiers on the server, the source device, and the target device are also consistent. The timestamps in the data version identifiers on the server, the source device, and the target device are consistent.
具体实施时,本申请不受所描述的各个步骤的执行顺序的限制,在不产生冲突的情况下,某些步骤还可以采用其它顺序进行或者同时进行。In the specific implementation, the present application is not limited by the execution order of the various steps described, and some steps may be performed in other orders or simultaneously without conflict.
例如,当服务器接收到用户手机端发送的相册同步请求时,则从手机、平板电脑、个人计算机分别获取各个设备上的相册版本标识。随后,从获取到的多个相册版本标识中确定出最新的版本标识。例如,手机端的相册版本标识为最新的版本标识,则从手机端获取待同步的照片,随后将待同步的照片存储到服务器。进一步的,服务器可以在完成服务器端的同步后,将该待同步的照片分别发送到平板电脑、个人计算机。随后,平板电脑、个人计算机分别将接收到的照片进行存储。For example, when the server receives the album synchronization request sent by the user's mobile phone, the album version identifiers on the respective devices are respectively obtained from the mobile phone, the tablet computer, and the personal computer. Subsequently, the latest version identifier is determined from the obtained plurality of album version identifiers. For example, if the album version of the mobile phone is identified as the latest version identifier, the photos to be synchronized are acquired from the mobile phone, and then the photos to be synchronized are stored to the server. Further, after completing the synchronization on the server side, the server may separately send the photos to be synchronized to the tablet computer and the personal computer. Subsequently, the tablet and the personal computer store the received photos separately.
再例如,当服务器接收到用户手机端发送的通讯录同步请求时,则从手机、平板电脑、个人计算机分别获取各个设备上的通讯录版本标识。随后,从获取到的多个通讯录版本标识中确定出最新的版本标识。例如,手机端的通讯录版本标识为最新的版本标识,则从手机端获取待同步的通讯录信息,随后将待同步的通讯录信息存储到服务器。进一步的,服务器可以在完成服务器端的同步后,将该待同步的通讯录信息分别发送到平板电脑、个人计算机。随后,平板电脑、个人计算机分别将接收到的通讯录信息进行存储。For another example, when the server receives the address book synchronization request sent by the user's mobile phone, the server obtains the address book version identifier on each device from the mobile phone, the tablet computer, and the personal computer. Subsequently, the latest version identifier is determined from the obtained plurality of address book version identifiers. For example, if the address book version of the mobile phone is identified as the latest version identifier, the address book information to be synchronized is obtained from the mobile terminal, and then the address book information to be synchronized is stored in the server. Further, after completing the synchronization on the server side, the server may separately send the address book information to be synchronized to the tablet computer or the personal computer. Subsequently, the tablet computer and the personal computer respectively store the received address book information.
由上可知,本申请实施例提供的数据同步方法,当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识;从获取到的多个数据版本标识中确定出最新的数据版本标识;从当前账户下与该最新的数据版本标识对应的源设备获取该待同步数据;将该服务器上的该待同步数据进行更新。该方案在接收到数据同步请求时,获取多个用户设备的数据版本标识,并确定出最新的数据版本标识,随后从该最新的数据版本标识对应的源设备获取待同步数据并进行数据更新,能够及时将多个用户设备中的数据更新同步到服务器中,从而能够提高服务器数据同步的及时性。As can be seen from the above, the data synchronization method provided by the embodiment of the present application, when receiving the data synchronization request, acquires the data version identifier of the data to be synchronized of the plurality of user equipments in the current account; and determines from the obtained multiple data version identifiers. The latest data version identifier is obtained; the source device corresponding to the latest data version identifier is obtained from the current account, and the to-be-synchronized data on the server is updated. When receiving the data synchronization request, the solution obtains the data version identifiers of the plurality of user equipments, and determines the latest data version identifier, and then obtains the data to be synchronized and updates the data from the source device corresponding to the latest data version identifier. The data update in multiple user devices can be synchronized to the server in time, thereby improving the timeliness of server data synchronization.
本申请实施例提供一种数据同步装置,包括:The embodiment of the present application provides a data synchronization apparatus, including:
第一获取模块,用于当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与所述服务器建立数据同步机制的设备;a first acquiring module, configured to acquire, when receiving a data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
第一确定模块,用于从获取到的多个数据版本标识中确定出最新的数据版本标识;a first determining module, configured to determine a latest data version identifier from the obtained multiple data version identifiers;
第二获取模块,用于从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;a second acquiring module, configured to acquire the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
同步模块,用于将所述服务器上的所述待同步数据进行更新。a synchronization module, configured to update the to-be-synchronized data on the server.
在一些实施例中,所述数据同步装置还包括:In some embodiments, the data synchronization device further includes:
第二确定模块,用于确定目标设备,所述目标设备为所述多个用户设备中数据版本标识不同于所述源设备的数据版本标识的设备;a second determining module, configured to determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device in the multiple user devices;
推送模块,用于向所述目标设备推送数据更新信息。a pushing module, configured to push data update information to the target device.
在一些实施例中,所述数据版本标识包括时间戳,所述第一确定模块包括:In some embodiments, the data version identifier includes a timestamp, and the first determining module includes:
校验子模块,用于对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;a verification submodule, configured to check the obtained multiple timestamps to determine a timestamp that meets a preset condition;
确定子模块,用于根据符合预设条件的时间戳确定最新数据版本标识。The determining submodule is configured to determine the latest data version identifier according to the timestamp that meets the preset condition.
在一些实施例中,所述数据同步装置还包括:In some embodiments, the data synchronization device further includes:
第三获取模块,用于获取所述服务器上的所述待同步数据的时间戳;a third obtaining module, configured to acquire a timestamp of the to-be-synchronized data on the server;
修改模块,用于将所述服务器上的所述待同步数据的时间戳修改为当前时间。And a modifying module, configured to modify a timestamp of the to-be-synchronized data on the server to a current time.
在一些实施例中,所述数据版本标识包括时间戳,所述第一确定模块用于:In some embodiments, the data version identifier includes a timestamp, and the first determining module is configured to:
从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
在一些实施例中,所述第一获取模块用于:In some embodiments, the first obtaining module is configured to:
每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
根据所述数据同步请求获取多个用户设备的数据版本标识。Obtaining data version identifiers of the plurality of user equipments according to the data synchronization request.
本申请实施例还提供一种数据同步装置,该装置可以应用于服务器中。如图7所示,数据同步装置200包括:第一获取模块201、第一确定模块202、第二获取模块203、同步模块204。The embodiment of the present application further provides a data synchronization device, which can be applied to a server. As shown in FIG. 7, the data synchronization apparatus 200 includes a first acquisition module 201, a first determination module 202, a second acquisition module 203, and a synchronization module 204.
该第一获取模块201,用于当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,该多个用户设备为与服务器建立数据同步机制的设备。The first obtaining module 201 is configured to acquire, when receiving the data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server.
在一些实施例中,当第一获取模块201接收到数据同步请求时,从当前用户已经登录的账户下与该服务器建立数据同步机制的多个用户设备获取该多个用户设备的待同步数据的数据版本标识。该多个用户设备包括但不限于智能手机、平板电脑、个人PC等电子设备。In some embodiments, when the first obtaining module 201 receives the data synchronization request, the plurality of user devices that establish a data synchronization mechanism with the server under the account that the current user has logged in acquire the data to be synchronized of the plurality of user devices. Data version identifier. The plurality of user devices include, but are not limited to, electronic devices such as smart phones, tablet computers, and personal PCs.
其中,待同步数据可以包括相册、通讯录、通话记录、短信、浏览器记录、便签等数据中的一种或多种。The data to be synchronized may include one or more of an album, an address book, a call record, a short message, a browser record, a note, and the like.
其中,该数据同步请求用于完成服务器与当前用户的多个用户设备之间的数据同步。可以理解的,当前用户为当前在该服务器上登录的账户所属的用户。该数据同步请求可以是该多个用户设备中的某个设备发送给服务器的,也可以是该服务器自行发起的。例如,每当该多个用户设备中的某个设备上的数据发生更改时,该设备自动向服务器发送数据同步请求。再例如,每当时间到达预设定时时,服务器自行发起数据同步请求,并对该数据同步请求进行处理。The data synchronization request is used to complete data synchronization between the server and multiple user devices of the current user. It can be understood that the current user is the user to which the account currently logged in on the server belongs. The data synchronization request may be sent by one of the multiple user equipments to the server, or may be initiated by the server. For example, whenever data on one of the plurality of user devices changes, the device automatically sends a data synchronization request to the server. For another example, whenever the time reaches the preset timing, the server initiates a data synchronization request and processes the data synchronization request.
数据同步机制用于在该多个用户设备与服务器之间建立数据同步关系。即每当该多个用户设备中的某个设备上的数据发生更改时,也在服务器上进行对应的修改;或者每当服务器上的数据发生更改时,也在该多个用户设备上进行对应的修改。The data synchronization mechanism is used to establish a data synchronization relationship between the plurality of user equipments and the server. That is, whenever the data on one of the plurality of user devices changes, the corresponding modification is also performed on the server; or each time the data on the server is changed, the corresponding information is also performed on the multiple user devices. Modifications.
该多个用户设备中的每个设备以及服务器上都预先设置有数据版本标识。数据版本标识用于记录设备上的数据版本,以通过该数据版本标识对比该设备上的数据与服务器上的数据之间的差异。例如,数据版本标识可以包括数据的版本号。数据的版本号越高,表示数据最后更新的时间距离当前时间越短。其中,数据的版本号可以与该数据发生更改时的时刻相关联。同一个设备上的数据在不同时刻发生更改时,数据版本号是不同的。不同设备上的同一类数据在不同时刻发生更改时,数据版本号也是不同的。每当某个设备与服务器进行过数据同步后,即对该设备与服务器上的数据版本标识进行更新。A data version identifier is preset in each of the plurality of user devices and on the server. The data version identifier is used to record a version of the data on the device to compare the difference between the data on the device and the data on the server. For example, the data version identifier can include the version number of the data. The higher the version number of the data, the shorter the time the data was last updated from the current time. Wherein, the version number of the data can be associated with the time when the data was changed. The data version number is different when the data on the same device changes at different times. The data version number is different when the same type of data on different devices changes at different times. Whenever a device synchronizes data with the server, it updates the data version identifier on the device and the server.
其中,可以对每个设备上的所有数据设置一个统一的数据版本标识,也即一个设备只有一个数据版本标识。也可以对每个设备上不同类型的数据分别设置数据版本标识。例如,对通讯数据设置一个数据版本标识,对相册数据设置一个数据版本标识,对其他数据设置一个数据版本标识。此时,每当在服务器上进行数据同步时,只对发生更改的类型数据进行同步。Among them, a unified data version identifier can be set for all data on each device, that is, one device has only one data version identifier. It is also possible to set the data version identifier separately for different types of data on each device. For example, a data version identifier is set for the communication data, a data version identifier is set for the album data, and a data version identifier is set for other data. At this point, whenever data synchronization occurs on the server, only the type data that has changed is synchronized.
在一些实施例中,用户可以通过个人PC(或者其他设备)登录到服务器中的个人账户,并对个人账户中的文件进行操作。该操作视为用户对个人PC(或者其他设备)的操作,而 不是对服务器的操作,该个人PC(或者其他设备)理解为数据同步系统中的设备。In some embodiments, a user may log into a personal account in the server via a personal PC (or other device) and operate on files in the personal account. This operation is considered as a user's operation on a personal PC (or other device), and is not an operation on the server, which is understood as a device in a data synchronization system.
在一些实施例中,第一获取模块201用于:In some embodiments, the first obtaining module 201 is configured to:
每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
根据该数据同步请求获取多个用户设备的数据版本标识。Acquiring data version identifiers of multiple user equipments according to the data synchronization request.
在一些实施例中,可以在服务器上设置定时,每当时间到达该定时,服务器即自动触发数据同步操作。例如,用户可以设置服务器每天上午8时自动进行数据同步操作。则服务器在运行过程中,第一获取模块201持续判断当前时间是否为该预设时间。若是预设时间,则第一获取模块201自动生成数据同步请求,并根据该数据同步请求获取上述多个用户设备的数据版本标识。In some embodiments, timing can be set on the server, and whenever the time reaches the timing, the server automatically triggers a data synchronization operation. For example, the user can set the server to automatically perform data synchronization operations at 8 am every day. When the server is running, the first obtaining module 201 continuously determines whether the current time is the preset time. If the time is preset, the first obtaining module 201 automatically generates a data synchronization request, and acquires the data version identifiers of the plurality of user equipments according to the data synchronization request.
需要说明的是,上述定时同步操作仅为举例。在一些实施例中,用户可以在服务器上设置一个预设周期。每间隔该预设周期时,第一获取模块201即自动生成数据同步请求,随后根据该数据同步请求获取上述多个用户设备的数据版本标识。例如,该预设周期可以为10分钟。则第一获取模块201每间隔10分钟即自动生成数据同步请求,并进行数据同步操作。It should be noted that the above timing synchronization operation is only an example. In some embodiments, the user can set a preset period on the server. The first obtaining module 201 automatically generates a data synchronization request, and then acquires the data version identifiers of the plurality of user equipments according to the data synchronization request. For example, the preset period can be 10 minutes. Then, the first obtaining module 201 automatically generates a data synchronization request every 10 minutes, and performs a data synchronization operation.
第一确定模块202,用于从获取到的多个数据版本标识中确定出最新的数据版本标识。The first determining module 202 is configured to determine the latest data version identifier from the obtained multiple data version identifiers.
在一些实施例中,第一获取模块201获取到多个用户设备的数据版本标识后,第一确定模块202从该多个数据版本标识中确定出最新的数据版本标识。该最新的数据版本标识表示在上述数据同步系统中,与该最新的数据版本标识对应的设备上的数据是最新的。In some embodiments, after the first obtaining module 201 acquires the data version identifiers of the plurality of user devices, the first determining module 202 determines the latest data version identifier from the plurality of data version identifiers. The latest data version identifier indicates that in the above data synchronization system, the data on the device corresponding to the latest data version identifier is the latest.
例如,数据同步系统由服务器、设备A、B、C、D组成,用户对设备A上的数据进行过操作,随后又对设备B上的数据进行过操作,最后对设备C上的数据进行过操作,此后未对设备A、B、C、D中的任一设备进行过操作,则设备C上的数据是最新的数据,设备C对应的数据版本标识为最新的数据版本标识。For example, the data synchronization system is composed of a server, devices A, B, C, and D. The user performs operations on the data on the device A, and then performs operations on the data on the device B, and finally performs data on the device C. After the operation, and the device A, B, C, and D are not operated, the data on the device C is the latest data, and the data version corresponding to the device C is the latest data version identifier.
在一些实施例中,如图8所示,数据版本标识可以包括时间戳,第一确定模块202包括:提取子模块2021、校验子模块2022、确定子模块2023。In some embodiments, as shown in FIG. 8 , the data version identifier may include a time stamp, and the first determining module 202 includes: an extraction submodule 2021 , a verification submodule 2022 , and a determination submodule 2023 .
该提取子模块2021,用于从多个数据版本标识中提取各自的时间戳;The extraction sub-module 2021 is configured to extract a respective timestamp from the plurality of data version identifiers;
该校验子模块2022,用于对提取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;The verification sub-module 2022 is configured to check the extracted multiple timestamps to determine a timestamp that meets a preset condition;
该确定子模块2023,用于根据符合预设条件的时间戳确定最新数据版本标识。The determining sub-module 2023 is configured to determine a latest data version identifier according to a timestamp that meets a preset condition.
其中,数据版本标识中可以包括时间戳,该时间戳可以是某个设备最近一次与服务器进行数据同步的时间。例如,设备A最近一次与服务器进行数据同步的时间为2017年2月10日上午8时,则设备A的数据版本标识中的时间戳可以是201702100800。The data version identifier may include a timestamp, where the timestamp may be the time when a device last synchronized data with the server. For example, the last time that device A synchronizes data with the server is 8:00 am on February 10, 2017, the time stamp in the data version identifier of device A may be 201702100800.
第一获取模块201获取到多个用户设备的数据版本标识后,可以从多个数据版本标识中提取各个数据版本标识的时间戳。随后,校验子模块2021对提取到的多个时间戳进行校验,以确定出符合预设条件的时间戳。确定子模块2023根据符合预设条件的时间戳来确定最新的数据版本标识。After the first obtaining module 201 obtains the data version identifiers of the plurality of user devices, the time stamps of the respective data version identifiers may be extracted from the plurality of data version identifiers. Then, the verification sub-module 2021 verifies the extracted multiple timestamps to determine a timestamp that meets the preset condition. The determining sub-module 2023 determines the latest data version identifier based on the timestamp that meets the preset condition.
例如,设备D的数据版本标识中的时间戳201702140800所表示的时间距离当前时间最近,则可以确定出该时间戳为距离当前时间最近的时间戳。随后,将设备D的数据版本标识确定为最新的数据版本标识。For example, if the time represented by the time stamp 201702140800 in the data version identifier of the device D is closest to the current time, the time stamp may be determined to be the timestamp closest to the current time. Subsequently, the data version identification of device D is determined to be the latest data version identification.
校验子模块2022可以对提取到的多个时间戳进行校验,以从提取到的多个时间戳中确定出符合预设条件的时间戳。其中,预设条件可以是预先针对时间戳设置的格式等条件。The verification sub-module 2022 can check the extracted multiple timestamps to determine a timestamp that meets the preset condition from the extracted multiple timestamps. The preset condition may be a condition such as a format set in advance for the time stamp.
例如,预设条件可以限定时间戳的长度为12位数。由于服务器或多个用户设备在对时间戳进行更新和管理的过程中可能会出现错误,又或者在服务器与用户设备之间的数据传输过程中出现错误,会导致服务器提取到的时间戳格式不符合条件,例如,提取到的时间戳不是12位数。For example, the preset condition can limit the length of the timestamp to 12 digits. Because the server or multiple user devices may have errors during the update and management of the timestamp, or an error occurs during the data transmission between the server and the user device, the timestamp format extracted by the server is not Eligible, for example, the extracted timestamp is not 12 digits.
校验子模块2022对提取到的多个时间戳进行校验后,确定子模块2023根据符合预设条 件的时间戳来确定最新的数据版本标识。例如,从符合预设条件的时间戳中确定出与当前时间最近的时间戳,然后将该时间戳对应的数据版本标识确定为最新的数据版本标识。After the verification sub-module 2022 verifies the extracted multiple timestamps, the determination sub-module 2023 determines the latest data version identifier according to the timestamp that meets the preset condition. For example, the timestamp closest to the current time is determined from the timestamps that meet the preset conditions, and then the data version identifier corresponding to the timestamp is determined as the latest data version identifier.
在一些实施例中,第一确定模块202从获取到的多个数据版本标识中确定出最新的数据版本标识时,执行以下步骤:In some embodiments, when the first determining module 202 determines the latest data version identifier from the obtained multiple data version identifiers, the following steps are performed:
从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
第二获取模块203,用于从该最新的数据版本标识对应的源设备获取该待同步数据;The second obtaining module 203 is configured to acquire the to-be-synchronized data from the source device corresponding to the latest data version identifier.
同步模块204,用于将该服务器上的该待同步数据进行更新。The synchronization module 204 is configured to update the to-be-synchronized data on the server.
在一些实施例中,第一确定模块202确定出最新的数据版本标识后,第二获取模块203即可从该最新的数据版本标识对应的源设备获取待同步数据,同步模块204将服务器上的该待同步数据进行更新。In some embodiments, after the first determining module 202 determines the latest data version identifier, the second obtaining module 203 can obtain the data to be synchronized from the source device corresponding to the latest data version identifier, and the synchronization module 204 will be on the server. The data to be synchronized is updated.
其中,源设备为该多个用户设备中与该最新的数据版本标识对应的设备。当一个设备只有一个数据版本标识时,待同步数据为源设备上的所有数据。当一个设备上不同类型的数据具有不同的数据版本标识时,待同步数据为源设备上发生更改的类型数据。The source device is a device corresponding to the latest data version identifier among the plurality of user equipments. When a device has only one data version identifier, the data to be synchronized is all data on the source device. When different types of data on a device have different data version identifiers, the data to be synchronized is the type data that has changed on the source device.
其中,服务器上的用户账户可以保持登录状态。第二获取模块203获取到待同步数据后,同步模块204将该待同步数据存储到当前用户账户下的文件目录,此时即可完成服务器与源设备之间的数据同步。Among them, the user account on the server can remain logged in. After the second obtaining module 203 obtains the data to be synchronized, the synchronization module 204 stores the data to be synchronized into the file directory under the current user account, and the data synchronization between the server and the source device can be completed.
在一些实施例中,如图9所示,数据同步装置200还包括:第三获取模块205、修改模块206。In some embodiments, as shown in FIG. 9, the data synchronization apparatus 200 further includes: a third acquisition module 205, a modification module 206.
该第三获取模块205,用于获取该服务器上的该待同步数据的时间戳;The third obtaining module 205 is configured to acquire a timestamp of the to-be-synchronized data on the server.
该修改模块206,用于将该服务器上的该待同步数据的时间戳修改为当前时间。The modification module 206 is configured to modify a timestamp of the data to be synchronized on the server to a current time.
在一些实施例中,同步模块204完成数据同步后,第三获取模块205获取服务器上的该待同步数据的时间戳,修改模块206可以对服务器上的该待同步数据的时间戳进行更新。In some embodiments, after the synchronization module 204 completes the data synchronization, the third obtaining module 205 acquires the timestamp of the data to be synchronized on the server, and the modification module 206 can update the timestamp of the data to be synchronized on the server.
其中,当多个用户设备中的某个设备上的数据发生更改时,该设备可以向服务器发送数据同步请求。同步模块204完成与该设备之间的数据同步后,修改模块206将服务器自身的数据版本标识中的时间戳修改为当前时间。同时,修改模块206还可以向该设备发送时间戳修改指令。该设备接收到该时间戳修改指令后,根据该指令将自身数据版本标识中的时间戳修改为当前时间。此时,即可完成服务器和源设备的数据版本标识中的时间戳更新。Wherein, when data on one of the plurality of user devices changes, the device may send a data synchronization request to the server. After the synchronization module 204 completes the data synchronization with the device, the modification module 206 modifies the timestamp in the data version identifier of the server itself to the current time. At the same time, the modification module 206 can also send a timestamp modification instruction to the device. After receiving the timestamp modification instruction, the device modifies the timestamp in the data version identifier of the data to the current time according to the instruction. At this point, the timestamp update in the data version ID of the server and source device is complete.
在一些实施例中,如图10所示,数据同步装置200还包括:第二确定模块207、推送模块208。In some embodiments, as shown in FIG. 10, the data synchronization apparatus 200 further includes: a second determination module 207, a push module 208.
该第二确定模块207,用于确定目标设备,该目标设备为该多个用户设备中数据版本标识不同于该源设备的数据版本标识的设备;The second determining module 207 is configured to determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device.
该推送模块208,用于向目标设备推送数据更新信息。The pushing module 208 is configured to push data update information to the target device.
在一些实施例中,服务器完成与源设备之间的数据同步后,可以进一步完成与剩余设备之间的数据同步。In some embodiments, after the server completes data synchronization with the source device, data synchronization with the remaining devices can be further completed.
其中,同步模块204完成数据同步后,第二确定模块207可以确定目标设备。目标设备即为该多个用户设备中数据版本标识不同于该源设备的数据版本标识的设备。例如,设备A、B、C、D中,设备D为源设备,设备A、B、C的数据版本标识都与设备D的数据版本标识不同,则可以确定出目标设备包括设备A、B、C。After the synchronization module 204 completes the data synchronization, the second determining module 207 can determine the target device. The target device is a device in which the data version identifier of the plurality of user devices is different from the data version identifier of the source device. For example, in the devices A, B, C, and D, the device D is the source device, and the data version identifiers of the devices A, B, and C are different from the data version identifiers of the device D, and the target device includes the devices A and B. C.
其中,第二确定模块207可以通过数据版本标识中的时间戳来确定目标设备。例如,设备D为源设备,设备A、B、C的数据版本标识中的时间戳都与设备D的数据版本标识中的时间戳不同,则可以将设备A、B、C确定为目标设备。The second determining module 207 can determine the target device by using a timestamp in the data version identifier. For example, if the device D is the source device and the time stamp in the data version identifier of the device A, B, and C is different from the time stamp in the data version identifier of the device D, the devices A, B, and C may be determined as the target device.
第二确定模块207确定目标设备后,推送模块208向该目标设备推送数据更新信息。该 数据更新信息用于使该目标设备从该服务器获取上述待同步数据。目标设备接收到服务器推送的数据更新信息后,从服务器获取待同步数据,以完成目标设备上的数据同步。进一步的,目标设备完成数据同步后,可以更新数据版本标识中的时间戳,将该时间戳修改为服务器的数据版本标识中的时间戳。After the second determining module 207 determines the target device, the pushing module 208 pushes the data update information to the target device. The data update information is used to cause the target device to acquire the data to be synchronized from the server. After receiving the data update information pushed by the server, the target device acquires the data to be synchronized from the server to complete data synchronization on the target device. Further, after the target device completes data synchronization, the timestamp in the data version identifier may be updated, and the timestamp is modified to be a timestamp in the data version identifier of the server.
具体实施时,以上各个模块可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现。In the specific implementation, each of the above modules may be implemented as a separate entity, or may be implemented in any combination as one or several entities.
例如,当服务器接收到用户手机端发送的相册同步请求时,第一获取模块201从手机、平板电脑、个人计算机分别获取各个设备上的相册版本标识。随后,第一确定模块202从获取到的多个相册版本标识中确定出最新的版本标识。例如,手机端的相册版本标识为最新的版本标识,则第二获取模块203从手机端获取待同步的照片,随后同步模块204将待同步的照片存储到服务器。进一步的,服务器可以在完成服务器端的同步后,将该待同步的照片分别发送到平板电脑、个人计算机。随后,平板电脑、个人计算机分别将接收到的照片进行存储。For example, when the server receives the album synchronization request sent by the user's mobile phone, the first obtaining module 201 obtains the album version identifiers on the respective devices from the mobile phone, the tablet computer, and the personal computer. Subsequently, the first determining module 202 determines the latest version identifier from the obtained plurality of album version identifiers. For example, the album version of the mobile phone is identified as the latest version identifier, and the second obtaining module 203 obtains the photos to be synchronized from the mobile terminal, and then the synchronization module 204 stores the photos to be synchronized to the server. Further, after completing the synchronization on the server side, the server may separately send the photos to be synchronized to the tablet computer and the personal computer. Subsequently, the tablet and the personal computer store the received photos separately.
再例如,当服务器接收到用户手机端发送的通讯录同步请求时,第一获取模块201从手机、平板电脑、个人计算机分别获取各个设备上的通讯录版本标识。随后,第一确定模块202从获取到的多个通讯录版本标识中确定出最新的版本标识。例如,手机端的通讯录版本标识为最新的版本标识,则第二获取模块203从手机端获取待同步的通讯录信息,随后同步模块204将待同步的通讯录信息存储到服务器。进一步的,服务器可以在完成服务器端的同步后,将该待同步的通讯录信息分别发送到平板电脑、个人计算机。随后,平板电脑、个人计算机分别将接收到的通讯录信息进行存储。For example, when the server receives the address book synchronization request sent by the user's mobile phone, the first obtaining module 201 obtains the address book version identifiers on the respective devices from the mobile phone, the tablet computer, and the personal computer. Subsequently, the first determining module 202 determines the latest version identifier from the obtained plurality of address book version identifiers. For example, the address book version of the mobile phone is identified as the latest version identifier, and the second obtaining module 203 obtains the address book information to be synchronized from the mobile phone end, and then the synchronization module 204 stores the address book information to be synchronized to the server. Further, after completing the synchronization on the server side, the server may separately send the address book information to be synchronized to the tablet computer or the personal computer. Subsequently, the tablet computer and the personal computer respectively store the received address book information.
由上可知,本申请实施例提供的数据同步装置200,通过第一获取模块201当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识;第一确定模块202从获取到的多个数据版本标识中确定出最新的数据版本标识;第二获取模块203从当前账户下与该最新的数据版本标识对应的源设备获取该待同步数据;同步模块204将该服务器上的该待同步数据进行更新。该方案在接收到数据同步请求时,获取多个用户设备的数据版本标识,并确定出最新的数据版本标识,随后从该最新的数据版本标识对应的源设备获取待同步数据并进行数据更新,能够及时将多个用户设备中的数据更新同步到服务器中,从而能够提高服务器数据同步的及时性。As can be seen from the above, the data synchronization apparatus 200 provided by the embodiment of the present application obtains the data version identifier of the data to be synchronized of the plurality of user equipments in the current account when the first synchronization module 201 receives the data synchronization request; the first determining module 202: The latest data version identifier is determined from the obtained multiple data version identifiers; the second obtaining module 203 obtains the to-be-synchronized data from the source device corresponding to the latest data version identifier in the current account; the synchronization module 204 The data to be synchronized on the server is updated. When receiving the data synchronization request, the solution obtains the data version identifiers of the plurality of user equipments, and determines the latest data version identifier, and then obtains the data to be synchronized and updates the data from the source device corresponding to the latest data version identifier. The data update in multiple user devices can be synchronized to the server in time, thereby improving the timeliness of server data synchronization.
本申请实施例还涉及一种服务器,该服务器可以是位于网络上的服务器,也可以是个人PC等计算机设备。The embodiment of the present application further relates to a server, which may be a server located on a network, or may be a computer device such as a personal PC.
如图11所示,服务器300包括存储器301和处理器302。存储器301与处理器302连接。As shown in FIG. 11, the server 300 includes a memory 301 and a processor 302. The memory 301 is connected to the processor 302.
其中,存储器301具有一个或一个以上的计算机可读存储介质。存储器301可用于存储应用程序和数据。存储器301存储的应用程序中包含有可执行程序代码。应用程序可以组成各种功能模块。处理器302通过运行存储在存储器301的应用程序,从而执行各种功能应用以及数据处理。存储器301可主要包括存储程序区和存储数据区。其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等,存储数据区可存储服务器300创建的或者与其他电子设备交换的数据。Therein, the memory 301 has one or more computer readable storage media. Memory 301 can be used to store applications and data. The application stored in the memory 301 contains executable program code. Applications can form various functional modules. The processor 302 executes various functional applications and data processing by running an application stored in the memory 301. The memory 301 can mainly include a storage program area and a storage data area. The storage program area may store an operating system, an application required for at least one function, and the like, and the storage data area may store data created by the server 300 or exchanged with other electronic devices.
处理器302是服务器300的控制中心,利用各种接口和线路连接整个服务器300的各个部分,通过运行或执行存储在存储器301内的应用程序,以及调用存储在存储器301内的数据,执行服务器300的各种功能和处理数据,从而对服务器300进行整体监控。其中,处理器302可以包括一个或一个以上的处理核心。The processor 302 is a control center of the server 300, and connects various parts of the entire server 300 by various interfaces and lines, executes the server 300 by running or executing an application stored in the memory 301, and calling data stored in the memory 301. The various functions and processing data are used to monitor the server 300 as a whole. The processor 302 can include one or more processing cores.
在本实施例中,服务器300中的处理器302可以按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行程序代码加载到存储器301中,并由处理器302来运行存储在存储器301中的应用程序,从而实现各种功能:In this embodiment, the processor 302 in the server 300 can load the executable program code corresponding to the process of one or more applications into the memory 301 according to the following instructions, and is stored and stored by the processor 302. The application in memory 301, thereby implementing various functions:
当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,该多个用户设备为与服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the to-be-synchronized data of the plurality of user equipments in the current account, where the plurality of user equipments are devices that establish a data synchronization mechanism with the server;
从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
从当前账户下与该最新的数据版本标识对应的源设备获取该待同步数据;Obtaining the to-be-synchronized data from the source device corresponding to the latest data version identifier in the current account;
将该服务器上的该待同步数据进行更新。The data to be synchronized on the server is updated.
在一些实施例中,该数据版本标识包括时间戳,从获取到的多个数据版本标识中确定出最新的数据版本标识时,处理器302用于执行以下步骤:对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;根据符合预设条件的时间戳确定最新数据版本标识。In some embodiments, the data version identifier includes a timestamp, and when determining the latest data version identifier from the obtained plurality of data version identifiers, the processor 302 is configured to perform the following steps: A check is made to determine a timestamp that meets the preset condition; the latest data version identifier is determined based on the timestamp that meets the preset condition.
在一些实施例中,将待同步数据存储到服务器后,处理器302还用于执行以下步骤:获取该服务器上的该待同步数据的时间戳;将该服务器上的该待同步数据的时间戳修改为当前时间。In some embodiments, after storing the data to be synchronized to the server, the processor 302 is further configured to: obtain a timestamp of the data to be synchronized on the server; a timestamp of the data to be synchronized on the server Change to the current time.
在一些实施例中,将待同步数据存储到服务器后,处理器302还用于执行以下步骤:确定目标设备,该目标设备为该多个用户设备中数据版本标识不同于该源设备的数据版本标识的设备;向该目标设备推送数据更新信息。In some embodiments, after storing the data to be synchronized to the server, the processor 302 is further configured to: determine a target device, where the target device identifies a data version different from the source device in the plurality of user devices. The identified device; pushes data update information to the target device.
在一些实施例中,该数据版本标识包括时间戳,从获取到的多个数据版本标识中确定出最新的数据版本标识时,处理器302用于执行以下步骤:从多个数据版本标识中提取每个数据版本标识的时间戳;从提取到的多个时间戳中确定出距离当前时间最近的时间戳;将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。In some embodiments, the data version identifier includes a timestamp, and when determining the latest data version identifier from the obtained plurality of data version identifiers, the processor 302 is configured to perform the following steps: extracting from the plurality of data version identifiers a timestamp of each data version identifier; determining a timestamp that is closest to the current time from the extracted plurality of timestamps; determining a data version identifier corresponding to the timestamp closest to the current time as the latest data version identifier .
在一些实施例中,当接收到数据同步请求时,获取多个用户设备的数据版本标识,处理器302用于执行以下步骤:每间隔预设周期时,生成数据同步请求;根据该数据同步请求获取多个用户设备的数据版本标识。In some embodiments, when the data synchronization request is received, the data version identifiers of the plurality of user equipments are acquired, and the processor 302 is configured to: generate a data synchronization request every preset period; according to the data synchronization request Get the data version identifier of multiple user devices.
在一些实施例中,如图12所示,服务器300还包括通信单元303。通信单元303与处理器302连接。其中,通信单元303可以通过网络与网络设备或者其他电子设备通信,以完成服务器300与网络设备或者其他电子设备之间的信息收发。例如,通信单元303可以通过网络与其他服务器或者诸如智能手机、平板电脑等电子设备进行通信。In some embodiments, as shown in FIG. 12, the server 300 further includes a communication unit 303. The communication unit 303 is connected to the processor 302. The communication unit 303 can communicate with the network device or other electronic devices through the network to complete the information transmission and reception between the server 300 and the network device or other electronic devices. For example, the communication unit 303 can communicate with other servers or electronic devices such as smart phones, tablets, and the like through a network.
上述实施例中,对各个实施例的描述都各有侧重,某些实施例中没有详细描述的部分,可以参见前面对数据同步方法的详细描述,在此不再赘述。In the foregoing embodiments, the descriptions of the various embodiments are different, and the details are not described in detail in the specific embodiments. For details, refer to the foregoing detailed description of the data synchronization method, and details are not described herein.
本申请实施例还提供一种存储介质,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行上述任一实施例所述的数据同步方法。The embodiment of the present application further provides a storage medium, where the storage medium stores a plurality of instructions, and the instructions are adapted to be loaded by a processor to execute the data synchronization method described in any of the foregoing embodiments.
需要说明的是,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于计算机可读存储介质中,存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或光盘等。It should be noted that those skilled in the art can understand that all or part of the steps of the foregoing embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium and stored. The medium may include: a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.
以上对本申请实施例提供的数据同步方法、装置、服务器及存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The data synchronization method, the device, the server, and the storage medium provided by the embodiments of the present application are described in detail. The principles and implementation manners of the application are described in the specific examples. The description of the above embodiments is only used to help understand The method of the present application and its core idea. In the meantime, those skilled in the art will be able to change the specific embodiments and the scope of the application according to the idea of the present application. In the above, the content of the specification should not be construed as limiting the present application.

Claims (19)

  1. 一种数据同步方法,包括:A data synchronization method includes:
    当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
    从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
    从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;Obtaining the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
    将所述服务器上的所述待同步数据进行更新。The to-be-synchronized data on the server is updated.
  2. 根据权利要求1所述的数据同步方法,其中,所述将所述服务器上的所述待同步数据进行更新的步骤后,所述数据同步方法还包括:The data synchronization method according to claim 1, wherein after the step of updating the data to be synchronized on the server, the data synchronization method further comprises:
    确定目标设备,所述目标设备为所述多个用户设备中数据版本标识不同于所述源设备的数据版本标识的设备;Determining, by the target device, a device whose data version identifier in the plurality of user devices is different from the data version identifier of the source device;
    向所述目标设备推送数据更新信息。Pushing data update information to the target device.
  3. 根据权利要求1所述的数据同步方法,其中,所述数据版本标识包括时间戳,所述从获取到的多个数据版本标识中确定出最新的数据版本标识的步骤包括:The data synchronization method according to claim 1, wherein the data version identifier comprises a timestamp, and the step of determining the latest data version identifier from the obtained plurality of data version identifiers comprises:
    对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;Checking the obtained multiple timestamps to determine a timestamp that meets the preset condition;
    根据符合预设条件的时间戳确定最新数据版本标识。The latest data version identifier is determined based on the timestamp that meets the preset conditions.
  4. 根据权利要求3所述的数据同步方法,其中,所述将所述服务器上的所述待同步数据进行更新的步骤后,所述数据同步方法还包括:The data synchronization method according to claim 3, wherein after the step of updating the data to be synchronized on the server, the data synchronization method further comprises:
    获取所述服务器上的所述待同步数据的时间戳;Obtaining a timestamp of the to-be-synchronized data on the server;
    将所述服务器上的所述待同步数据的时间戳修改为当前时间。The timestamp of the data to be synchronized on the server is modified to the current time.
  5. 根据权利要求1所述的数据同步方法,其中,所述数据版本标识包括时间戳,所述从获取到的多个数据版本标识中确定出最新的数据版本标识的步骤包括:The data synchronization method according to claim 1, wherein the data version identifier comprises a timestamp, and the step of determining the latest data version identifier from the obtained plurality of data version identifiers comprises:
    从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
    从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
    将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
  6. 根据权利要求1所述的数据同步方法,其中,所述当接收到数据同步请求时,获取多个用户设备的数据版本标识的步骤包括:The data synchronization method according to claim 1, wherein the step of acquiring the data version identifiers of the plurality of user equipments when the data synchronization request is received comprises:
    每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
    根据所述数据同步请求获取多个用户设备的数据版本标识。Obtaining data version identifiers of the plurality of user equipments according to the data synchronization request.
  7. 一种数据同步装置,包括:A data synchronization device comprising:
    第一获取模块,用于当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与所述服务器建立数据同步机制的设备;a first acquiring module, configured to acquire, when receiving a data synchronization request, a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
    第一确定模块,用于从获取到的多个数据版本标识中确定出最新的数据版本标识;a first determining module, configured to determine a latest data version identifier from the obtained multiple data version identifiers;
    第二获取模块,用于从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;a second acquiring module, configured to acquire the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
    同步模块,用于将所述服务器上的所述待同步数据进行更新。a synchronization module, configured to update the to-be-synchronized data on the server.
  8. 根据权利要求7所述的数据同步装置,其中,所述数据同步装置还包括:The data synchronization device of claim 7, wherein the data synchronization device further comprises:
    第二确定模块,用于确定目标设备,所述目标设备为所述多个用户设备中数据版本标识不同于所述源设备的数据版本标识的设备;a second determining module, configured to determine a target device, where the target device is a device whose data version identifier is different from the data version identifier of the source device in the multiple user devices;
    推送模块,用于向所述目标设备推送数据更新信息。a pushing module, configured to push data update information to the target device.
  9. 根据权利要求7所述的数据同步装置,其中,所述数据版本标识包括时间戳,所述第一确定模块包括:The data synchronization device of claim 7, wherein the data version identifier comprises a time stamp, and the first determining module comprises:
    校验子模块,用于对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;a verification submodule, configured to check the obtained multiple timestamps to determine a timestamp that meets a preset condition;
    确定子模块,用于根据符合预设条件的时间戳确定最新数据版本标识。The determining submodule is configured to determine the latest data version identifier according to the timestamp that meets the preset condition.
  10. 根据权利要求9所述的数据同步装置,其中,所述数据同步装置还包括:The data synchronization device of claim 9, wherein the data synchronization device further comprises:
    第三获取模块,用于获取所述服务器上的所述待同步数据的时间戳;a third obtaining module, configured to acquire a timestamp of the to-be-synchronized data on the server;
    修改模块,用于将所述服务器上的所述待同步数据的时间戳修改为当前时间。And a modifying module, configured to modify a timestamp of the to-be-synchronized data on the server to a current time.
  11. 根据权利要求7所述的数据同步装置,其中,所述数据版本标识包括时间戳,所述第一确定模块用于:The data synchronization device according to claim 7, wherein the data version identifier includes a time stamp, and the first determining module is configured to:
    从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
    从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
    将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
  12. 根据权利要求7所述的数据同步装置,其中,所述第一获取模块用于:The data synchronization device of claim 7, wherein the first acquisition module is configured to:
    每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
    根据所述数据同步请求获取多个用户设备的数据版本标识。Obtaining data version identifiers of the plurality of user equipments according to the data synchronization request.
  13. 一种服务器,包括存储有可执行程序代码的存储器以及与所述存储器耦合的处理器,其中,所述处理器调用所述可执行程序代码实现以下步骤:A server comprising a memory storing executable program code and a processor coupled to the memory, wherein the processor calls the executable program code to implement the following steps:
    当接收到数据同步请求时,获取当前账户下多个用户设备的待同步数据的数据版本标识,所述多个用户设备为与服务器建立数据同步机制的设备;When receiving the data synchronization request, acquiring a data version identifier of the data to be synchronized of the plurality of user equipments in the current account, where the multiple user equipments are devices that establish a data synchronization mechanism with the server;
    从获取到的多个数据版本标识中确定出最新的数据版本标识;Determining the latest data version identifier from the obtained plurality of data version identifiers;
    从当前账户下与所述最新的数据版本标识对应的源设备获取所述待同步数据;Obtaining the to-be-synchronized data from a source device corresponding to the latest data version identifier in the current account;
    将所述服务器上的所述待同步数据进行更新。The to-be-synchronized data on the server is updated.
  14. 根据权利要求13所述的服务器,其中,将所述服务器上的所述待同步数据进行更新后,所述处理器调用所述可执行程序代码还实现以下步骤:The server according to claim 13, wherein after the data to be synchronized on the server is updated, the processor calls the executable program code to further implement the following steps:
    确定目标设备,所述目标设备为所述多个用户设备中数据版本标识不同于所述源设备的数据版本标识的设备;Determining, by the target device, a device whose data version identifier in the plurality of user devices is different from the data version identifier of the source device;
    向所述目标设备推送数据更新信息。Pushing data update information to the target device.
  15. 根据权利要求13所述的服务器,其中,所述数据版本标识包括时间戳,从获取到的多个数据版本标识中确定出最新的数据版本标识时,所述处理器调用所述可执行程序代码实现以下步骤:The server according to claim 13, wherein the data version identifier includes a time stamp, and the processor calls the executable program code when determining the latest data version identifier from the obtained plurality of data version identifiers Implement the following steps:
    对获取到的多个时间戳进行校验,以确定出符合预设条件的时间戳;Checking the obtained multiple timestamps to determine a timestamp that meets the preset condition;
    根据符合预设条件的时间戳确定最新数据版本标识。The latest data version identifier is determined based on the timestamp that meets the preset conditions.
  16. 根据权利要求15所述的服务器,其中,将所述服务器上的所述待同步数据进行更新后,所述处理器调用所述可执行程序代码还实现以下步骤:The server according to claim 15, wherein after the data to be synchronized on the server is updated, the processor calls the executable program code to further implement the following steps:
    获取所述服务器上的所述待同步数据的时间戳;Obtaining a timestamp of the to-be-synchronized data on the server;
    将所述服务器上的所述待同步数据的时间戳修改为当前时间。The timestamp of the data to be synchronized on the server is modified to the current time.
  17. 根据权利要求13所述的服务器,其中,所述数据版本标识包括时间戳,从获取到的多个数据版本标识中确定出最新的数据版本标识时,所述处理器调用所述可执行程序代码实现以下步骤:The server according to claim 13, wherein the data version identifier includes a time stamp, and the processor calls the executable program code when determining the latest data version identifier from the obtained plurality of data version identifiers Implement the following steps:
    从多个数据版本标识中提取每个数据版本标识的时间戳;Extracting the timestamp of each data version identifier from multiple data version identifiers;
    从提取到的多个时间戳中确定出距离当前时间最近的时间戳;Determining a timestamp closest to the current time from the extracted plurality of timestamps;
    将所述距离当前时间最近的时间戳对应的数据版本标识确定为最新的数据版本标识。The data version identifier corresponding to the timestamp closest to the current time is determined as the latest data version identifier.
  18. 根据权利要求13所述的服务器,其中,当接收到数据同步请求时,获取多个用户设备的数据版本标识时,所述处理器调用所述可执行程序代码实现以下步骤:The server according to claim 13, wherein when the data version identification of the plurality of user devices is acquired when the data synchronization request is received, the processor calls the executable program code to implement the following steps:
    每间隔预设周期时,生成数据同步请求;Generating a data synchronization request every preset period;
    根据所述数据同步请求获取多个用户设备的数据版本标识。Obtaining data version identifiers of the plurality of user equipments according to the data synchronization request.
  19. 一种存储介质,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行权利要求1至6中任一项所述的数据同步方法。A storage medium having stored therein a plurality of instructions adapted to be loaded by a processor to perform the data synchronization method of any one of claims 1 to 6.
PCT/CN2018/087867 2017-05-27 2018-05-22 Data synchronization method and apparatus, server, and storage medium WO2018219178A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710392634.X 2017-05-27
CN201710392634.XA CN107172169A (en) 2017-05-27 2017-05-27 Method of data synchronization, device, server and storage medium

Publications (1)

Publication Number Publication Date
WO2018219178A1 true WO2018219178A1 (en) 2018-12-06

Family

ID=59821056

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/087867 WO2018219178A1 (en) 2017-05-27 2018-05-22 Data synchronization method and apparatus, server, and storage medium

Country Status (2)

Country Link
CN (1) CN107172169A (en)
WO (1) WO2018219178A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008269A (en) * 2019-03-26 2019-07-12 阿里巴巴集团控股有限公司 A kind of data reflow method, device, equipment and system
CN110333997A (en) * 2019-07-15 2019-10-15 秒针信息技术有限公司 The method and device of fusion device use information
US20200089198A1 (en) * 2018-09-18 2020-03-19 Inductive Automation, LLC Client and gateway synchronization in industrial control systems
CN110909006A (en) * 2019-10-15 2020-03-24 中国平安人寿保险股份有限公司 Data synchronization method and device, computer equipment and storage medium
CN111245548A (en) * 2020-01-14 2020-06-05 平安国际智慧城市科技股份有限公司 Data synchronization method and device based on timestamp and computer equipment
CN113485973A (en) * 2021-07-02 2021-10-08 中国联合网络通信集团有限公司 Data synchronization method and device
CN113742426A (en) * 2021-09-08 2021-12-03 深圳市云鼠科技开发有限公司 Data synchronization method, device, equipment, server and storage medium
CN116016491A (en) * 2022-12-26 2023-04-25 山东华方智联科技股份有限公司 Intelligent building design system and design method

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107172169A (en) * 2017-05-27 2017-09-15 广东欧珀移动通信有限公司 Method of data synchronization, device, server and storage medium
CN107888656B (en) * 2017-10-09 2020-11-20 北京京东尚科信息技术有限公司 Calling method and calling device of server-side interface
CN108038127B (en) * 2017-11-08 2020-03-20 中国平安人寿保险股份有限公司 Data synchronization method, device, terminal equipment and storage medium
CN107819870A (en) * 2017-11-21 2018-03-20 广州视睿电子科技有限公司 Increment pulling data method, apparatus, storage medium, terminal device and server
CN108588666A (en) * 2018-05-31 2018-09-28 北京铂阳顶荣光伏科技有限公司 The parameter amending method and device of filming equipment
CN109766386A (en) * 2018-12-11 2019-05-17 畅捷通信息技术股份有限公司 A kind of method and system of synchronous service end off-line data
CN109933596A (en) * 2019-02-27 2019-06-25 深圳市轱辘汽车维修技术有限公司 A kind of method of data synchronization, device and terminal device
CN111726375A (en) * 2019-03-19 2020-09-29 北京数聚鑫云信息技术有限公司 Data synchronization method and device and computer equipment
CN110038299A (en) * 2019-04-17 2019-07-23 北京奇艺世纪科技有限公司 A kind of method of data synchronization and device
CN110113187B (en) * 2019-04-19 2022-03-04 北京奇艺世纪科技有限公司 Configuration updating method and device, configuration server and configuration system
CN110113412A (en) * 2019-04-30 2019-08-09 北京奇艺世纪科技有限公司 A kind of method of data synchronization and device
CN111953715B (en) * 2019-05-14 2023-05-26 天津五八到家科技有限公司 Service data processing system, method and device
CN110798444B (en) * 2019-09-12 2021-07-06 腾讯科技(深圳)有限公司 Data synchronization method and device based on Internet of things
CN111309747A (en) * 2020-02-18 2020-06-19 京东数字科技控股有限公司 Data synchronization method, system and device
CN111723062A (en) * 2020-06-28 2020-09-29 天津联想协同科技有限公司 File synchronization method, device and storage medium
CN112245906B (en) * 2020-11-18 2023-08-25 腾讯科技(深圳)有限公司 Data synchronization method, device, electronic equipment and storage medium
CN114615327A (en) * 2022-02-25 2022-06-10 上海金仕达软件科技有限公司 Method, device and system for optimizing market data and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030131045A1 (en) * 2002-01-09 2003-07-10 Mcgee Jason Robert Method and apparatus for synchronizing cookies across multiple client machines
CN102638581A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 Cookie information storage method and cookie information storage system
CN103220358A (en) * 2013-04-19 2013-07-24 李晶 Multi-terminal on-line file synchronizing method, system, server, and terminal device
CN103716370A (en) * 2013-10-13 2014-04-09 北界创想(北京)软件有限公司 Method and device for data synchronization between multiple clients
CN107172169A (en) * 2017-05-27 2017-09-15 广东欧珀移动通信有限公司 Method of data synchronization, device, server and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2769773C (en) * 2011-11-04 2018-01-09 Gemcom Software International Inc. System and method for data communication over a network
CN103327037B (en) * 2012-03-20 2017-09-29 中兴通讯股份有限公司 Method of data synchronization and device
US9235867B2 (en) * 2012-06-04 2016-01-12 Microsoft Technology Licensing, Llc Concurrent media delivery
CN105975614B (en) * 2016-05-18 2020-01-21 华为技术有限公司 Cluster configuration device, and method and device for updating data
CN106210006B (en) * 2016-06-30 2019-05-17 维沃移动通信有限公司 A kind of setting information sharing method, mobile terminal and Cloud Server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030131045A1 (en) * 2002-01-09 2003-07-10 Mcgee Jason Robert Method and apparatus for synchronizing cookies across multiple client machines
CN102638581A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 Cookie information storage method and cookie information storage system
CN103220358A (en) * 2013-04-19 2013-07-24 李晶 Multi-terminal on-line file synchronizing method, system, server, and terminal device
CN103716370A (en) * 2013-10-13 2014-04-09 北界创想(北京)软件有限公司 Method and device for data synchronization between multiple clients
CN107172169A (en) * 2017-05-27 2017-09-15 广东欧珀移动通信有限公司 Method of data synchronization, device, server and storage medium

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200089198A1 (en) * 2018-09-18 2020-03-19 Inductive Automation, LLC Client and gateway synchronization in industrial control systems
US10846063B2 (en) * 2018-09-18 2020-11-24 Inductive Automation, LLC Client and gateway synchronization in industrial control systems
US11055070B2 (en) 2018-09-18 2021-07-06 Inductive Automation, LLC Client and gateway synchronization in industrial control systems
CN110008269B (en) * 2019-03-26 2023-08-01 创新先进技术有限公司 Data reflow method, device, equipment and system
CN110008269A (en) * 2019-03-26 2019-07-12 阿里巴巴集团控股有限公司 A kind of data reflow method, device, equipment and system
CN110333997A (en) * 2019-07-15 2019-10-15 秒针信息技术有限公司 The method and device of fusion device use information
CN110333997B (en) * 2019-07-15 2023-11-10 秒针信息技术有限公司 Method and device for fusing equipment use information
CN110909006A (en) * 2019-10-15 2020-03-24 中国平安人寿保险股份有限公司 Data synchronization method and device, computer equipment and storage medium
CN111245548A (en) * 2020-01-14 2020-06-05 平安国际智慧城市科技股份有限公司 Data synchronization method and device based on timestamp and computer equipment
CN113485973B (en) * 2021-07-02 2023-05-16 中国联合网络通信集团有限公司 Data synchronization method and device
CN113485973A (en) * 2021-07-02 2021-10-08 中国联合网络通信集团有限公司 Data synchronization method and device
CN113742426A (en) * 2021-09-08 2021-12-03 深圳市云鼠科技开发有限公司 Data synchronization method, device, equipment, server and storage medium
CN116016491A (en) * 2022-12-26 2023-04-25 山东华方智联科技股份有限公司 Intelligent building design system and design method
CN116016491B (en) * 2022-12-26 2023-09-05 山东华方智联科技股份有限公司 Intelligent building design system and design method

Also Published As

Publication number Publication date
CN107172169A (en) 2017-09-15

Similar Documents

Publication Publication Date Title
WO2018219178A1 (en) Data synchronization method and apparatus, server, and storage medium
US10079882B2 (en) Method and system for synchronizing information to contacts on cloud platform
US11221995B2 (en) Data replication from a cloud-based storage resource
US10979501B2 (en) Synchronizing file data between computer systems
CN1988535B (en) Synchronous method, system for file storage and customer terminal
MX2014011988A (en) Telemetry system for a cloud synchronization system.
WO2015101320A1 (en) Account number generation method, terminal and background server
KR101389101B1 (en) Method and apparatus for tracking device management data changes
CN103916482A (en) Data synchronous transmission method based on sqlite
US20180367441A1 (en) Routing table synchronization method, apparatus, and system
WO2021051747A1 (en) Data update method, system and device, electronic device, and computer storage medium
US9930063B2 (en) Random identifier generation for offline database
US9628567B2 (en) Methods and systems for efficient discovery of devices in a peer-to-peer network
US20170187800A1 (en) File synchronization method, electronic device
CN113177093A (en) Data synchronization method and device, electronic equipment and storage medium
CN112347192A (en) Data synchronization method, device, platform and readable medium
CN110474972B (en) Method and device for synchronizing contact information
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
US9244668B1 (en) Systems and methods for synchronizing mobile computing platforms
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN115629909A (en) Service data processing method and device, electronic equipment and storage medium
KR20160026138A (en) Rapid sync method for cloud file system and cloud file system using the same
US11442892B2 (en) File and data migration to storage system
CN111159179A (en) Table partitioning method, related device and computer readable storage medium
TWI531910B (en) Data management method, computer program product and managing server

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18810117

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18810117

Country of ref document: EP

Kind code of ref document: A1