WO2018076864A1 - 一种数据同步方法、装置、存储介质及电子设备 - Google Patents

一种数据同步方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2018076864A1
WO2018076864A1 PCT/CN2017/095622 CN2017095622W WO2018076864A1 WO 2018076864 A1 WO2018076864 A1 WO 2018076864A1 CN 2017095622 W CN2017095622 W CN 2017095622W WO 2018076864 A1 WO2018076864 A1 WO 2018076864A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
synchronization
target data
cloud server
target
Prior art date
Application number
PCT/CN2017/095622
Other languages
English (en)
French (fr)
Inventor
何辉
Original Assignee
广东欧珀移动通信有限公司
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 广东欧珀移动通信有限公司 filed Critical 广东欧珀移动通信有限公司
Priority to EP17864780.6A priority Critical patent/EP3499786B1/en
Priority to US16/310,925 priority patent/US20190373057A1/en
Publication of WO2018076864A1 publication Critical patent/WO2018076864A1/zh
Priority to US16/577,378 priority patent/US20200021652A1/en

Links

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/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • 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/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload

Definitions

  • the present invention relates to the field of cloud backup technologies, and in particular, to a data synchronization method, device, storage medium, and electronic device.
  • Cloud backup is an emerging cloud computing service.
  • Cloud backup service providers bring together massive and heterogeneous storage devices in the network through virtualization, distributed processing and broadband networks to provide data storage backups. service. Users can centrally store and secure large numbers and scattered files or folders on the terminal through mobile Internet and broadband Internet access.
  • the cloud backup data synchronization is to synchronously back up the data in the terminal to the cloud server, so that the cloud server stores the same data as the terminal.
  • the short message in the terminal is synchronously backed up to the cloud server, so that the cloud server stores the same short message as the terminal.
  • the embodiment of the invention provides a data synchronization method, device, storage medium and electronic device, which can reduce the load of the cloud server.
  • an embodiment of the present invention provides a data synchronization method, including:
  • the target data in the data cache area is synchronized to the cloud server.
  • an embodiment of the present invention further provides a data synchronization apparatus, including:
  • a first determining unit configured to determine a data type corresponding to the target data to be synchronized
  • a first determining unit configured to determine whether the data type corresponding to the target data is a preset data type
  • an adding unit configured to add the target data to the data cache area when the first determining unit determines that the data type is a preset data type
  • the first synchronization unit is configured to synchronize the target data in the data cache area to the cloud server after the interval is preset.
  • an embodiment of the present invention 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 perform a data synchronization method provided by any one of the embodiments of the present invention.
  • an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory stores a plurality of instructions, and the processor loads an instruction in the memory to execute any one of the embodiments of the present invention.
  • the data synchronization method provided.
  • the embodiment of the invention provides a data synchronization method, device, storage medium and electronic device, which can reduce the load of the cloud server.
  • FIG. 1 is a flowchart of a data synchronization method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a scenario of a data synchronization system according to an embodiment of the present invention.
  • FIG. 3 is another flowchart of a data synchronization method according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a first structure of a data synchronization apparatus according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a second structure of a data synchronization apparatus according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a third structure of a data synchronization apparatus according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a fourth structure of a data synchronization apparatus according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a fifth structure of a data synchronization apparatus according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • the terminal when data in a terminal that needs to be synchronized changes, the corresponding data synchronization with the cloud server is required. For example, when the terminal has a new short message, it needs to synchronize the short message with the cloud server.
  • the embodiment of the invention provides a data synchronization method, including:
  • the target data in the data cache area is synchronized to the cloud server.
  • the data synchronization method further includes:
  • the data synchronization request carrying the target data is sent to the cloud server to synchronize the target data to the cloud server.
  • the data synchronization method further includes:
  • the determining whether the cause of the failure meets a preset condition includes:
  • the synchronizing the target data in the data cache area to the cloud server includes:
  • the target data in the data cache area is synchronized to the cloud server.
  • the adding the target data to the data cache area includes:
  • the synchronizing the target data in the data cache area to the cloud server includes: sending a synchronization command in the data storage area to the cloud server.
  • the data synchronization method further includes:
  • the target data in the data storage area is updated according to the changed target data.
  • updating the target data in the data storage area according to the changed target data includes:
  • the data synchronization method before determining the data type corresponding to the target data to be synchronized, the data synchronization method further includes:
  • the data is classified according to the frequency or the number of times the data changes, and the data type corresponding to the data is obtained.
  • the target data in the data cache area is synchronized to the cloud server, including:
  • the target data in the data buffer area is synchronized to the cloud server.
  • the embodiment of the present invention will be described from the perspective of a data synchronization device.
  • the data synchronization device may be integrated into a terminal or other electronic device that needs to perform data synchronization.
  • the terminal may be a mobile phone, a tablet computer, or the like.
  • the manner in which the data synchronization device is integrated in the terminal may be various, for example, it may be installed in the terminal in the form of a terminal application.
  • a data synchronization method is provided. As shown in FIG. 1, the data synchronization method has the following specific process:
  • the step of “determining the data type corresponding to the target data to be synchronized” may include:
  • the data synchronization instruction may be triggered by an event, for example, may be automatically triggered by a change in data. Specifically, when a certain data (such as a specified backup data) is detected, the data synchronization is triggered. The instruction, at this time, the data synchronization device can receive the data synchronization instruction. For example, when it is detected that the SMS message data of the specified backup changes (increases, deletes, or changes), a trigger data transmission synchronization command is issued.
  • the data synchronization instruction can be automatically triggered by the system, for example, the data synchronization instruction is automatically triggered every preset time.
  • the data synchronization instruction may also be triggered by triggering a trigger interface such as a preset trigger key or an input box in the terminal, for example, when the user clicks or swipes a synchronization icon on the synchronization interface, the data synchronization instruction is triggered to be generated.
  • the data synchronization device can receive the data synchronization instruction.
  • the data type can be classified by using multiple classification methods.
  • the data may be classified according to the frequency or the number of times of data change, and the data type corresponding to the data is obtained. That is, before the step 101, the method in this embodiment may further include:
  • the data is classified according to the frequency or the number of times the data changes, and the data type corresponding to the data is obtained.
  • the embodiment may classify data that needs to be backed up, that is, specify the backed up data for classification, such as classifying data such as short message data, address book data, call record data, and photo data of the specified backup.
  • the data can be classified into types of frequent changes, less changes, and general changes, that is, data types can include: frequent data changes, less data changes, Data changes are general types and so on.
  • the data type corresponding to the short message data is divided into a data-based frequent type
  • the data type corresponding to the address book data is divided into a data change type
  • the data type corresponding to the call record data is divided into a data change frequent type
  • the photo data is The corresponding data type is divided into data change general type.
  • the data may be classified according to the attributes of the data (such as size), or according to the importance degree of the data.
  • the data may be classified into very important data, important data, general data, and comparatively important data.
  • the data types can include: very important, important, generally important, more important, and so on.
  • the importance of the data may be obtained according to the type of the application to which the data belongs. For example, the data of the financial payment application is relatively important, and the data of the social application is generally important.
  • the target data to be synchronized may be data that needs to be synchronized, such as chat record data, call record data, photo data, and the like.
  • the target data can be changed data.
  • step 102 Determine whether the data type corresponding to the target data is a preset data type. If yes, go to step 103. If no, go to step 105.
  • the data types corresponding to the target data may be compared. If they are the same, it is determined that the data type is not preset. Otherwise, the determination is not the preset data type.
  • the preset data type may be set according to the actual needs of the user; for example, the data is classified according to the frequency or the number of times the data changes; considering that the data with a relatively high frequency of change will frequently synchronize data with the cloud server, in order to reduce Synchronizing the data with the cloud server, in this embodiment, the data may be first placed in the data buffer area, and data synchronization is performed in a period of time, that is, the preset data type may include: data change frequent type, or data Change general type and so on. At this time, if the data type corresponding to the target data is a frequent data change type, it is determined that the quantity type corresponding to the target data is a preset data type.
  • the present embodiment can perform data synchronization in a data area with a relatively low degree of importance.
  • the preset data type may include: a general importance type or a more important type.
  • the quantity type corresponding to the target data is determined to be a preset data type.
  • the data cache area can be created by the terminal prior to data synchronization, for example, a data cache area can be created prior to receiving a data synchronization instruction.
  • the method in this embodiment may further include: receiving a cache area creation request, and creating a corresponding data cache area according to the cache area creation request.
  • the cache area creation request divides a cache area or specifies a cache area.
  • the step of adding the target data to the data cache area may include: copying the target data, and adding the copied target data to the data cache area, and copying the target data to the data cache area.
  • the target data in the following embodiments may be copy data of the target data or be the target data itself.
  • the target data is copied to the data buffer area, but also the target data is divided into several data blocks, and the data blocks are pre-assembled into a synchronization that the server can recognize.
  • the instruction, in the data synchronization only needs to extract the synchronization instruction from the data buffer area and send it to the server, and does not need to perform data assembly, thereby improving the data synchronization rate. That is, the step "Add the target data to the data cache area", or the step "Add the copied target data to the data cache area" may include:
  • the synchronization command or synchronization request is added to the data storage area.
  • the cutting method can be various, for example, the target data can be cut into a plurality of data blocks of the same size and the like.
  • the data block is assembled to obtain a synchronization command recognizable by the cloud server, that is, the data block is assembled into a command or a data packet conforming to a communication protocol between the terminal and the server, and the communication protocol may be a TCP/IP protocol.
  • the step of "assembling the data block" may include:
  • the data blocks are assembled according to the communication protocol file.
  • the embodiment also encrypts the target synchronization data.
  • the target data may be encrypted first, and then the encrypted target data is cut, that is, the step “cuts the target data into
  • the plurality of data blocks may include: encrypting the target data, and cutting the encrypted target data into a plurality of data blocks.
  • the target data may be first cut, and then the data block is encrypted, that is, the step of “assembling the data block” may include: encrypting the data block, and assembling the encrypted data block.
  • the cutting and assembling may be performed first, and then the synchronization command is encrypted.
  • the step of adding the synchronization command to the data storage area may include: encrypting the synchronization command, and synchronizing the encryption. Commands are added to this data storage area.
  • the data encryption may use a key agreed with the cloud server.
  • a data synchronization request carrying the target data is sent to the cloud server to synchronize the target data to the cloud server.
  • the preset time period can be set according to actual needs, for example, 1 minute, 10 minutes, 5 minutes, 1 hour, and the like.
  • the starting time of the preset time period may be when the target data is completely added to the data cache area, or when all the synchronization instructions are securely added to the data cache area, in the actual application, the time start point may be determined by the data type as a preset. Any time after the data type.
  • the step of “synchronizing the target data in the data cache area to the cloud server after the interval preset period of time” may include:
  • the target data in the data buffer area is synchronized to the cloud server.
  • Adding the target data to the data storage area includes: when the data is cut into data blocks, and the data is assembled to obtain a synchronization command, the step of “synchronizing the target data in the data cache area to the cloud server” may include: buffering the data area The synchronization command is sent to the cloud server.
  • the data synchronization may be performed in real time with the cloud server, that is, the data synchronization request is directly sent to the cloud server for data synchronization; for example, when the data type of the target data is changed.
  • Type when the preset data type is frequent change type, at this time, data synchronization can be directly performed with the server without having to cache the target data locally.
  • the present embodiment may add the synchronization data to the data synchronization failure.
  • the method of this embodiment may further include:
  • the target data is added to the data cache area
  • the data synchronization request is a data synchronization request for performing data synchronization in a case where it is judged that the data type of the target data is not the preset data type; that is, the data synchronization request in step 105.
  • the data synchronization failure that is, the failure of the data synchronization request to be sent may be caused by various reasons.
  • the failure reason may include:
  • the network status is abnormal or unstable.
  • the method for determining the cause is: obtaining the parameter information of the network status, and detecting whether the network status is stable according to the parameter information, wherein the parameter information of the network status may include: network delay, packet loss rate, and jitter. (Quality Of Service, quality of service).
  • the load of the cloud server is too large.
  • the method for determining the cause is: the load of the cloud server can be obtained, and the load is determined to be greater than a preset threshold. If yes, the load of the cloud server is determined to be excessive.
  • the available resources of the terminal are too small; the method for determining the cause is: obtaining resource parameters such as the usage rate of the processor of the terminal and the occupancy rate of the storage space, and then determining whether the available resources of the terminal are too small according to the resource parameter.
  • the cause of the failure of the transmission failure of the data synchronization request is determined by the determining means of the above reason.
  • preset conditions there are a plurality of preset conditions in this embodiment, which can be set according to actual needs. For example, if the data synchronization fails due to network instability or server load, multiple synchronization retry attempts will occur, resulting in a large load on the server. Therefore, in order to reduce the load on the server, preset conditions can be set: the failure cause is the network. The status is abnormal or the load of the cloud server is too large. That is, the step of "determining whether the cause of the failure meets the preset condition" may include:
  • the reason for the failure is that the network status is abnormal or the load of the cloud server is excessive, it is determined that the failure reason satisfies the preset condition.
  • the step of synchronizing the target data in the data cache area to the cloud server in the case that the data synchronization request fails to be sent may include: when the network status is restored to normal or the load of the cloud server is less than a preset threshold, Synchronize the target data in the data cache area to the cloud server.
  • the failure reason and the preset condition may be used to determine whether the current data synchronization failure is a synchronous failure of the synchronous retransmission mechanism, and the synchronization data may be cached in the data cache area for the synchronization failure of the type, and then restarted. Synchronization; not only can reduce the number of synchronizations with the cloud server, reduce the load of the cloud server, but also ensure that other data that fails to synchronize can be synchronized to the server in time, improving the timeliness of data synchronization.
  • the data synchronization is performed after the preset time period is separated. If the target data changes during the preset time period, the target data in the data storage area is updated; that is, in the case that the data type is the preset data type, the step “add the target data to the data cache area” and The step of "synchronizing the target data in the data cache area to the cloud server" may further include:
  • the target data in the data storage area is updated according to the changed target data.
  • the step of "updating the target data in the data storage area according to the changed target data" may include:
  • the synchronization command in the data storage area is updated according to the new synchronization command. If the synchronization command in the data storage area can be deleted, then a new synchronization command is added to the data storage area to update the synchronization command update.
  • the embodiment of the present invention determines the data type corresponding to the target data to be synchronized, and then determines whether the data type corresponding to the target data is a preset data type, and if not, adds the target data to the data cache area. And synchronizing the target data in the data cache area to the cloud server after the interval preset period.
  • the solution can add the data to be synchronized of the specific data type to the data cache area, and synchronize the data of the specific data type with the cloud server after the preset time period, thereby reducing the data and the cloud server for the specific data type.
  • the number of data synchronizations and the reduction of access to the synchronization module can reduce the load on the cloud server and reduce the risk of interaction with frequent access to the synchronization module.
  • the embodiment of the present invention may also add synchronization data to the data cache area when the data synchronization fails due to unstable network state or large server load, and cache the data again when the network state is restored or the server load is decreased.
  • the data in the database is synchronized to the server, which avoids frequent data synchronization with the server when data synchronization fails, further reducing the load on the cloud server.
  • This embodiment is described in detail by taking the data synchronization device of the embodiment of the present invention integrated in the terminal as an example.
  • a data synchronization system includes: a server and a data synchronization device, wherein the data synchronization device can be specifically integrated in a terminal, and the terminal can be a mobile phone, a tablet, Laptops and other equipment.
  • the server and terminal can be connected by wired or wireless network.
  • a data synchronization method is as follows:
  • the terminal determines a data type corresponding to the target data to be synchronized.
  • the terminal receives the data synchronization instruction, and determines a data type corresponding to the target data according to the data synchronization instruction, where the data synchronization instruction indicates the target data that needs to be synchronized.
  • the data synchronization instruction may be triggered by a change in data, or may be triggered by a user, or the like.
  • the target data may be short message data, call record data, address book data, and the like.
  • the data type may be classified by using multiple classification methods.
  • the data may be classified according to the frequency or the number of times of the data change, and the data type corresponding to the data is obtained.
  • data types can include data types such as frequent data changes, less data changes, and general data changes.
  • the terminal determines whether the data type corresponding to the target data is a preset data type. If yes, step 303 is performed, and if no, step 305 is performed.
  • the preset data type may be set according to the actual needs of the user; for example, the data is classified according to the frequency or the number of times of the data change; in order to reduce the synchronization of the data with the cloud server, the preset data type may include: The data change frequently type, or the data change is general type, etc.; at this time, if the data type corresponding to the target data is a frequent data change type, the quantity type corresponding to the target data is determined to be a preset data type.
  • the terminal cuts the target data into multiple data blocks, assembles the data block, obtains a synchronization command recognizable by the cloud server, and adds the synchronization command to the data storage area.
  • the terminal can copy a target data and cut the copied target data into multiple data blocks.
  • the target data in the following embodiment may be the copy data of the target data or the target data itself.
  • the target data can be cut into a plurality of data blocks of the same size or different.
  • the data block may be assembled in advance and assembled into a synchronization command identifiable by the server.
  • a communication protocol file with the cloud server may be obtained, and the data block is performed according to the communication protocol file. Assembly.
  • the terminal After the interval preset period, the terminal sends a synchronization command in the data storage area to the server.
  • a synchronization command is sent to the cloud server to synchronize the target data to the cloud server.
  • the preset time period can be set according to actual needs, for example, 2 minutes, 8 minutes, half hours, 2 hours, and the like.
  • the time starting point of the preset time period may be any time after the data type is determined to be the preset data type.
  • the synchronization command is updated according to the changed target data. For example, copying a changed target data, and then updating the synchronization command in the data cache area according to the copied target data.
  • the changed target data (which may be the copied data of the changed target data) is cut into a plurality of new data blocks, and the new data block is assembled to obtain a new synchronization command recognizable by the cloud server, according to
  • This new synchronization command updates the synchronization commands within the data storage area. For example, you can replace the synchronization command in the data storage area with the new synchronization command.
  • the terminal sends a data synchronization request carrying the target data to the server.
  • data synchronization with the cloud server may be performed in real time to ensure the timeliness of data synchronization.
  • the server can store the target data according to the data synchronization request.
  • the terminal determines a failure reason for the data synchronization request to be sent.
  • the data synchronization failure may be caused by the failure of the data synchronization request to be sent.
  • the failure reason may include: the network status is abnormal or unstable, the load of the cloud server is too large, the available resources of the terminal are too small, the server times out, and the like. .
  • the terminal determines whether the cause of the failure is a network status abnormality or the server load is excessive. If yes, step 308 is performed, and if no, step 310 is performed.
  • the terminal cuts the target data into multiple data blocks, assembles the data block, obtains a synchronization command recognizable by the cloud server, and adds the synchronization command to the data storage area.
  • the current synchronization data is added to the data cache area, and then the data synchronization is performed again to reduce the access to the cloud.
  • the number of servers reducing the load on the server.
  • the terminal synchronizes the target data in the data cache area to the cloud server when the network status is restored to normal or the load of the cloud server is less than a preset threshold.
  • the terminal resends a data synchronization request to the server.
  • the embodiment of the present invention determines the data type corresponding to the target data to be synchronized, and then determines whether the data type corresponding to the target data is a preset data type, and if not, adds the target data to the data cache area. And synchronizing the target data in the data cache area to the cloud server after the interval preset period.
  • the solution can add the data to be synchronized of the specific data type to the data cache area, and synchronize the data of the specific data type with the cloud server after the preset time period, thereby reducing the data and the cloud server for the specific data type.
  • the number of data synchronizations and the reduction of access to the synchronization module can reduce the load on the cloud server and reduce the risk of interaction with frequent access to the synchronization module.
  • the embodiment of the present invention may also add synchronization data to the data cache area when the data synchronization fails due to unstable network state or large server load, and cache the data again when the network state is restored or the server load is decreased.
  • the data in the database is synchronized to the server, which avoids frequent data synchronization with the server when data synchronization fails, further reducing the load on the cloud server.
  • the embodiment of the invention provides a data synchronization device, including:
  • a first determining unit configured to determine a data type corresponding to the target data to be synchronized
  • a first determining unit configured to determine whether a data type corresponding to the target data is a preset data type
  • an adding unit configured to add the target data to the data cache area when the first determining unit determines that the data type is a preset data type
  • the first synchronization unit is configured to synchronize the target data in the data cache area to the cloud server after the interval is preset.
  • the data synchronization device further includes: a second synchronization unit;
  • the second synchronization unit is configured to: when the first determining unit determines that the data type is not a preset data type, send a data synchronization request that carries the target data to the cloud server to use the target Data is synced to the cloud server.
  • the data synchronization device further includes: a second determining unit, a second determining unit, and a third synchronization unit;
  • the second determining unit is configured to determine, when the data synchronization request fails to be sent, a reason for failure of the data synchronization request to be sent;
  • the second determining unit is configured to determine whether the failure reason satisfies a preset condition
  • the third synchronization unit is configured to: when the second determining unit determines that the reason for the failure meets the preset condition, add the target data to the data cache area, and synchronize the target data in the data cache area to the cloud server. .
  • the second determining unit is specifically configured to: when the reason for the failure is that the network status is abnormal or the load of the cloud server is excessive, determining that the failure reason satisfies a preset condition;
  • the third synchronization unit is specifically configured to synchronize the target data in the data cache area to the cloud server when the network status returns to normal or the load of the cloud server is less than a preset threshold.
  • the adding unit is specifically configured to:
  • the first synchronization unit is specifically configured to send a synchronization command in the data storage area to the cloud server.
  • the data synchronization device further includes: an update unit;
  • the updating unit is configured to: after the adding unit adds the target data to the data cache area, the first synchronization unit synchronizes the target data in the data cache area to the cloud server, before the preset During the time period, if it is detected that the target data changes, the target data in the data storage area is updated according to the changed target data.
  • the updating unit is configured to cut the changed target data into a plurality of new data blocks, and assemble the new data block to obtain a new synchronization command recognizable by the cloud server; Updating the synchronization command within the data storage area according to the new synchronization command.
  • the data synchronization device further includes: a classification unit;
  • the classifying unit is configured to classify the data according to the frequency or the number of times of the data change before the first determining unit determines the data type corresponding to the target data to be synchronized, and obtain the data type corresponding to the data.
  • the first synchronization unit is configured to start timing when the target data is added to the data storage area; when the duration of the timing reaches a preset duration, the target data in the data buffer area is synchronized to Cloud server.
  • a data synchronization device 40 is further provided. As shown in FIG. 4, the data synchronization device 40 includes a first determining unit 401, a first determining unit 402, and an adding unit. 403 and the first synchronization unit 404 are as follows:
  • a first determining unit 401 configured to determine a data type corresponding to the target data to be synchronized
  • the first determining unit 402 is configured to determine whether the data type corresponding to the target data is a preset data type.
  • the adding unit 403 is configured to add the target data to the data cache area when the first determining unit 402 determines that the data type is a preset data type;
  • the first synchronization unit 404 is configured to synchronize the target data in the data cache area to the cloud server after the interval is preset.
  • the data synchronization apparatus of this embodiment further includes: a second synchronization unit 405;
  • the second synchronization unit is configured to: when the first determining unit determines that the data type is not the preset data type, send a data synchronization request carrying the target data to the cloud server to synchronize the target data to the cloud server.
  • the database synchronization apparatus in this embodiment may further include: a second determining unit 406 and a second determining unit. 407 and a third synchronization unit 408;
  • the second determining unit 406 is configured to determine, when the data synchronization request fails to be sent, a reason for failure of the data synchronization request to be sent;
  • the second determining unit 407 is configured to determine whether the failure reason satisfies a preset condition
  • the third synchronization unit 408 is configured to add the target data to the data cache area when the second determination unit 407 determines that the cause of the failure meets the preset condition, and synchronize the target data in the data cache area to the cloud server.
  • the second determining unit 407 is specifically configured to: when the reason for the failure is that the network status is abnormal or the load of the cloud server is excessive, determining that the failure reason satisfies the preset condition;
  • the third synchronization unit 408 is specifically configured to synchronize the target data in the data cache area to the cloud server when the network status returns to normal or the load of the cloud server is less than a preset threshold.
  • the adding unit 403 in this embodiment may be specifically configured to:
  • the first synchronization unit is specifically configured to send a synchronization command in the data storage area to the cloud server.
  • the data synchronization apparatus of this embodiment may further include an updating unit 409;
  • the updating unit 409 is configured to: after the adding unit 403 adds the target data to the data cache area, the first synchronization unit 404 synchronizes the target data in the data cache area to the cloud server, within the preset time period. If it is detected that the target data changes, the target data in the data storage area is updated according to the changed target data.
  • the updating unit 409 may be configured to cut the changed target data into a plurality of new data blocks, and assemble the new data block to obtain a new synchronization command recognizable by the cloud server; Updating the synchronization command within the data storage area according to the new synchronization command.
  • the data synchronization apparatus may further include: a classification unit 410; the classification unit 410, configured to change according to data before the first determination unit 401 determines the data type corresponding to the target data to be synchronized. The frequency or the number of times classifies the data to obtain the data type corresponding to the data.
  • the first synchronization unit 404 can be configured to start timing when the target data is added to the data storage area; when the duration of the timing reaches a preset duration, the target data in the data buffer area is synchronized to Cloud server.
  • the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same or a plurality of entities.
  • the foregoing method embodiments and details are not described herein.
  • the data synchronization device can be integrated into the terminal, for example, integrated in a mobile phone, a notebook computer, a tablet computer, or the like.
  • the first determining unit 401 determines the data type corresponding to the target data to be synchronized, and then the first determining unit 402 determines whether the data type corresponding to the target data is the preset data type, and if not
  • the target data is added to the data cache area by the adding unit 403, and the target data in the data cache area is synchronized to the cloud server by the first synchronization unit 404 after the interval preset period.
  • the solution can add the data to be synchronized of the specific data type to the data cache area, and synchronize the data of the specific data type with the cloud server after the preset time period, thereby reducing the data and the cloud server for the specific data type.
  • the number of data synchronizations and the reduction of access to the synchronization module can reduce the load on the cloud server and reduce the risk of interaction with frequent access to the synchronization module.
  • the embodiment of the present invention may also add synchronization data to the data cache area when the data synchronization fails due to unstable network state or large server load, and cache the data again when the network state is restored or the server load is decreased.
  • the data in the database is synchronized to the server, which avoids frequent data synchronization with the server when data synchronization fails, further reducing the load on the cloud server.
  • An embodiment of the present invention further provides an electronic device including a processor and a memory, the memory storing a plurality of instructions, the processor loading an instruction in the memory for performing data synchronization provided by any one of the embodiments of the present invention. method.
  • FIG. 9 is a mobile diagram according to an embodiment of the present invention. Schematic diagram of the terminal structure.
  • the mobile terminal 500 can include radio frequency (RF, Radio) Circuit 501, memory 502 including one or more computer readable storage media, input unit 503, display unit 504, sensor 505, audio circuit 506, wireless fidelity (WiFi, Wireless)
  • the Fidelity module 507 includes a processor 508 having one or more processing cores, and a power supply 509 and the like. It will be understood by those skilled in the art that the mobile terminal structure shown in FIG. 9 does not constitute a limitation of the mobile terminal, and may include more or less components than those illustrated, or combine some components, or different component arrangements.
  • the radio frequency circuit 501 can be used for transmitting and receiving information, or receiving and transmitting signals during a call. Specifically, after receiving the downlink information of the base station, the radio network is processed by one or more processors 508; in addition, the data related to the uplink is sent to the base station. .
  • the radio frequency circuit 501 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM, Subscriber Identity Module) Card, Transceiver, Coupler, Low Noise Amplifier (LNA, Low Noise) Amplifier), duplexer, etc.
  • SIM Subscriber Identity Module
  • the radio frequency circuit 501 can also communicate with the network and other devices through wireless communication.
  • the wireless communication can use any communication standard or protocol, including but not limited to the global mobile communication system (GSM, Global System of Mobile communication), General Packet Radio Service (GPRS, General Packet Radio) Service), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA, Wideband Code) Division Multiple Access), Long Term Evolution (LTE), e-mail, short message service (SMS, Short) Messaging Service) and so on.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short message service
  • Memory 502 can be used to store applications and data.
  • the application stored in the memory 502 contains executable code. Applications can form various functional modules.
  • the processor 508 executes various functional applications and data processing by running an application stored in the memory 502.
  • the memory 502 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile terminal (such as audio data, phone book, etc.).
  • memory 502 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 502 may also include a memory controller to provide access to memory 502 by processor 508 and input unit 503.
  • the input unit 503 can be configured to receive input numbers, character information or user characteristic information (such as fingerprints), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • input unit 503 can include a touch-sensitive surface as well as other input devices.
  • Touch-sensitive surfaces also known as touch screens or trackpads, collect touch operations on or near the user (such as the user using a finger, stylus, etc., any suitable object or accessory on a touch-sensitive surface or touch-sensitive Operation near the surface), and drive the corresponding connecting device according to a preset program.
  • the touch sensitive surface may include two parts of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 508 is provided and can receive commands from the processor 508 and execute them.
  • touch-sensitive surfaces can be implemented in a variety of types, including resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 503 can also include other input devices.
  • other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control button, a switch button, etc.), a fingerprint recognition module, a trackball, a mouse, a joystick, and the like.
  • Display unit 504 can be used to display information entered by the user or information provided to the user as well as various graphical user interfaces of the mobile terminal, which can be composed of graphics, text, icons, video, and any combination thereof.
  • the display unit 504 can include a display panel.
  • the touch-sensitive surface can cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 508 to determine the type of the touch event, and then the processor 508 displays the type according to the type of the touch event. A corresponding visual output is provided on the panel.
  • the touch-sensitive surface and display panel are implemented as two separate components to implement input and input functions, in some embodiments, the touch-sensitive surface can be integrated with the display panel to implement input and output functions.
  • the mobile terminal may also include at least one type of sensor 505, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may close the display panel and/or when the mobile terminal moves to the ear.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • gesture of the mobile phone such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the gyroscope, barometer, hygrometer, thermometer, infrared sensor and other sensors that can be configured in the mobile terminal, Let me repeat.
  • the audio circuit 506 can provide an audio interface between the user and the mobile terminal through a speaker and a microphone.
  • the audio circuit 506 can convert the received audio data into an electrical signal, which is transmitted to a speaker, and converted into a sound signal output by the speaker.
  • the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 506 and converted into
  • the audio data is processed by the audio data output processor 508, transmitted via the RF circuit 501 to, for example, another mobile terminal, or the audio data is output to the memory 502 for further processing.
  • the audio circuit 506 may also include an earbud jack to provide communication between the peripheral earphone and the mobile terminal.
  • Wireless Fidelity is a short-range wireless transmission technology.
  • the mobile terminal can help users to send and receive e-mail, browse web pages and access streaming media through the wireless fidelity module 507, which provides users with wireless broadband Internet access.
  • FIG. 9 shows the wireless fidelity module 507, it can be understood that it does not belong to the essential configuration of the mobile terminal, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 508 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, executes the mobile terminal by running or executing an application stored in the memory 502, and calling data stored in the memory 502.
  • the processor 508 may include one or more processing cores; preferably, the processor 508 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 508.
  • the mobile terminal also includes a power source 509 (such as a battery) that supplies power to the various components.
  • the power source can be logically coupled to the processor 508 through the power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the power supply 509 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the mobile terminal may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the processor 508 in the mobile terminal loads the executable code corresponding to the process of one or more applications into the memory 502 according to the following instruction, and is stored and stored by the processor 508.
  • Determining a data type corresponding to the target data to be synchronized and then determining whether the data type corresponding to the target data is a preset data type, and if not, adding the target data to the data cache area, after the interval preset time period
  • the target data in the data cache area is synchronized to the cloud server.
  • the processor 508 is further configured to: when the data type corresponding to the target data is not the preset data type, send a data synchronization request carrying the target data to the cloud server to synchronize the target data To the cloud server.
  • the processor 508 is further configured to: when the data synchronization request fails to be sent, determine a reason for failure of the data synchronization request to be sent;
  • the processor 508 can cut the target data into a plurality of data blocks; assemble the data blocks to obtain a synchronization command recognizable by the cloud server; add the synchronization command to the A data storage area is provided, and a synchronization command in the data storage area is sent to the cloud server.
  • the processor 508 is further configured to: after adding the target data to the data cache area, before synchronizing the target data in the data cache area to the cloud server, in the pre- In the set time period, if it is detected that the target data changes, the target data in the data storage area is updated according to the changed target data.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Read only memory (ROM, Read Only Memory), Random Access Memory (RAM), disk or CD.
  • ROM Read only memory
  • RAM Random Access Memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明实施例公开了一种数据同步方法、装置、存储介质及电子设备;该数据同步方法采用确定待同步的目标数据对应的数据类型,然后,判断该目标数据对应的数据类型是否为预设数据类型,若否,则将该目标数据添加至数据缓存区域,在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。

Description

一种数据同步方法、装置、存储介质及电子设备
本申请要求于2016年10月25日提交中国专利局、申请号为201610942149.0、发明名称为“一种数据同步方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及云备份技术领域,具体涉及一种数据同步方法、装置、存储介质及电子设备。
背景技术
云备份是一种新兴的云计算业务,云备份服务提供商通过虚拟化、分布式处理和宽带网络等技术,将网络中海量、异构的存储设备集合起来协同工作,共同对外提供数据存储备份服务。用户可以通过移动互联网和宽带互联网接入,实现对终端上大量和分散的文件或文件夹的集中存储、安全保管。
其中,云备份数据同步是将终端中的数据同步备份至云端服务器,使得云端服务器存储有与终端相同的数据。比如,将终端中的短信消息同步备份至云端服务器中,以使得云端服务器存储有与终端相同的短信消息。
技术问题
本发明实施例提供一种数据同步方法、装置、存储介质以及电子设备,可以降低云端服务器的负载。
技术解决方案
第一方面,本发明实施例提供一种数据同步方法,包括:
确定待同步的目标数据对应的数据类型;
判断所述目标数据对应的数据类型是否为预设数据类型;
若是,则将所述目标数据添加至数据缓存区域;
在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
第二方面,本发明实施例还提供了一种数据同步装置,包括:
第一确定单元,用于确定待同步的目标数据对应的数据类型;
第一判断单元,用于判断所述目标数据对应的数据类型是否为预设数据类型
添加单元,用于在第一判断单元判断所述数据类型为预设数据类型时,将所述目标数据添加至数据缓存区域;
第一同步单元,用于在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
第三方面,本发明实施例提供了一种存储介质,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行本发明实施例任一提供的数据同步方法。
第四方面,本发明实施例提供了一种电子设备,包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述存储器中的指令用于执行本发明实施例任一提供的数据同步方法。
有益效果
本发明实施例提供一种数据同步方法、装置、存储介质以及电子设备,可以降低云端服务器的负载。
附图说明
图1是本发明实施例提供的数据同步方法的流程图。
图2是本发明实施例提供的数据同步系统的场景示意图。
图3是本发明实施例提供的数据同步方法的另一种流程图。
图4是本发明实施例提供的数据同步装置的第一种结构示意图。
图5是本发明实施例提供的数据同步装置的第二种结构示意图。
图6是本发明实施例提供的数据同步装置的第三种结构示意图。
图7是本发明实施例提供的数据同步装置的第四种结构示意图。
图8是本发明实施例提供的数据同步装置的第五种结构示意图。
图9是本发明实施例提供的电子设备的结构示意图。
本发明的最佳实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
目前云备份数据同步方式中,当终端中某个需要同步的数据发生变化,则需要与云端服务器进行相应的数据同步。例如,当终端有新短信消息时,需要与云端服务器进行短信消息同步。
然而,由于终端中某些需要同步的数据(如通话记录数据等数据)变化比较频繁,因此,需要频繁地与云端服务器进行数据同步,因此,导致云端服务器的负载比较高。
本发明实施例提供了一种数据同步方法,包括:
确定待同步的目标数据对应的数据类型;
判断所述目标数据对应的数据类型是否为预设数据类型;
若是,则将所述目标数据添加至数据缓存区域;
在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述数据同步方法还包括:
当所述目标数据对应的数据类型不为预设数据类型时,向所述云端服务器发送携带所述目标数据的数据同步请求,以将所述目标数据同步至云端服务器。
一实施例中,所述数据同步方法还包括:
当所述数据同步请求发送失败时,确定所述数据同步请求发送失败的失败原因;
判断所述失败原因是否满足预设条件;
若满足预设条件,则将所述目标数据添加至所述数据缓存区域;
将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述判断所述失败原因是否满足预设条件,包括:
当所述失败原因为网络状态异常或者云端服务器的负载过大时,则确定所述失败原因满足预设条件;
所述将所述数据缓存区域内的目标数据同步至云端服务器,包括:
在所述网络状态恢复正常或者所述云端服务器的负载小于预设阈值时,将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述将所述目标数据添加至所述数据缓存区域,包括:
将所述目标数据切割成多个数据块;
对所述数据块进行组装,得到所述云端服务器可识别的同步命令;
将所述同步命令添加至所述数据存储区域;
所述将所述数据缓存区域内的目标数据同步至云端服务器,包括:将所述数据存储区域内的同步命令发送给所述云端服务器。
一实施例中,在将所述目标数据添加至数据缓存区域之后,将所述数据缓存区域内的目标数据同步至云端服务器之前,所述数据同步方法还包括:
在所述预设时间段内,若检测到所述目标数据发生变化,则根据变化后的目标数据更新所述数据存储区域内的目标数据。
一实施例中,根据变化后的目标数据更新所述数据存储区域内的目标数据,包括:
将所述变化后的目标数据切割成多个新数据块,并对所述新数据块进行组装,得到所述云端服务器可识别的新同步命令;
根据所述新同步命令更新所述数据存储区域内的同步命令。
一实施例中,在确定待同步的目标数据对应的数据类型之前,所述数据同步方法还包括:
根据数据变化的频率或者次数对数据进行分类,得到所述数据对应的数据类型。
一实施例中,在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器,包括:
在将目标数据添加到数据存储区域时,开始计时;
当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
本发明实施例将从数据同步装置角度进行描述,该数据同步装置具体可以集成终端或者其他需要进行数据同步的电子设备中,该终端可以为手机、平板电脑等。
其中,该数据同步装置集成在终端中的方式可以有多种,比如,可以以终端应用的形式安装在终端中。
在一优选实施例中,提供了一种数据同步方法,如图1所示,该数据同步方法,具体流程如下:
101、确定待同步的目标数据对应的数据类型。
具体地,步骤“确定待同步的目标数据对应的数据类型”可以包括:
接收数据同步指令,该数据同步指令指示待同步的目标数据;
根据该数据同步指令确定该目标数据对应的数据类型。
其中,该数据同步指令可以当由某个事件触发,比如可以由数据发生变化自动触发,具体地,当检测到某个数据(如某个指定备份的数据)发生变化时,则触发发送数据同步指令,此时数据同步装置便可以对该数据同步指令进行接收。例如,当检测到指定备份的短信消息数据发生变化(增加、删除或者改变)时,则发出触发发送数据同步指令。该数据同步指令可以由系统自动触发,比如,每隔预设时长自动触发发送数据同步指令。
此外,该数据同步指令还可以通过触发终端中预设触发键或输入框等触发接口来进行触发,比如,当用户点击或划过同步界面上某个同步图标时,则触发生成该数据同步指令,此时数据同步装置便可以对该数据同步指令进行接收。
本实施例中数据类型可以采用多种分类方式对数据进行分类得到,在一实施例中,可以根据数据变化的频率或者次数来对数据进行分类,得到数据对应的数据类型。也即在步骤101之前,本实施例方法还可以包括:
根据数据变化的频率或者次数对数据进行分类,得到数据对应的数据类型。
在实际应用中,本实施例可以对需要备份的数据进行分类,即指定备份的数据进行分类,如对指定备份的短信数据、通讯录数据、通话记录数据以及照片数据等数据进行分类。
其中, 按照数据变化的频率或者次数进行分类的情况下,可以将数据分为变化频繁、变化较少、变化一般等类型的数据,也即数据类型可以包括:数据变化频繁型、数据变化较少型、数据变化一般型等等数据类型。
例如,将短信数据对应的数据类型划分为数据化频繁型,将通讯录数据对应的数据类型划分为数据变化较少型,将通话记录数据对应的数据类型划分为数据变化频繁型,将照片数据对应的数据类型划分为数据变化一般型。
另外,本实施例还可以根据数据的属性(如大小等),或者根据数据的重要程度对数据进行分类,比如,可以将数据分为非常重要数据、重要数据、一般数据、比较重要数据等数据,也即数据类型可以包括:非常重要型、重要型、一般重要型、比较重要型等等。其中,数据的重要程度可以根据数据所属的应用程序的类型来获取,比如,金融支付类的应用程序的数据重要程度比较高、社交类的应用的数据重要程度一般等等。
其中,待同步的目标数据可以为指定需要同步的数据,如聊天记录数据、通话记录数据、照片数据等。在数据变化触发数据同步时,该目标数据可以为变化后的数据。
102、判断该目标数据对应的数据类型是否为预设数据类型,若是,执行步骤103,若否,则执行步骤105。
具体地,可以将目标数据对应的数据类型进行对比,若相同,则判定未预设数据类型,否则,则判定不为预设数据类型。
其中,预设数据类型可以根据用户的实际需求设定;如,以根据数据变化的频率或者次数对数据分类为例;考虑到变化频率比较高的数据会频繁与云端服务器进行数据同步,为了减少与云端服务器进行该类数据的同步,本实施例可以先将该类数据放置在数据缓存区内,过段时间在进行数据同步,也即预设数据类型可以包括:数据变化频繁型、或者数据变化一般型等等。此时,若目标数据对应的数据类型为数据变化频繁型,则判断目标数据对应的数量类型为预设数据类型。
又比如,以根据数据的重要程度对数据分类为例,为了减少与云端服务器进行数据同步的此时,本实施例可以将重要程度比较低的数据区域内,过段时间在进行数据同步;也即该预设数据类型可以包括:一般重要型或者比较重要型,此时,若目标数据对应的数据类型为一般重要型则判断目标数据对应的数量类型为预设数据类型。
103、将该目标数据添加至数据缓存区域。
该数据缓存区域可以在数据同步之前由终端创建,如,可以在接收到数据同步指令之前创建数据缓存区域。具体地,在接收到数据同步指令或者确定数据类型之前,本实施例方法还可以包括:接收缓存区域创建请求,根据该缓存区域创建请求创建相应的数据缓存区域。具体地,该缓存区域创建请求划分一缓存区域,或者指定某个缓存区域。
具体地,步骤“将该目标数据添加至数据缓存区域”可以包括:对该目标数据进行复制,并将复制后的目标数据添加至数据缓存区域,将目标数据复制到数据缓存区域。以下实施例中目标数据可以为目标数据的复制数据或者为目标数据本身。
为了提高数据传输速度以及数据同步速率,本实施例中不仅仅是将目标数据复制到数据缓存区域,还可以对目标数据进行切分若干数据块,并预先将数据块组装成服务器可以识别的同步指令,这样在数据同步时,只需从数据缓存区域提取同步指令发送给服务器即可,无需在进行数据组装,提高了数据同步速率。也即步骤“将该目标数据添加至该数据缓存区域”,或者步骤“将复制后的目标数据添加至数据缓存区域”可以包括:
将该目标数据切割成多个数据块;
对该数据块进行组装,得到该云端服务器可识别的同步命令或者同步请求;
将该同步命令或者同步请求添加至该数据存储区域。
其中,切割的方式可以有多种,比如可以将目标数据切割成多个大小相同的数据块等。本实施例对数据块进行组装,得到该云端服务器可识别的同步命令,也就是将数据块组装成符合终端与服务器之间的通讯协议的命令或者数据包,通讯协议可以为TCP/IP协议。步骤“对该数据块进行组装”可以包括:
获取与该云端服务器通讯协议文件;
根据该通讯协议文件对数据块进行组装。
为提升同步数据的安全性,本实施例也对目标同步数据进行加密,比如,可以先对目标数据进行加密,然后在对加密后的目标数据进行切割,也即步骤“将该目标数据切割成多个数据块”可以包括:对该目标数据进行加密,并将加密后的目标数据切割成多个数据块。
又比如,可以先对目标数据进行切割,然后对数据块进行加密,也即步骤“对该数据块进行组装”可以包括:对该数据块进行加密,并对加密后的数据块进行组装。
又比如,可以先进行切割和组装,然后,对同步命令进行加密,此时,步骤“将该同步命令添加至该数据存储区域”可以包括:对该同步命令进行加密,并将加密后的同步命令添加至该数据存储区域。
本实施例中对数据加密可以采用与云端服务器约定的密钥。
104、在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。
比如,在间隔预设时间段之后,向云端服务器发送携带目标数据的数据同步请求,以将目标数据同步至云端服务器。
其中,预设时间段可以根据实际需求设定,比如,1分钟、10分钟、5分钟、1个小时等等。该预设时间段的时间起点可以为将目标数据完全添加到数据缓存区域时,或者将所有同步指令安全添加到数据缓存区域时,在实际应用中该时间起点可以在判断数据类型是为预设数据类型之后的任一时刻。
步骤“在间隔预设时间段之后,将该数据缓存区域内的目标数据同步至云端服务器”可以包括:
在将目标数据添加到数据存储区域时,开始计时;
当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
将目标数据添加数据存储区域包括:将数据切割成数据块,并对数据进行组装得到同步命令时,步骤“将该数据缓存区域内的目标数据同步至云端服务器”可以包括:将该数据缓存区域内的同步命令发送给云端服务器。
105、向该云端服务器发送携带该目标数据的数据同步请求,以将该目标数据同步至云端服务器。
本实施例在目标数据的数据类型不为预设数据类型时,可以实时与云端服务器进行数据同步,即直接向云端服务器发送数据同步请求进行数据同步;比如,当目标数据的数据类型为变化一般型,预设数据类型为变化频繁型时,此时,可以直接与该服务器进行数据同步,无需在本地缓存目标数据。
考虑到由于数据同步失败时可能需要多次重试数据同步,导致频繁访问云端服务器,提高了云端服务器的负载;为了克服此问题,本实施例可以当数据同步失败时将本次同步数据添加至数据缓存区域内,之后再重新进行数据同步,以减少访问云端服务器的次数,降低服务器的负载。也即本实施例方法还可以包括:
当该数据同步请求发送失败时,确定该数据同步请求发送失败的失败原因;
判断该失败原因是否满足预设条件;
若满足预设条件,则将该目标数据添加至该数据缓存区域;
将该数据缓存区域内的目标数据同步至云端服务器。
该数据同步请求为在判断目标数据的数据类型不为预设数据类型的情况下进行数据同步的数据同步请求;也即步骤105中的数据同步请求。
其中,数据同步失败即数据同步请求发送失败的失败原因可以有多种,比如失败原因可以包括:
网络状态异常或者不稳定;该原因的确定手段为:可以获取网络状态的参数信息,根据该参数信息检测网络状态是否稳定,其中,网络状态的参数信息可以包括:网络延迟、丢包率、抖动、(Quality of Service,服务质量)。
云端服务器的负载过大;该原因的确定手段为:可以获取云端服务器的负载,判断该负载是否大于预设阈值,若是,则确定云端服务器的负载过大。
终端的可用资源过少;该原因的确定手段为:可以获取终端的处理器的使用率、存储空间的占用率等资源参数,然后,根据该资源参数确定终端的可用资源是否过少。
本实施例方法可以当数据同步请求发送失败时,通过上述原因的确定手段来确定数据同步请求的发送失败的失败原因。
本实施例预设条件可以有多种,其可以根据实际需求设定。比如,由于网络不稳定或者服务器负载多大造成的数据同步失败,会引发多次同步重试,导致服务器的负载较大,因此为了降低服务器的负载,可以设置预设条件包括:该失败原因为网络状态异常或者云端服务器的负载过大;也即步骤“判断该失败原因是否满足预设条件”可以包括:
当该失败原因为网络状态异常或者云端服务器的负载过大时,则确定该失败原因满足预设条件。
此时,在数据同步请求发送失败的情况下的步骤“将该数据缓存区域内的目标数据同步至云端服务器”可以包括:在该网络状态恢复正常或者该云端服务器的负载小于预设阈值时,将该数据缓存区域内的目标数据同步至云端服务器。
本实施例可以通过失败原因以及预设条件来确定当前数据同步失败为是否会引发同步重发机制的同步失败,进而可以针对该类同步失败,将同步数据缓存至数据缓存区域内,之后进行重新同步;不仅可以减少与云端服务器的同步次数,降低云端服务器的负载,又可以保证其他同步失败的数据可以及时同步到服务器,提高了数据同步的及时性。
在一实施例中,为了保证同步数据的准确性和一致性,在判断数据类型为预设数据类型,且将目标数据添加到数据存储区域,在间隔预设时间段之后进行数据同步的情况下,如果在预设时间段内目标数据发生变化,则更新数据存储区域内的目标数据;也即在判断数据类型为预设数据类型情况下,步骤“将该目标数据添加至数据缓存区域”与步骤“将该数据缓存区域内的目标数据同步至云端服务器”之间,还可以包括:
在该预设时间段内,若检测到该目标数据发生变化,则根据变化后的目标数据更新该数据存储区域内的目标数据。
在将数据添加到数据缓存区域包括将同步命令添加至数据存储区域的情况下,步骤“根据变化后的目标数据更新该数据存储区域内的目标数据”可以包括:
将该变化后的目标数据切割成多个新数据块,并对该新数据块进行组装,得到该云端服务器可识别的新同步命令;
根据该新同步命令更新数据存储区域内的同步命令。如可以将数据存储区域内的同步命令删除,然后,将新同步命令添加至数据存储区域内,以达到更新同步命令更新。
由上可知,本发明实施例采用确定待同步的目标数据对应的数据类型,然后,判断该目标数据对应的数据类型是否为预设数据类型,若否,则将该目标数据添加至数据缓存区域,在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。该方案可以将特定数据类型的待同步数据添加到数据缓存区域,在间隔预设时间段后再与云端服务器进行该特定数据类型的数据的同步,减少了针对该特定数据类型的数据与云端服务器进行数据同步的次数,以及减少对同步模块的访问,因此,可以降低云端服务器的负载以及降低了对同步模块频繁访问带来的交互风险。
此外,本发明实施例还可以在由于网络状态不稳定或者服务器负载较大导致数据同步失败时,将同步数据添加到数据缓存区域内,并且在网络状态恢复或者服务器负载下降时再次将数据缓存区域内的数据同步至服务器,避免了数据同步失败时频繁与服务器进行数据同步,进一步降低了云端服务器的负载。
在一优选实施例中,本实施例将在上述实施例所述方法的基础上作进一步描述。
本实施例以本发明实施例的数据同步装置集成在终端为例来作详细说明。
在一优选实施例中,参考图2,提供了一种数据同步系统,该系统包括:服务器以及数据同步装置,其中,该数据同步装置具体可以集成在终端中,该终端可以手机、平板电脑、笔记本电脑等设备。该服务器与终端可通过有线或无线网络连接。
在一优选实施例中,将基于该数据同步系统来详细介绍本发明的数据同步方法,如图3所示,一种数据同步方法,具体流程如下:
301、终端确定待同步的目标数据对应的数据类型。
比如,终端接收数据同步指令,根据数据同步指令确定目标数据对应的数据类型,该数据同步指令指示需要同步的目标数据。该数据同步指令可以由数据发生变化触发,也可以由用户进行操作触发等等。
其中,目标数据可以为短信数据、通话记录数据、通讯录数据等等。
其中,数据类型可以采用多种分类方式对数据进行分类得到,在一实施例中,可以根据数据变化的频率或者次数来对数据进行分类,得到数据对应的数据类型。
比如,数据类型可以包括:数据变化频繁型、数据变化较少型、数据变化一般型等等数据类型。
302、终端判断该目标数据对应的数据类型是否为预设数据类型,若是,则执行步骤303,若否,则执行步骤305。
其中,预设数据类型可以根据用户的实际需求设定;如,以根据数据变化的频率或者次数对数据分类为例;为了减少与云端服务器进行该类数据的同步,预设数据类型可以包括:数据变化频繁型、或者数据变化一般型等等;此时,若目标数据对应的数据类型为数据变化频繁型,则判断目标数据对应的数量类型为预设数据类型。
303、终端将该目标数据切割成多个数据块,对该数据块进行组装,得到该云端服务器可识别的同步命令,并将同步命令添加至数据存储区域。
比如,终端可以复制一份目标数据,并将复制的目标数据切割成多个数据块。以下本实施例该的目标数据可以为目标数据的复制数据,也可以为目标数据本身。
其中,切割的方式可以有多种,比如可以将目标数据切割成多个大小相同或者不相同的数据块。
为了加快数据同步速度,本实施例可以预先对数据块进行协议组装,将其组装成服务器可识别的同步命令,比如,可以获取与该云端服务器通讯协议文件,根据该通讯协议文件对数据块进行组装。
304、在间隔预设时间段之后,终端将数据存储区域内的同步命令发送给服务器。
比如,在间隔预设时间段之后,向云端服务器发送同步命令,以将目标数据同步至云端服务器。
其中,预设时间段可以根据实际需求设定,比如,2分钟、8分钟、半个小时、2个小时等等。该预设时间段的时间起点可以是判断数据类型是为预设数据类型之后的任一时刻。
在一实施例中,为提高数据同步的准确性,本实施例若在预设时间段内检测到目标数据发生变化,则根据变化后的目标数据对同步命令进行更新。比如,复制一份变化后的目标数据,然后,根据复制的目标数据对数据缓存区域内的同步命令进行更新。
具体地,将该变化后的目标数据(可以为变化后目标数据的复制数据)切割成多个新数据块,并对该新数据块进行组装,得到该云端服务器可识别的新同步命令,根据该新同步命令更新数据存储区域内的同步命令。如可以将数据存储区域内的同步命令替换为新同步命令。
305、终端向服务器发送携带目标数据的数据同步请求。
本实施例在判断数据类型不为预设数据类型时可以实时与云端服务器进行数据同步,以保证数据同步的及时性。
服务器可以根据数据同步请求对目标数据进行存储。
306、当数据请求发送失败时,终端确定该数据同步请求发送失败的失败原因。
其中,数据同步失败即数据同步请求发送失败的失败原因可以有多种,比如失败原因可以包括:网络状态异常或者不稳定、云端服务器的负载过大、终端的可用资源过少、服务器超时等等。
307、终端判断该失败原因是否为网络状态异常或者服务器负载过大,若是,则执行步骤308,若否,则执行步骤310。
308、终端将该目标数据切割成多个数据块,对该数据块进行组装,得到该云端服务器可识别的同步命令,并将同步命令添加至数据存储区域。
为避免数据同步失败进行多次重试同步导致频繁访问云端服务器的问题,本实施例当数据同步失败时将本次同步数据添加至数据缓存区域内,之后再重新进行数据同步,以减少访问云端服务器的次数,降低服务器的负载。
309、终端在该网络状态恢复正常或者该云端服务器的负载小于预设阈值时,将该数据缓存区域内的目标数据同步至云端服务器。
310、终端重新向服务器发送数据同步请求。
由上可知,本发明实施例采用确定待同步的目标数据对应的数据类型,然后,判断该目标数据对应的数据类型是否为预设数据类型,若否,则将该目标数据添加至数据缓存区域,在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。该方案可以将特定数据类型的待同步数据添加到数据缓存区域,在间隔预设时间段后再与云端服务器进行该特定数据类型的数据的同步,减少了针对该特定数据类型的数据与云端服务器进行数据同步的次数,以及减少对同步模块的访问,因此,可以降低云端服务器的负载以及降低了对同步模块频繁访问带来的交互风险。
此外,本发明实施例还可以在由于网络状态不稳定或者服务器负载较大导致数据同步失败时,将同步数据添加到数据缓存区域内,并且在网络状态恢复或者服务器负载下降时再次将数据缓存区域内的数据同步至服务器,避免了数据同步失败时频繁与服务器进行数据同步,进一步降低了云端服务器的负载。
本发明实施例提供了一种数据同步装置,包括:
第一确定单元,用于确定待同步的目标数据对应的数据类型;
第一判断单元,用于判断所述目标数据对应的数据类型是否为预设数据类型;
添加单元,用于在第一判断单元判断所述数据类型为预设数据类型时,将所述目标数据添加至数据缓存区域;
第一同步单元,用于在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述数据同步装置还包括:第二同步单元;
所述第二同步单元,用于在所述第一判断单元判断所述数据类型不为预设数据类型时,向所述云端服务器发送携带所述目标数据的数据同步请求,以将所述目标数据同步至云端服务器。
一实施例中,所述数据同步装置还包括:第二确定单元、第二判断单元以及第三同步单元;
所述第二确定单元,用于当所述数据同步请求发送失败时,确定所述数据同步请求发送失败的失败原因;
所述第二判断单元,用于判断所述失败原因是否满足预设条件;
所述第三同步单元,用于在第二判断单元判断失败原因满足预设条件时,将所述目标数据添加至所述数据缓存区域,将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述第二判断单元,具体用于:当所述失败原因为网络状态异常或者云端服务器的负载过大时,则确定所述失败原因满足预设条件;
所述第三同步单元,具体用于在所述网络状态恢复正常或者所述云端服务器的负载小于预设阈值时,将所述数据缓存区域内的目标数据同步至云端服务器。
一实施例中,所述添加单元,具体用于:
将所述目标数据切割成多个数据块;
对所述数据块进行组装,得到所述云端服务器可识别的同步命令;
将所述同步命令添加至所述数据存储区域;
所述第一同步单元,具体用于将所述数据存储区域内的同步命令发送给所述云端服务器。
一实施例中,所述数据同步装置还包括:更新单元;
所述更新单元,用于在所述添加单元所述目标数据添加至数据缓存区域之后,所述第一同步单元将所述数据缓存区域内的目标数据同步至云端服务器之前,在所述预设时间段内,若检测到所述目标数据发生变化,则根据变化后的目标数据更新所述数据存储区域内的目标数据。
一实施例中,所述更新单元,用于将所述变化后的目标数据切割成多个新数据块,并对所述新数据块进行组装,得到所述云端服务器可识别的新同步命令;根据所述新同步命令更新所述数据存储区域内的同步命令。
一实施例中,所述数据同步装置还包括:分类单元;
所述分类单元,用于在第一确定单元确定待同步的目标数据对应的数据类型之前,根据数据变化的频率或者次数对数据进行分类,得到所述数据对应的数据类型。
一实施例中,所述第一同步单元,用于在将目标数据添加到数据存储区域时,开始计时;当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
为了更好地实施以上方法,在一优选实施例中,还提供一种数据同步装置40,如图4所示,该数据同步装置40包括第一确定单元401、第一判断单元402、添加单元403和第一同步单元404,如下:
第一确定单元401,用于确定待同步的目标数据对应的数据类型;
第一判断单元402,用于判断该目标数据对应的数据类型是否为预设数据类型;
添加单元403,用于在第一判断单元402判断该数据类型为预设数据类型时,将该目标数据添加至数据缓存区域;
第一同步单元404,用于在间隔预设时间段之后,将该数据缓存区域内的目标数据同步至云端服务器。
在一实施例中,参考图5,为保证数据实时同步,本实施例数据同步装置还包括:第二同步单元405;
该第二同步单元,用于在该第一判断单元判断该数据类型不为预设数据类型时,向该云端服务器发送携带该目标数据的数据同步请求,以将该目标数据同步至云端服务器。
在一实施例中,参考图6,为了减少因同步失败导致频繁与服务器进行重试同步的次数,降低服务器负载,本实施例数据库同步装置还可以包括:第二确定单元406、第二判断单元407以及第三同步单元408;
该第二确定单元406,用于当该数据同步请求发送失败时,确定该数据同步请求发送失败的失败原因;
该第二判断单元407,用于判断该失败原因是否满足预设条件;
该第三同步单元408,用于在第二判断单元407判断失败原因满足预设条件时,将该目标数据添加至该数据缓存区域,将该数据缓存区域内的目标数据同步至云端服务器。
具体地,该第二判断单元407,具体用于当该失败原因为网络状态异常或者云端服务器的负载过大时,则确定该失败原因满足预设条件;
此时,第三同步单元408,具体用于在该网络状态恢复正常或者该云端服务器的负载小于预设阈值时,将该数据缓存区域内的目标数据同步至云端服务器。
在一实施例中,为了提高数据同步速率,本实施例中添加单元403,可以具体用于:
将该目标数据切割成多个数据块;
对该数据块进行组装,得到该云端服务器可识别的同步命令;
将该同步命令添加至该数据存储区域;
该第一同步单元,具体用于将该数据存储区域内的同步命令发送给该云端服务器。
在一实施例中,为提高数据同步的准确性,参考图7,本实施例数据同步装置还可以包括更新单元409;
该更新单元409,用于在该添加单元403该目标数据添加至数据缓存区域之后,该第一同步单元404将该数据缓存区域内的目标数据同步至云端服务器之前,在该预设时间段内,若检测到该目标数据发生变化,则根据变化后的目标数据更新该数据存储区域内的目标数据。
在一实施例中,更新单元409可以用于将所述变化后的目标数据切割成多个新数据块,并对所述新数据块进行组装,得到所述云端服务器可识别的新同步命令;根据所述新同步命令更新所述数据存储区域内的同步命令。
在一实施例中,参考图8,数据同步装置还可以包括:分类单元410;该分类单元410,用于在第一确定单元401确定待同步的目标数据对应的数据类型之前,根据数据变化的频率或者次数对数据进行分类,得到所述数据对应的数据类型。
在一实施例中,第一同步单元404可以用于在将目标数据添加到数据存储区域时,开始计时;当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
具体实施时,以上各个单元可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元的具体实施可参见前面的方法实施例,在此不再赘述。
该数据同步装置具体可以集成终端中,比如集成在手机、笔记本电脑、平板电脑等设备中。
由上可知,本发明实施例采用第一确定单元401确定待同步的目标数据对应的数据类型,然后,由第一判断单元402判断该目标数据对应的数据类型是否为预设数据类型,若否,则由添加单元403将该目标数据添加至数据缓存区域,由第一同步单元404在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。该方案可以将特定数据类型的待同步数据添加到数据缓存区域,在间隔预设时间段后再与云端服务器进行该特定数据类型的数据的同步,减少了针对该特定数据类型的数据与云端服务器进行数据同步的次数,以及减少对同步模块的访问,因此,可以降低云端服务器的负载以及降低了对同步模块频繁访问带来的交互风险。
此外,本发明实施例还可以在由于网络状态不稳定或者服务器负载较大导致数据同步失败时,将同步数据添加到数据缓存区域内,并且在网络状态恢复或者服务器负载下降时再次将数据缓存区域内的数据同步至服务器,避免了数据同步失败时频繁与服务器进行数据同步,进一步降低了云端服务器的负载。
本发明实施例还提供了一种电子设备包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述存储器中的指令用于执行本发明实施例任一提供的数据同步方法。
在一优选实施例中,本发明实施例还提供了一种电子设备,该电子设备可以为终端,如平板电脑、手机等移动终端,请参阅图9,图9为本发明实施例提供的移动终端结构示意图。该移动终端500可以包括射频(RF,Radio Frequency)电路501、包括有一个或一个以上计算机可读存储介质的存储器502、输入单元503、显示单元504、传感器505、音频电路506、无线保真(WiFi,Wireless Fidelity)模块507、包括有一个或者一个以上处理核心的处理器508、以及电源509等部件。本领域技术人员可以理解,图9中示出的移动终端结构并不构成对移动终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
射频电路501可用于收发信息,或通话过程中信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器508处理;另外,将涉及上行的数据发送给基站。通常,射频电路501包括但不限于天线、至少一个放大器、调谐器、一个或多个振荡器、用户身份模块(SIM, Subscriber Identity Module)卡、收发信机、耦合器、低噪声放大器(LNA,Low Noise Amplifier)、双工器等。此外,射频电路501还可以通过无线通信与网络和其他设备通信。该无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统 (GSM,Global System of Mobile communication)、通用分组无线服务(GPRS ,General Packet Radio Service)、码分多址(CDMA,Code Division Multiple Access)、宽带码分多址(WCDMA,Wideband Code Division Multiple Access)、长期演进(LTE,Long Term Evolution)、电子邮件、短消息服务(SMS,Short Messaging Service)等。
存储器502可用于存储应用程序和数据。存储器502存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器508通过运行存储在存储器502的应用程序,从而执行各种功能应用以及数据处理。存储器502可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据移动终端的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器502可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器502还可以包括存储器控制器,以提供处理器508和输入单元503对存储器502的访问。
输入单元503可用于接收输入的数字、字符信息或用户特征信息(比如指纹),以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,在一个具体的实施例中,输入单元503可包括触敏表面以及其他输入设备。触敏表面,也称为触摸显示屏或者触控板,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面上或在触敏表面附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触敏表面可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器508,并能接收处理器508发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面。除了触敏表面,输入单元503还可以包括其他输入设备。具体地,其他输入设备可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、指纹识别模组、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元504可用于显示由用户输入的信息或提供给用户的信息以及移动终端的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元504可包括显示面板。可选的,可以采用液晶显示器(LCD,Liquid Crystal Display)、有机发光二极管(OLED,Organic Light-Emitting Diode)等形式来配置显示面板。进一步的,触敏表面可覆盖显示面板,当触敏表面检测到在其上或附近的触摸操作后,传送给处理器508以确定触摸事件的类型,随后处理器508根据触摸事件的类型在显示面板上提供相应的视觉输出。虽然在图9中,触敏表面与显示面板是作为两个独立的部件来实现输入和输入功能,但是在某些实施例中,可以将触敏表面与显示面板集成而实现输入和输出功能。
移动终端还可包括至少一种传感器505,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板的亮度,接近传感器可在移动终端移动到耳边时,关闭显示面板和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于移动终端还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路506可通过扬声器、传声器提供用户与移动终端之间的音频接口。音频电路506可将接收到的音频数据转换成电信号,传输到扬声器,由扬声器转换为声音信号输出;另一方面,传声器将收集的声音信号转换为电信号,由音频电路506接收后转换为音频数据,再将音频数据输出处理器508处理后,经射频电路501以发送给比如另一移动终端,或者将音频数据输出至存储器502以便进一步处理。音频电路506还可能包括耳塞插孔,以提供外设耳机与移动终端的通信。
无线保真(WiFi)属于短距离无线传输技术,移动终端通过无线保真模块507可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图9示出了无线保真模块507,但是可以理解的是,其并不属于移动终端的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器508是移动终端的控制中心,利用各种接口和线路连接整个移动终端的各个部分,通过运行或执行存储在存储器502内的应用程序,以及调用存储在存储器502内的数据,执行移动终端的各种功能和处理数据,从而对移动终端进行整体监控。可选的,处理器508可包括一个或多个处理核心;优选的,处理器508可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器508中。
移动终端还包括给各个部件供电的电源509(比如电池)。优选的,电源可以通过电源管理系统与处理器508逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源509还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。
尽管图9中未示出,移动终端还可以包括摄像头、蓝牙模块等,在此不再赘述。
具体在本实施例中,移动终端中的处理器508会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器502中,并由处理器508来运行存储在存储器502中的应用程序,从而实现各种功能:
确定待同步的目标数据对应的数据类型,然后,判断该目标数据对应的数据类型是否为预设数据类型,若否,则将该目标数据添加至数据缓存区域,在间隔预设时间段之后将该数据缓存区域内的目标数据同步至云端服务器。
处理器508还用于实现以下功能:当所述目标数据对应的数据类型不为预设数据类型时,向所述云端服务器发送携带所述目标数据的数据同步请求,以将所述目标数据同步至云端服务器。
在某些实施方式中,处理器508还用于实现以下功能:当所述数据同步请求发送失败时,确定所述数据同步请求发送失败的失败原因;
判断所述失败原因是否满足预设条件;
若满足预设条件,则将所述目标数据添加至所述数据缓存区域;
将所述数据缓存区域内的目标数据同步至云端服务器。
在某些实施方式中,处理器508可以将所述目标数据切割成多个数据块;对所述数据块进行组装,得到所述云端服务器可识别的同步命令;将所述同步命令添加至所述数据存储区域,所述数据存储区域内的同步命令发送给所述云端服务器。
在某些实施方式中,处理器508还用于实现以下功能:在将所述目标数据添加至数据缓存区域之后,将所述数据缓存区域内的目标数据同步至云端服务器之前,在所述预设时间段内,若检测到所述目标数据发生变化,则根据变化后的目标数据更新所述数据存储区域内的目标数据。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对数据同步方法的详细描述,此处不再赘述。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。
以上对本发明实施例所提供的一种数据同步方法、装置存储介质及电子设备进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims (20)

  1. 一种数据同步方法,其中,包括:
    确定待同步的目标数据对应的数据类型;
    判断所述目标数据对应的数据类型是否为预设数据类型;
    若是,则将所述目标数据添加至数据缓存区域;
    在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
  2. 如权利要求1所述的数据同步方法,其中,所述数据同步方法还包括:
    当所述目标数据对应的数据类型不为预设数据类型时,向所述云端服务器发送携带所述目标数据的数据同步请求,以将所述目标数据同步至云端服务器。
  3. 如权利要求2所述的数据同步方法,其中,所述数据同步方法还包括:
    当所述数据同步请求发送失败时,确定所述数据同步请求发送失败的失败原因;
    判断所述失败原因是否满足预设条件;
    若满足预设条件,则将所述目标数据添加至所述数据缓存区域;
    将所述数据缓存区域内的目标数据同步至云端服务器。
  4. 如权利要求3所述的数据同步方法,其中,所述判断所述失败原因是否满足预设条件,包括:
    当所述失败原因为网络状态异常或者云端服务器的负载过大时,则确定所述失败原因满足预设条件;
    所述将所述数据缓存区域内的目标数据同步至云端服务器,包括:
    在所述网络状态恢复正常或者所述云端服务器的负载小于预设阈值时,将所述数据缓存区域内的目标数据同步至云端服务器。
  5. 如权利要求1所述的数据同步方法,其中,所述将所述目标数据添加至所述数据缓存区域,包括:
    将所述目标数据切割成多个数据块;
    对所述数据块进行组装,得到所述云端服务器可识别的同步命令;
    将所述同步命令添加至所述数据存储区域;
    所述将所述数据缓存区域内的目标数据同步至云端服务器,包括:将所述数据存储区域内的同步命令发送给所述云端服务器。
  6. 如权利要求1所述的数据同步方法,其中,在将所述目标数据添加至数据缓存区域之后,将所述数据缓存区域内的目标数据同步至云端服务器之前,所述数据同步方法还包括:
    在所述预设时间段内,若检测到所述目标数据发生变化,则根据变化后的目标数据更新所述数据存储区域内的目标数据。
  7. 如权利要求6所述的数据同步方法,其中,根据变化后的目标数据更新所述数据存储区域内的目标数据,包括:
    将所述变化后的目标数据切割成多个新数据块,并对所述新数据块进行组装,得到所述云端服务器可识别的新同步命令;
    根据所述新同步命令更新所述数据存储区域内的同步命令。
  8. 如权利要求1所述的数据同步方法,其中,在确定待同步的目标数据对应的数据类型之前,所述数据同步方法还包括:
    根据数据变化的频率或者次数对数据进行分类,得到所述数据对应的数据类型。
  9. 如权利要求1所述的数据同步方法,其中,在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器,包括:
    在将目标数据添加到数据存储区域时,开始计时;
    当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
  10. 一种数据同步装置,其中,包括:
    第一确定单元,用于确定待同步的目标数据对应的数据类型;
    第一判断单元,用于判断所述目标数据对应的数据类型是否为预设数据类型
    添加单元,用于在第一判断单元判断所述数据类型为预设数据类型时,将所述目标数据添加至数据缓存区域;
    第一同步单元,用于在间隔预设时间段之后,将所述数据缓存区域内的目标数据同步至云端服务器。
  11. 如权利要求10所述的数据同步装置,其中,所述数据同步装置还包括:第二同步单元;
    所述第二同步单元,用于在所述第一判断单元判断所述数据类型不为预设数据类型时,向所述云端服务器发送携带所述目标数据的数据同步请求,以将所述目标数据同步至云端服务器。
  12. 如权利要求11所述的数据同步装置,其中,所述数据同步装置还包括:第二确定单元、第二判断单元以及第三同步单元;
    所述第二确定单元,用于当所述数据同步请求发送失败时,确定所述数据同步请求发送失败的失败原因;
    所述第二判断单元,用于判断所述失败原因是否满足预设条件;
    所述第三同步单元,用于在第二判断单元判断失败原因满足预设条件时,将所述目标数据添加至所述数据缓存区域,将所述数据缓存区域内的目标数据同步至云端服务器。
  13. 如权利要求12所述的数据同步装置,其中,所述第二判断单元,具体用于:当所述失败原因为网络状态异常或者云端服务器的负载过大时,则确定所述失败原因满足预设条件;
    所述第三同步单元,具体用于在所述网络状态恢复正常或者所述云端服务器的负载小于预设阈值时,将所述数据缓存区域内的目标数据同步至云端服务器。
  14. 如权利要求10所述的数据同步装置,其中,所述添加单元,具体用于:
    将所述目标数据切割成多个数据块;
    对所述数据块进行组装,得到所述云端服务器可识别的同步命令;
    将所述同步命令添加至所述数据存储区域;
    所述第一同步单元,具体用于将所述数据存储区域内的同步命令发送给所述云端服务器。
  15. 如权利要求10所述的数据同步装置,其中,所述数据同步装置还包括:更新单元;
    所述更新单元,用于在所述添加单元所述目标数据添加至数据缓存区域之后,所述第一同步单元将所述数据缓存区域内的目标数据同步至云端服务器之前,在所述预设时间段内,若检测到所述目标数据发生变化,则根据变化后的目标数据更新所述数据存储区域内的目标数据。
  16. 如权利要求15所述的数据同步装置,其中,所述更新单元,用于将所述变化后的目标数据切割成多个新数据块,并对所述新数据块进行组装,得到所述云端服务器可识别的新同步命令;根据所述新同步命令更新所述数据存储区域内的同步命令。
  17. 如权利要求10所述的数据同步装置,其中,所述数据同步装置还包括:分类单元;
    所述分类单元,用于在第一确定单元确定待同步的目标数据对应的数据类型之前,根据数据变化的频率或者次数对数据进行分类,得到所述数据对应的数据类型。
  18. 如权利要求10所述的数据同步装置,其中,所述第一同步单元,用于在将目标数据添加到数据存储区域时,开始计时;当计时的时长达到预设时长时,则将该数据缓存区域内的目标数据同步至云端服务器。
  19. 一种存储介质,其中,所述存储介质中存储有多条指令,所述指令适于由处理器加载以执行如权利要求1-9任一项所述的方法。
  20. 一种电子设备,其中,包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述存储器中的指令用于执行如权利要求1-9任一项所述的方法。
PCT/CN2017/095622 2016-10-25 2017-08-02 一种数据同步方法、装置、存储介质及电子设备 WO2018076864A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP17864780.6A EP3499786B1 (en) 2016-10-25 2017-08-02 Data synchronization method, apparatus, storage medium and electronic device
US16/310,925 US20190373057A1 (en) 2016-10-25 2017-08-02 Method and device for synchronizing data, and electronic device
US16/577,378 US20200021652A1 (en) 2016-10-25 2019-09-20 Method and device for synchronizing data, and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610942149.0 2016-10-25
CN201610942149.0A CN106357808B (zh) 2016-10-25 2016-10-25 一种数据同步方法和装置

Related Child Applications (2)

Application Number Title Priority Date Filing Date
US16/310,925 A-371-Of-International US20190373057A1 (en) 2016-10-25 2017-08-02 Method and device for synchronizing data, and electronic device
US16/577,378 Continuation US20200021652A1 (en) 2016-10-25 2019-09-20 Method and device for synchronizing data, and electronic device

Publications (1)

Publication Number Publication Date
WO2018076864A1 true WO2018076864A1 (zh) 2018-05-03

Family

ID=57864367

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/095622 WO2018076864A1 (zh) 2016-10-25 2017-08-02 一种数据同步方法、装置、存储介质及电子设备

Country Status (4)

Country Link
US (2) US20190373057A1 (zh)
EP (1) EP3499786B1 (zh)
CN (1) CN106357808B (zh)
WO (1) WO2018076864A1 (zh)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106357808B (zh) * 2016-10-25 2019-09-24 Oppo广东移动通信有限公司 一种数据同步方法和装置
CN108664525B (zh) * 2017-04-01 2022-08-12 北京京东尚科信息技术有限公司 用于数据处理服务器的数据处理方法和装置
CN110119304B (zh) * 2018-02-07 2021-08-31 华为技术有限公司 一种中断处理方法、装置及服务器
CN109408581B (zh) * 2018-11-13 2020-11-17 杭州数梦工场科技有限公司 一种数据交换方法、装置、设备及存储介质
CN110324395B (zh) * 2019-01-31 2022-04-19 林德(中国)叉车有限公司 一种基于双重链的iot设备数据处理方法
CN110247950A (zh) * 2019-04-30 2019-09-17 五八有限公司 一种React Native中的数据同步方法和装置
US11012492B1 (en) * 2019-12-26 2021-05-18 Palo Alto Networks (Israel Analytics) Ltd. Human activity detection in computing device transmissions
CN111569413B (zh) * 2020-05-14 2023-06-13 北京代码乾坤科技有限公司 数据同步方法和装置
CN113188605B (zh) * 2021-05-12 2022-06-21 郑州大学 一种基于智能手机的物理实验方法
CN114553895B (zh) * 2022-04-24 2022-07-22 浙江中控技术股份有限公司 一种数据同步方法、系统、存储介质及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140068018A1 (en) * 2012-08-30 2014-03-06 Samsung Electronics Co., Ltd. Content synchronization apparatus and method for cloud service system
CN103729470A (zh) * 2014-01-20 2014-04-16 刘强 一种基于不同云存储端的安全存储方法
CN104243132A (zh) * 2014-10-08 2014-12-24 深圳市大疆创新科技有限公司 一种数据同步方法及相关设备
CN104253868A (zh) * 2014-09-24 2014-12-31 无锡清华信息科学与技术国家实验室物联网技术中心 一种云存储数据同步的方法及装置
CN105389463A (zh) * 2015-10-26 2016-03-09 武汉帕菲利尔信息科技有限公司 医疗ris系统诊断报告的同步方法及前置服务器
CN106357808A (zh) * 2016-10-25 2017-01-25 广东欧珀移动通信有限公司 一种数据同步方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9614924B2 (en) * 2008-12-22 2017-04-04 Ctera Networks Ltd. Storage device and method thereof for integrating network attached storage with cloud storage services
CN103327037B (zh) * 2012-03-20 2017-09-29 中兴通讯股份有限公司 数据同步方法及装置
US9489440B2 (en) * 2012-12-13 2016-11-08 Microsoft Technology Licensing Llc Opportunistic, priority-based object synchronization
CN105162820B (zh) * 2015-06-25 2019-02-05 Oppo广东移动通信有限公司 一种数据同步方法和设备
CN105868054A (zh) * 2016-03-28 2016-08-17 上海上讯信息技术股份有限公司 一种在双机系统环境下备份数据的方法与设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140068018A1 (en) * 2012-08-30 2014-03-06 Samsung Electronics Co., Ltd. Content synchronization apparatus and method for cloud service system
CN103729470A (zh) * 2014-01-20 2014-04-16 刘强 一种基于不同云存储端的安全存储方法
CN104253868A (zh) * 2014-09-24 2014-12-31 无锡清华信息科学与技术国家实验室物联网技术中心 一种云存储数据同步的方法及装置
CN104243132A (zh) * 2014-10-08 2014-12-24 深圳市大疆创新科技有限公司 一种数据同步方法及相关设备
CN105389463A (zh) * 2015-10-26 2016-03-09 武汉帕菲利尔信息科技有限公司 医疗ris系统诊断报告的同步方法及前置服务器
CN106357808A (zh) * 2016-10-25 2017-01-25 广东欧珀移动通信有限公司 一种数据同步方法和装置

Also Published As

Publication number Publication date
EP3499786A4 (en) 2019-09-18
CN106357808A (zh) 2017-01-25
US20200021652A1 (en) 2020-01-16
CN106357808B (zh) 2019-09-24
US20190373057A1 (en) 2019-12-05
EP3499786A1 (en) 2019-06-19
EP3499786B1 (en) 2020-11-11

Similar Documents

Publication Publication Date Title
WO2018076864A1 (zh) 一种数据同步方法、装置、存储介质及电子设备
WO2018076866A1 (zh) 数据处理方法、装置、存储介质、电子设备及服务器
WO2018076819A1 (zh) 数据的上传方法、装置、存储介质、电子设备及系统
WO2018090823A1 (zh) 一种系统分区关键数据的保护方法及系统、终端
WO2018076818A1 (zh) 数据的备份方法、装置、电子设备、存储介质及系统
WO2017142293A1 (en) Electronic device and method of application data display therefor
WO2017142373A1 (en) Method of controlling the sharing of videos and electronic device adapted thereto
WO2020246822A1 (en) Electronic device and method for switching electronic device between dual standby mode and single standby mode
WO2018076889A1 (zh) 数据备份的方法、装置、系统、存储介质及服务器
WO2017071330A1 (zh) 数据的加密和解密方法及加密和解密装置
WO2018026059A1 (ko) 이동 단말기 및 그 제어방법
WO2018076868A1 (zh) 一种数据同步方法、装置、系统、存储介质和服务器
WO2015180013A1 (zh) 一种终端的触摸操作方法及装置
WO2018076812A1 (zh) 数据请求的响应方法、装置、存储介质、服务器及系统
WO2017071324A1 (zh) 传输文件的加密和解密方法及加密和解密装置
WO2018076867A1 (zh) 数据备份的删除方法、装置、系统、存储介质和服务器
WO2018076842A1 (zh) 一种数据备份方法、装置、系统、存储介质及电子设备
WO2018076888A1 (zh) 移动终端数据的同步方法、装置及系统、存储介质及移动终端
WO2018076830A1 (zh) 数据同步周期的调整方法、装置、电子设备、存储介质及系统
WO2018076811A1 (zh) 数据分享方法、装置、存储介质及电子设备
WO2018090822A1 (zh) 基于智能手表的移动终端相机控制方法及控制系统
WO2017206883A1 (zh) 一种应用处理方法、装置、存储介质及电子设备
WO2018076875A1 (zh) 备份数据的同步方法、装置、存储介质、电子设备及服务器
WO2019039868A1 (en) ELECTRONIC DISPLAY DEVICE FOR APPLICATION AND METHOD FOR OPERATING THE SAME
WO2018028128A1 (zh) 一种上行数据的信息反馈方法及相关设备

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: 17864780

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017864780

Country of ref document: EP

Effective date: 20190311

NENP Non-entry into the national phase

Ref country code: DE