CN114661681A - Data synchronization method and related equipment - Google Patents

Data synchronization method and related equipment Download PDF

Info

Publication number
CN114661681A
CN114661681A CN202011540821.6A CN202011540821A CN114661681A CN 114661681 A CN114661681 A CN 114661681A CN 202011540821 A CN202011540821 A CN 202011540821A CN 114661681 A CN114661681 A CN 114661681A
Authority
CN
China
Prior art keywords
electronic device
capability
metadata
electronic
capability set
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202011540821.6A
Other languages
Chinese (zh)
Inventor
王昱晨
王浩
郭玉兵
孙黎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202011540821.6A priority Critical patent/CN114661681A/en
Priority to PCT/CN2021/138557 priority patent/WO2022135244A1/en
Publication of CN114661681A publication Critical patent/CN114661681A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter

Landscapes

  • Engineering & Computer Science (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)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application provides a data synchronization method, which is applied to first electronic equipment, wherein the first electronic equipment is in communication connection with second electronic equipment, the first electronic equipment and the second electronic equipment store respective equipment capability sets, and metadata comprising capability fields are also stored in the first electronic equipment, and the method comprises the following steps: acquiring a device capability set of a second electronic device; determining metadata to be synchronized in a first electronic device; and if the metadata to be synchronized is matched with the equipment capability set of the second electronic equipment, synchronizing the metadata to be synchronized to the second electronic equipment. The application also provides a computer readable storage medium, an electronic device and a chip system. According to the method and the device, data synchronization can be performed according to software and hardware capabilities of the electronic equipment, and network bandwidth and storage space consumed by data synchronization are saved.

Description

Data synchronization method and related equipment
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a data synchronization method and a related device.
Background
Users often use different types of terminal devices (e.g., mobile phones, tablets, car machines, smart watches, large screens, hand rings, notebook computers, smart speakers) for data storage. In order to realize data sharing between different terminal devices, data synchronization between different terminal devices is required. However, different types of terminal devices have different functions. For example, the speaker may be used to play audio files, the large screen may be used to play video files, browse pictures, the watch and the bracelet may be used to view sports health information, notepads, and important matter reminders. Therefore, when data synchronization is performed between different terminal devices, the data/files synchronized from other devices are easily unavailable on the device, which causes waste of network bandwidth and storage space.
Disclosure of Invention
The embodiment of the application discloses a data synchronization method and related equipment, which can perform data synchronization according to the software and hardware capabilities of electronic equipment, and save network bandwidth and storage space consumed by data synchronization.
A first aspect of the present application discloses a data synchronization method, which is applied to a first electronic device, where the first electronic device is in communication connection with a second electronic device, the first electronic device stores a device capability set of the first electronic device and metadata of a local file, the metadata includes a capability field, the second electronic device stores a device capability set of the second electronic device, the device capability set of the first electronic device represents software and hardware capabilities that the first electronic device has, the device capability set of the second electronic device represents software and hardware capabilities that the second electronic device has, and the capability field in the metadata represents software and hardware capabilities required for file usage, where the method includes: acquiring a device capability set of a second electronic device; determining metadata to be synchronized in a first electronic device; and if the metadata to be synchronized is matched with the equipment capability set of the second electronic equipment, synchronizing the metadata to be synchronized to the second electronic equipment.
According to the method and the device, a differentiated synchronization strategy is adopted among different devices, and the metadata are synchronized according to the device capacity. When the second electronic equipment has the software and hardware capabilities required by file use, the first electronic equipment synchronizes the metadata of the local file to the second electronic equipment. Compared with a full-amount synchronization strategy of metadata, the method and the device can effectively reduce the network bandwidth required by metadata synchronization and save the storage space of the electronic equipment.
In some optional embodiments, obtaining the device capability set of the second electronic device comprises: sending a device capability query request to the second electronic device, wherein the device capability query request is used for querying the device capability of the second electronic device; receiving a device capability set of the second electronic device returned by the second electronic device, wherein the device capability set of the second electronic device is returned to the first electronic device by the second electronic device after receiving the device capability query request; or receiving a device capability set of the second electronic device sent by the second electronic device, wherein the device capability set of the second electronic device is sent to the first electronic device after the second electronic device adds the new capability, and the device capability set of the second electronic device comprises a capability field corresponding to the new capability; or reading a device capability set of the second electronic device stored locally by the first electronic device.
In some optional embodiments, reading a device capability set of the second electronic device stored locally by the first electronic device comprises: and if the first electronic equipment locally stores the equipment capability set of the second electronic equipment and the equipment capability set of the second electronic equipment locally stored by the first electronic equipment meets the timeliness requirement, reading the equipment capability set of the second electronic equipment locally stored by the first electronic equipment.
In some optional embodiments, sending the device capability query request to the second electronic device comprises: when the first connection is made with a second electronic device, sending a device capability query request to the second electronic device; or when a certain synchronous trigger condition is met, sending a device capability query request to the second electronic device.
In some optional embodiments, satisfying a certain synchronization trigger condition includes: adding or modifying a local file of the first electronic equipment; or receiving a synchronization instruction; or a preset synchronization time is reached.
In some optional embodiments, before sending the device capability query request to the second electronic device when a certain synchronization trigger condition is met, the method further includes: judging whether the first electronic equipment locally stores an equipment capability set of the second electronic equipment; if the first electronic equipment does not locally store the equipment capability set of the second electronic equipment, sending an equipment capability query request to the second electronic equipment; or if the first electronic device locally stores the device capability set of the second electronic device, but the device capability set of the second electronic device locally stored by the first electronic device does not meet the timeliness requirement, sending a device capability query request to the second electronic device.
By judging whether the equipment capability set of the second electronic equipment locally stored by the first electronic equipment meets the timeliness requirement or not, unnecessary communication between the first electronic equipment and the second electronic equipment can be avoided, and network bandwidth consumed by the first electronic equipment and the second electronic equipment is saved.
In some optional embodiments, the first electronic device locally stores a device capability set of the second electronic device, a version number corresponding to the device capability set of the second electronic device, and a storage time; the first electronic device locally storing a device capability set of a second electronic device that does not meet the timeliness requirements includes: the difference value between the current time and the storage time of the first electronic equipment is greater than or equal to a preset time threshold value; or the version number of the device capability set of the second electronic device stored locally by the first electronic device is inconsistent with the latest version number of the device capability set of the second electronic device.
In some optional embodiments, determining metadata to be synchronized in the first electronic device comprises: if the local file of the first electronic device is newly added or modified, determining the metadata of the newly added or modified local file as metadata to be synchronized; or if a synchronization instruction aiming at the specific file is received, determining the metadata of the specific file as metadata to be synchronized; or if the preset synchronization time is reached, determining the metadata of all local files in the first electronic equipment as the metadata to be synchronized, or determining the metadata of the local files newly added or modified in the first electronic equipment as the metadata to be synchronized; or determining the metadata of the local file of the first electronic device matched with the device capability set of the second electronic device as the metadata to be synchronized.
In some optional embodiments, after synchronizing the metadata from the first electronic device to the second electronic device, the method further comprises: receiving a file operation request from the second electronic equipment, wherein the file operation request carries metadata; and operating the file corresponding to the metadata on the first electronic equipment according to the metadata carried by the file operation request.
In some alternative embodiments, the metadata to be synchronized matches the device capability set of the second electronic device as: the capability fields of the metadata to be synchronized are all contained in the device capability set of the second electronic device.
In some optional embodiments, the method further comprises: receiving a device capability set of a second electronic device sent by the second electronic device, wherein the device capability set of the second electronic device is sent to the first electronic device after the second electronic device reduces the capability, and the device capability set of the second electronic device does not contain a capability field corresponding to the reduced capability; and updating the device capability set of the second electronic device locally stored by the first electronic device according to the received device capability set of the second electronic device.
In some optional embodiments, after synchronizing the metadata to be synchronized to the second electronic device, the method further comprises: and synchronizing the file corresponding to the metadata to be synchronized from the first electronic equipment to the second electronic equipment.
By synchronizing the file corresponding to the metadata to the second electronic device, even if the network is abnormal, the second electronic device can operate the file corresponding to the metadata, and the reliability of data sharing among devices is improved.
In some optional embodiments, after synchronizing the metadata to be synchronized to the second electronic device, the method further comprises: receiving a file operation request sent by second electronic equipment, wherein the file operation request carries metadata to be synchronized; and operating the file corresponding to the metadata to be synchronized on the first electronic equipment according to the metadata to be synchronized carried by the file operation request.
The second aspect of the present application discloses a data synchronization method, which is applied to a second electronic device, where the second electronic device is in communication connection with the first electronic device, the first electronic device stores a device capability set of the first electronic device and metadata of a file, the metadata includes a capability field, the capability field is used to indicate software and hardware capabilities required for using the file, the second electronic device stores a device capability set of the second electronic device, the device capability set of the first electronic device is used to indicate software and hardware capabilities that the first electronic device has, and the device capability set of the second electronic device is used to indicate software and hardware capabilities that the second electronic device has, the method includes: and sending the device capability set of the second electronic device to the first electronic device, so that the first electronic device synchronizes the metadata to be synchronized to the second electronic device when the metadata to be synchronized is matched with the device capability set of the second electronic device.
In some optional embodiments, sending the set of device capabilities of the second electronic device to the first electronic device comprises: if receiving an equipment capability query request sent by second electronic equipment, sending an equipment capability set of the second electronic equipment to the first electronic equipment; or if the second electronic device adds the capability, adding a capability field corresponding to the newly added capability in the device capability set of the second electronic device, and sending the device capability set of the second electronic device or the capability field corresponding to the newly added capability after the capability field is added to the first electronic device.
In some optional embodiments, the device capability set of the second electronic device sent to the first electronic device by the second electronic device comprises a version number.
In some optional embodiments, the method further comprises: if the second electronic device reduces the capability, deleting a capability field corresponding to the reduced capability in the device capability set of the second electronic device; sending the equipment capability set of the second electronic equipment or the capability field corresponding to the reduced capability after the capability field is deleted to the first electronic equipment; searching the metadata matched with the deleted capability field in the second electronic equipment; and deleting the metadata matched with the deleted capability field in the second electronic equipment.
A third aspect of the application discloses a computer-readable storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the data synchronization method of the first aspect.
A fourth aspect of the present application discloses an electronic device, which includes a processor and a memory, the memory being configured to store instructions, and the processor being configured to invoke the instructions in the memory, so that the electronic device performs the data synchronization method according to the first aspect or the second aspect.
A fifth aspect of the present application discloses a chip system, which is applied to an electronic device; the chip system comprises an interface circuit and a processor; the interface circuit and the processor are interconnected through a line; the interface circuit is used for receiving signals from a memory of the electronic equipment and sending signals to the processor, and the signals comprise computer instructions stored in the memory; when the processor executes the computer instructions, the system-on-chip performs a data synchronization method as in the first aspect or the second aspect.
It should be understood that the computer-readable storage medium of the third aspect, the electronic device of the fourth aspect, and the chip system of the fifth aspect all correspond to the methods of the first aspect and the second aspect, and therefore, the beneficial effects achieved by the computer-readable storage medium of the third aspect can refer to the beneficial effects in the corresponding methods provided above, and are not repeated herein.
Drawings
Fig. 1 is a schematic application scenario diagram of a data synchronization method disclosed in an embodiment of the present application.
FIG. 2 is a schematic diagram of synchronizing metadata from a first electronic device to a second electronic device according to the data synchronization method of the present application.
Fig. 3 is a flowchart of a data synchronization method disclosed in an embodiment of the present application.
Fig. 4 is a flowchart of a data synchronization method disclosed in an embodiment of the present application when the capability of the second electronic device is increased.
Fig. 5 is a flowchart of a data synchronization method disclosed in an embodiment of the present application when the capability of the second electronic device is reduced.
Fig. 6 is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.
Detailed Description
For ease of understanding, some descriptions of concepts related to the embodiments of the present application are given by way of illustration and reference.
In the present application, "at least one" means one or more, "and" a plurality "means two or more. "and/or" describes the association relationship of the associated object, indicating that there may be three relationships, for example, a and/or B may represent: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The terms "first," "second," "third," "fourth," and the like in the description and in the claims and drawings of the present application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
In order to better understand the data synchronization method and the related device disclosed in the embodiments of the present application, first, an application scenario of the data synchronization method of the present application is described below.
Fig. 1 is a schematic application scenario diagram of a data synchronization method disclosed in an embodiment of the present application. As shown in fig. 1, a plurality of electronic devices 10 are communicatively connected through a network. The electronic device 10 (e.g., a mobile phone) synchronizes metadata of a local file to other electronic devices (e.g., a smart watch) having software and hardware capabilities according to the software and hardware capabilities required for file usage, so as to prevent data synchronized to the other electronic devices from being unavailable on the other electronic devices. The software and hardware capabilities required for file use refer to the software and hardware requirements of the device during use of the file, for example, the hardware capabilities required for audio file use include speaker software, and the software capabilities required include an audio player.
The electronic device 10 may be a mobile phone, a tablet computer, a car machine, an intelligent watch, a large screen, an intelligent bracelet, a notebook computer, an intelligent sound box, a vehicle-mounted computer, or the like. As shown in fig. 1, the electronic device 10 includes a mobile phone, a smart watch, a smart speaker, and a large screen.
The metadata of the file is used to record attribute information of the file, such as file name, file size, file location, last modification time, and the like. Before a file is operated (e.g., read, edited), file position information of the file needs to be obtained, the file is located to the position of the file according to the file position information, and the content of the file is obtained from the position. Other electronic devices (e.g., smartwatches) may obtain file location information based on metadata synchronized from the electronic device (e.g., cell phone) and access files in the electronic device based on the file location information.
In the embodiments provided in the present application, in order to share data among a plurality of electronic devices, a network may be established for the plurality of electronic devices, and data synchronization may be performed between any two electronic devices in the network. For example, referring to fig. 1, a mobile phone may synchronize metadata of a local file to a smart watch, a smart speaker, and a large screen, the smart watch may synchronize metadata of the local file to the mobile phone, the smart speaker, and the large screen, the smart speaker may synchronize metadata of the local file to the mobile phone, the smart watch, and the large screen may synchronize metadata of the local file to the mobile phone, the smart watch, and the smart speaker, and thus data sharing of the entire network is achieved.
The network between the electronic devices 10 may be a short-range wireless communication network. For example, the electronic devices 10 may perform short-range Wireless Communication by using bluetooth, Wi-Fi (Wireless Fidelity), NFC (Near Field Communication), ZigBee (ZigBee), IrDA (Infrared Data Association), UWB (ultra wide band), Wireless USB (Universal Serial Bus), or the like.
FIG. 2 is a schematic diagram of synchronizing metadata from a first electronic device to a second electronic device according to the data synchronization method of the present application. In this embodiment, a mobile phone is taken as the first electronic device, and a smart watch is taken as the second electronic device for example.
Referring to fig. 2, a cell phone (first electronic device) and a smart watch (second electronic device) may include a device capability storage area for storing a set of device capabilities. The device capability set may be stored in a database or in a common file. The first electronic device and the second electronic device initially store their own set of device capabilities. The device capability set includes a capability field to indicate the hardware and software capabilities that the electronic device has. For example, the set of capabilities of the mobile phone (i.e., the set of device capabilities of the mobile phone) represents the hardware and software capabilities of the mobile phone, and the set of capabilities of the watch (i.e., the set of device capabilities of the smart watch) represents the hardware and software capabilities of the smart watch. According to fig. 2, the handset capability set is { "audio player", "video player", "document editor", "speaker", "screen" … … }, where "audio player", "video player", "document editor", "speaker", "screen" are capability fields indicating the handset's hardware and software capabilities including audio player, video player, document editor, speaker, screen, etc. The watch capability set is { "audio player", "speaker", "screen" … … }, where "audio player", "speaker", "screen" are capability fields indicating the hardware and software capabilities of the handset including audio player, speaker, screen, etc.
The first electronic device and the second electronic device may further include a metadata storage area for storing metadata of the file. The metadata of the files stored by the first electronic device and the second electronic device includes metadata of the local file before data synchronization, and the metadata of the files stored by the first electronic device and the second electronic device includes metadata of the local file and metadata obtained by synchronization (i.e., metadata of the remote file) after data synchronization. The metadata may be stored in a database or in a common file. In order to distinguish between the metadata of the local file and the metadata of the remote file, two metadata storage areas may be provided for the first electronic device/the second electronic device for storing the metadata of the local file and the remote file. For example, a first metadata storage area for storing metadata of a local file and a second metadata storage area for storing metadata of a remote file may be provided for the first electronic device/the second electronic device. Alternatively, a file source identifier may be added to the metadata to mark whether the metadata corresponds to the local file or the remote file, and the metadata of the local file and the metadata of the remote file are stored in the same metadata storage area.
The metadata of the first electronic device and the second electronic device includes a capability field for indicating software and hardware capabilities required for file usage. For example, the metadata of the local file of the cell phone includes metadata a1, metadata a2, and metadata A3, the capability field corresponding to metadata a1 (e.g., metadata of a document file) is "document editor", the capability field corresponding to metadata a2 (e.g., metadata of an audio file a. mp3) is "speaker", "audio player", and the capability field corresponding to metadata A3 (e.g., metadata of a video file) is "video player", "screen".
The first electronic device and the second electronic device may further include a synchronization folder (not shown in the figure) for storing a file (i.e., a sharable file) corresponding to the metadata.
Referring to fig. 2, before data synchronization, device capability storage areas of a first electronic device (e.g., a cell phone) and a second electronic device (e.g., a smart watch) store respective sets of device capabilities (e.g., a device capability storage area of the cell phone stores a set of cell phone capabilities, a device capability storage area of the smart watch stores a set of watch capabilities), and a metadata storage area of the first electronic device stores metadata (e.g., metadata a1, metadata a2, metadata A3) of a plurality of local files. If data synchronization needs to be performed on the second electronic device (for example, when the first electronic device is connected with the second electronic device for the first time or at a periodic preset time), the first electronic device sends a device capability query request to the second electronic device. In response to the device capability query request, the second electronic device returns the query result (i.e., the device capability set of the second electronic device, such as the watch capability set) to the first electronic device, and the first electronic device stores the device capability set of the second electronic device (e.g., the watch capability set) locally (i.e., to the device capability storage area of the first electronic device). The first electronic device synchronizes metadata (e.g., metadata a2) of the local file that matches the device capability set of the second electronic device to the second electronic device based on the capability fields in the locally stored device capability set of the second electronic device (e.g., watch capability set) and the capability fields in the metadata of the local file (e.g., metadata a2 in the figure).
Fig. 3 is a flowchart of a data synchronization method disclosed in an embodiment of the present application. The data synchronization method is applied to a first electronic device and a second electronic device which are connected in a communication mode and used for synchronizing the metadata of the local file from the first electronic device to the second electronic device. The data synchronization method specifically comprises the following steps:
301, the first electronic device sends a device capability query request to the second electronic device.
For example, referring to fig. 2, the first electronic device is a mobile phone, the second electronic device is a smart watch, and the mobile phone sends a device capability query request to the smart watch.
Specifically, the first electronic device may send a device capability query request to the second electronic device when the first electronic device is connected to the second electronic device for the first time. For example, the mobile phone sends a device capability query request to the smart watch when first connecting with the smart watch.
The first electronic device may search for the second electronic device, and if the second electronic device is found, the first electronic device connects to the second electronic device and sends a device capability query request to the second electronic device.
The first electronic device can search for the second electronic device through Bluetooth, infrared rays and the like, and if the second electronic device is searched, the first electronic device is connected with the second electronic device.
In response to the device capability query request, the second electronic device returns a set of device capabilities of the second electronic device to the first electronic device 302.
For example, referring to fig. 2, after receiving a device query request from a mobile phone, the smart watch returns a device capability set (i.e., a watch capability set) of the smart watch to the first electronic device.
303, the first electronic device stores locally the set of device capabilities of the second electronic device.
For example, referring to fig. 2, the mobile phone (first electronic device) and the smart watch (second electronic device) include device capability storage areas, and after receiving the device capability set (i.e., watch capability set) returned by the smart watch, the mobile phone stores the device capability set of the smart watch into the device capability storage area of the mobile phone.
In one embodiment of the present application, the first electronic device may record a storage time of the device capability set of the second electronic device each time the device capability set of the second electronic device is stored.
In one embodiment of the present application, the device capability set may have a version number, and the first electronic device may locally store the device capability set of the second electronic device and the corresponding version number each time the device capability set of the second electronic device is stored.
The first electronic device retrieves from the metadata of the local file metadata matching the device capability set of the second electronic device 304.
When a first electronic device synchronizes data to a second electronic device for the first time, the metadata to be synchronized in the first electronic device may be all metadata that match the device capability set of the second electronic device.
The metadata matches the device capability set of the second electronic device if the capability fields of the metadata are all contained in the device capability set of the second electronic device.
The first electronic device may compare the capability field of the metadata of each local file of the first electronic device to a device capability set of the second electronic device stored locally at the first electronic device to determine whether the metadata of each local file matches the device capability set of the second electronic device.
For example, referring to fig. 2, the metadata of the local file of the mobile phone (first electronic device) includes metadata a1, metadata a2, and metadata A3, the capability field of metadata a1 (e.g., metadata of a document file) is "document editor", the capability field of metadata a2 (e.g., metadata of an audio file a. mp3) is "speaker", "audio player", and the capability field of metadata A3 (e.g., metadata of a video file) is "video player", "screen". The cell phone compares the capability field "document editor" of metadata a1, the capability field "speaker" of metadata a2, the "audio player" of metadata A3, the "video player" of the capability field "screen" of metadata A3, respectively, with the device capability set { "audio player", "speaker", "screen" … … } of the smart watch. The capability fields "speaker", "audio player" of metadata a2 are all contained in the device capability set { "audio player", "speaker", "screen" … … } of the smart watch, and thus, metadata a2 matches the device capability set of the smart watch.
The first electronic device synchronizes 305 metadata matching the device capability set of the second electronic device to the second electronic device.
For example, referring to fig. 2, the capability fields "speaker", "audio player" of metadata a2 of the local file of the watch (first electronic device) matches the device capability set { "audio player", "speaker", "screen" … … } of the smart watch (second electronic device), and the cell phone synchronizes metadata a2 to the smart watch.
And if the metadata of the local file of the first electronic equipment is matched with the equipment capability set of the second electronic equipment, the second electronic equipment is indicated to have the software and hardware capability of using the local file of the first electronic equipment. For example, the capability field of metadata a2 is "speaker", "audio player" matching the device capability set { "audio player", "speaker", "screen" … … } of the second electronic device, indicating that the second electronic device has the required software and hardware capabilities to use the file corresponding to metadata a 2.
301 to 305 describe the process of a first electronic device initially synchronizing metadata to a second electronic device. The following describes a process of the first electronic device performing data synchronization again to the second electronic device when a certain synchronization trigger condition is satisfied.
And 306, when a certain synchronization triggering condition is met, the first electronic device judges whether the locally stored device capability set of the second electronic device meets the timeliness requirement.
In an embodiment of the application, a synchronization folder is set in the first electronic device, and the first electronic device determines whether a file in the synchronization folder is newly added or modified, and if the file in the synchronization folder is newly added or modified, the synchronization triggering condition is satisfied. For example, if a user adds or modifies a file in the synchronization folder and saves the file, the first electronic device is triggered to perform data synchronization when a data trigger condition is satisfied. The first electronic device may detect whether the file in the synchronization folder is newly added or modified in real time or periodically (e.g., every preset period, such as every day, every hour, or other preset periods).
In another embodiment of the present application, the first electronic device may detect whether a synchronization instruction of a user is received, and determine that a synchronization trigger condition is satisfied if the synchronization instruction of the user is received. For example, after a user presses a file on a touch screen of first electronic equipment for a long time, a shortcut menu of "synchronize to second electronic equipment" is displayed, and if the user selects the shortcut menu of "synchronize to second electronic equipment", the first electronic equipment receives a synchronization instruction and determines that a synchronization trigger condition is met.
In another embodiment of the present application, the first electronic device determines whether a preset synchronization time is reached, and if the preset synchronization time is reached, the synchronization triggering condition is satisfied. For example, a synchronization period may be set for the first electronic device, triggering data synchronization when the synchronization time arrives.
In an embodiment of the present application, the first electronic device may determine, according to a storage time of the locally stored device capability set of the second electronic device, whether the locally stored device capability set of the second electronic device meets the timeliness requirement. As described above, the first electronic device may record the storage time of the device capability set of the second electronic device each time the device capability set of the second electronic device is stored, and may determine whether the timeliness requirement is satisfied according to the recorded storage time. For example, it may be determined whether a difference between a current time of the first electronic device and a storage time at which the first electronic device locally stores the device capability set of the second electronic device is greater than or equal to a preset time threshold (e.g., 2 hours); and if the difference value between the current time of the first electronic equipment and the storage time of the equipment capacity set of the second electronic equipment locally stored by the first electronic equipment is greater than or equal to the preset time threshold, the equipment capacity set of the second electronic equipment locally stored by the first electronic equipment does not meet the timeliness requirement. Otherwise, if the difference value between the current time of the first electronic device and the storage time of the device capability set of the second electronic device stored locally is smaller than the preset time threshold, the device capability set of the second electronic device stored locally by the first electronic device meets the timeliness requirement. It should be noted that, if the first electronic device stores the device capability set of the second electronic device for too many times, the latest storage time is used for the determination.
In another embodiment of the present application, the first electronic device may determine whether the locally stored device capability set of the second electronic device meets the timeliness requirement according to the version number of the locally stored device capability set of the second electronic device of the first electronic device. As described above, when the first electronic device stores the device capability set of the second electronic device, the version number of the device capability set may also be stored, and whether the timeliness requirement is met may be determined according to the version number of the device capability set. For example, it may be determined whether a version number of a device capability set of the second electronic device locally stored by the first electronic device is consistent with a latest version number of the device capability set of the second electronic device; and if the version number of the device capability set of the second electronic device locally stored by the first electronic device is inconsistent with the latest version number of the device capability set of the second electronic device, the device capability set of the second electronic device locally stored by the first electronic device does not meet the timeliness requirement. Otherwise, if the version number of the device capability set of the second electronic device locally stored by the first electronic device is consistent with the latest version number of the device capability set of the second electronic device, the device capability set of the second electronic device locally stored by the first electronic device meets the timeliness requirement. The second electronic device may upload the latest version number of the device capability set of the second electronic device to the server, and the first electronic device obtains the latest version number from the server, and performs comparison and determination. Alternatively, the first electronic device may send a device capability version number request to the second electronic device, and receive the latest version number returned by the second electronic device in response to the device capability version number request.
In step 306, when a certain synchronization triggering condition is satisfied, the first electronic device may first determine whether a device capability set of the second electronic device is stored locally, and when the first electronic device does not store the device capability set of the second electronic device (for example, when the first electronic device is connected to the second electronic device for the first time, the capability set synchronization is not performed, or the capability set synchronization fails, so that the device capability set of the second electronic device is not stored in the first electronic device), the first electronic device may send a device capability query request to the second electronic device; when the first electronic device stores the device capability set of the second electronic device, the first electronic device then determines whether the locally stored device capability set of the second electronic device meets the timeliness requirement.
And if the device capability set of the second electronic device locally stored by the first electronic device meets the timeliness requirement, reading the device capability set of the second electronic device locally stored by the first electronic device and executing 310 and 311. Otherwise, 307 is performed.
307, if the device capability set of the second electronic device stored locally by the first electronic device does not meet the timeliness requirement, the first electronic device sends a device capability query request to the second electronic device.
For example, the first electronic device is a mobile phone, the second electronic device is a smart watch, the device capability set of the second electronic device stored in the mobile phone does not meet the timeliness requirement, and the mobile phone sends a device capability query request to the smart watch.
In response to the device capability query request, the second electronic device returns the set of device capabilities of the second electronic device to the first electronic device 308.
For example, the first electronic device is a mobile phone, the second electronic device is a smart watch, and the smart watch returns a device capability set (i.e., a watch capability set) of the smart watch to the first electronic device after receiving a device query request from the mobile phone.
And 309, the first electronic equipment updates the locally stored equipment capability set of the second electronic equipment according to the equipment capability set of the second electronic equipment returned by the second electronic equipment.
For example, the first electronic device locally stores the device capability set of the second electronic device with version 1.0, the second electronic device returns the device capability set of the second electronic device with version 1.1 to the first electronic device in 308, and the first electronic device updates the device capability set of the second electronic device, which is locally stored, to version 1.1.
It should be understood that if, in step 306, when a certain synchronization trigger condition is satisfied, the first electronic device does not locally store the device capability set of the second electronic device, the first electronic device directly stores the device capability set of the second electronic device returned by the second electronic device to the local.
When the locally stored device capability set of the second electronic device is updated according to the device capability set of the second electronic device returned by the second electronic device (or the device capability set of the second electronic device returned by the second electronic device is directly stored locally), the first electronic device records the storage time of the device capability set of the second electronic device and stores the version number corresponding to the device capability set of the second electronic device.
The first electronic device determines the metadata to be synchronized in the first electronic device and determines if the metadata to be synchronized matches the device capability set of the second electronic device 310.
It is determined whether the metadata to be synchronized matches the device capability set of the second electronic device, i.e., whether the capability fields of the metadata to be synchronized are all contained in the device capability set of the second electronic device. And if the capability fields of the metadata to be synchronized are all contained in the device capability set of the second electronic device, matching the metadata to be synchronized with the device capability set of the second electronic device.
The first electronic device may determine metadata to be synchronized in the first electronic device according to a synchronization trigger condition. For example, if a file in the synchronization folder is newly added or modified, the metadata of the newly added or modified file is the metadata to be synchronized. For another example, if a synchronization instruction of a user for a specific file is received, the metadata of the specific file is to-be-synchronized metadata. For another example, if the preset synchronization time is reached, the metadata of all files in the synchronization folder of the first electronic device is the metadata to be synchronized, or the metadata of the file newly added or modified in the synchronization folder is the metadata to be synchronized.
If the metadata of the newly added or modified file in the synchronization folder is the metadata to be synchronized, the first electronic device judges whether the metadata of the newly added or modified file is matched with the device capability set of the second electronic device.
If the metadata to be synchronized matches the device capability set of the second electronic device, the first electronic device synchronizes the metadata to be synchronized to the second electronic device 311.
And if the metadata to be synchronized is not matched with the device capability set of the second electronic device, ending the process. And if the metadata to be synchronized is not matched with the equipment capability set of the second electronic equipment, the second electronic equipment does not have the software and hardware capability of using the file corresponding to the metadata to be synchronized, and the metadata to be synchronized is not synchronized to the second electronic equipment.
Most of the existing data synchronization methods perform full synchronization on metadata, that is, metadata of all local files on one electronic device are synchronized to another electronic device, regardless of whether the file corresponding to the metadata can be used on the other electronic device. Because different electronic devices have different functions, certain types of files cannot be used on some electronic devices, for example, a smart speaker or a smart bracelet cannot play video files, and executing full synchronization of metadata occupies a large network bandwidth and wastes storage space of the electronic devices.
In the embodiment of the application, a differentiated synchronization strategy is adopted among different devices, and metadata can be synchronized according to the device capacity. When the second electronic equipment has the software and hardware capabilities required by file use, the first electronic equipment synchronizes the metadata of the local file to the second electronic equipment. Compared with a full-amount synchronization strategy of metadata, the method and the device can effectively reduce the network bandwidth required by metadata synchronization and save the storage space of the electronic equipment.
In this embodiment, when the first electronic device performs data synchronization again, it is determined whether the locally stored device capability set of the second electronic device meets the timeliness requirement, so as to avoid unnecessary communication between the first electronic device and the second electronic device, and save the network bandwidth consumed by the first electronic device and the second electronic device.
In another embodiment of the present application, after the first electronic device synchronizes the metadata to the second electronic device, the data synchronization method further includes: the second electronic equipment sends a file operation request to the first electronic equipment, wherein the file operation request carries the metadata; and the first electronic equipment operates the file corresponding to the metadata on the first electronic equipment according to the metadata carried by the file operation request.
For example, after the cell phone (first electronic device) synchronizes metadata a2 of the audio file a.mp3 to the smart watch (second electronic device), the smart watch sends a file playing request to the cell phone, where the file playing request carries metadata a2 (corresponding to the audio file a.mp 3); the mobile phone operates the audio file a.mp3 on the mobile phone according to the metadata a2 carried by the file operation request, for example, the audio file a.mp3 is played.
After the first electronic device synchronizes the metadata to the second electronic device, the second electronic device may operate the file on the first electronic device according to the metadata synchronized to the local, for example, read the file, edit the file, thereby implementing data sharing between devices.
In another embodiment of the present application, the data synchronization method further includes: the first electronic device synchronizes the file corresponding to the metadata from the first electronic device to the second electronic device.
For example, referring to fig. 2, after synchronizing the metadata a2 to the smart watch, the cell phone also synchronizes the audio file a.mp3 corresponding to the metadata a2 to the smart watch.
By synchronizing the file corresponding to the metadata to the second electronic device, even if the network is abnormal, the second electronic device can operate the file corresponding to the metadata, and the reliability of data sharing among devices is improved.
For example, referring to fig. 2, after the mobile phone synchronizes the audio file a.mp3 corresponding to the metadata a2 to the smart watch, if the network is abnormal, the smart watch may play the locally stored audio file a.mp3 without obtaining the audio file corresponding to the metadata a 2.
In another embodiment of the present application, the data synchronization method further includes: if the metadata of the file in the first electronic device does not include the capability field, the first electronic device adds the capability field in the metadata of the file.
If the metadata of the file does not include the capability field, the first electronic device may add the capability field to the metadata of the file, so that the metadata of the file can also be synchronized by applying the data synchronization method of the present application.
Fig. 4 is a flowchart of a data synchronization method disclosed in an embodiment of the present application when the capability of the second electronic device is increased. Fig. 4 is a supplement to the flow of the data synchronization method described in fig. 3.
401, if the second electronic device adds new capabilities, the second electronic device adds a capability field corresponding to the newly added capabilities in the device capability set of the second electronic device.
The added capability of the second electronic device may include an added software capability and may also include an added hardware capability. For example, the second electronic device is a smart watch, and document editing software (e.g., WPS software) is newly installed in the smart watch, so that the smart watch adds a "document editing" field to the watch capability set { "speaker", "audio player", "screen", "microphone" }, and obtains an updated watch capability set { "speaker", "audio player", "screen", "microphone", "document editing" }.
402, the second electronic device sends the device capability set of the second electronic device to the first electronic device after the capability field is added.
For example, the smart watch sends the watch capability set { "speaker", "audio player", "screen", "microphone", "document edit" } after adding the "document edit" field to the cell phone.
In another embodiment of the present application, if the capability of the second electronic device changes (e.g., the capability is newly added), the second electronic device may send the changed part of the device capability set of the second electronic device to the first electronic device, for example, send the device capability set of the second electronic device after adding the capability field to the first electronic device.
And 403, the first electronic device updates the device capability set of the second electronic device, which is locally stored by the first electronic device, according to the device capability set of the second electronic device after the capability field is added.
When the device capability set of the second electronic device locally stored by the first electronic device is updated according to the device capability set of the second electronic device to which the capability field is added, the first electronic device records the update/storage time of the device capability set of the second electronic device, and stores the version number corresponding to the device capability set of the second electronic device to which the capability field is added.
The first electronic device searches the metadata of the local file for metadata that matches the updated device capability set of the second electronic device 404.
For example, after the mobile phone updates the locally stored watch capability set, metadata matching the updated watch capability set is searched for in the metadata of the local file of the mobile phone.
The first electronic device synchronizes the matched metadata to the second electronic device 405.
For example, the cell phone synchronizes the found metadata that matches the updated watch capability set to the smart watch.
When the capability of the second electronic device is increased, more metadata matched with the updated device capability set of the second electronic device can be found from the metadata of the local file, and all metadata matched with the updated device capability set of the second electronic device are synchronized to the metadata of the second electronic device.
It should be noted that, the first electronic device may further determine that metadata in the matched metadata is not synchronized to the metadata of the second electronic device, and synchronize the metadata in the matched metadata that is not synchronized to the metadata of the second electronic device, thereby further reducing network bandwidth consumed by data synchronization.
Fig. 5 is a flowchart of a data synchronization method disclosed in an embodiment of the present application when the capability of the second electronic device is reduced. Fig. 5 is a supplement to the flow of the data synchronization method described in fig. 3.
If the second electronic device reduces the capability, the second electronic device deletes the capability field corresponding to the reduced capability in the device capability set of the second electronic device 501.
The second electronic device reducing capabilities may include reducing software capabilities and may also include reducing hardware capabilities. For example, the second electronic device is a smart watch, and the watch capability set corresponding to the smart watch is originally { "speaker", "audio player", "screen", "microphone". If the audio player is deleted from the intelligent watch, deleting the field of the audio player in the watch capability set { "loudspeaker", "audio player", "screen", "microphone" } to obtain the updated watch capability set { "loudspeaker", "screen", "microphone" }.
And 502, the second electronic device sends the device capability set of the second electronic device after the capability field is deleted to the first electronic device.
For example, the smart watch sends the watch capability set { "speaker", "screen", "microphone" } after deleting the "audio player" field to the cell phone.
In another embodiment of the present application, the second electronic device may also send the reduced capability or a capability field corresponding to the reduced capability to the first electronic device.
And 503, the first electronic device updates the device capability set of the second electronic device, which is locally stored in the first electronic device, according to the device capability set of the second electronic device after the capability field is deleted.
In another embodiment of the present application, the first electronic device may update a device capability set of the second electronic device that is locally stored by the first electronic device according to the reduced capability or a capability field corresponding to the reduced capability.
When the device capability set of the second electronic device locally stored in the first electronic device is updated according to the device capability set of the second electronic device after the capability field is deleted, the first electronic device records the updating/storing time of the device capability set of the second electronic device, and stores the version number corresponding to the device capability set of the second electronic device after the capability field is deleted.
And 504, the second electronic device searches the metadata synchronized by the second electronic device for the metadata matched with the deleted capability field.
For example, the smart watch may look up the metadata "audio player" that matches the deleted capabilities field in the metadata synchronized by the smart watch, such as to find metadata a 2.
And 505, the second electronic device deletes the metadata matched with the deleted capability field in the metadata synchronized by the second electronic device.
For example, the smart watch deletes metadata a2 from the metadata synchronized by the second electronic device.
It should be noted that, in the embodiment of the present application, the restriction that the execution order of the steps 502-503 and 504-505 is not sequential may be performed synchronously.
It should be noted that, after the capability field is increased or decreased, the second electronic device may not actively send the updated device capability set to the first electronic device, or may send the device capability query request to the first electronic device after the first electronic device sends the device capability query request to the second electronic device, specifically, when the first electronic device sends the device capability query request to the second electronic device, as shown in the foregoing embodiment.
When the capability of the second electronic device is reduced, the metadata matched with the deleted capability field in the second electronic device can be searched and deleted, so that the memory can be cleaned, the storage space can be improved, and more complete data synchronization can be realized.
The above embodiments describe specific schemes for synchronizing data from a first electronic device to a second electronic device. It should be understood that, on the one hand, the first electronic device may act as a master device to synchronize data to the second electronic device, and on the other hand, the first electronic device may also act as a slave device to receive data synchronized by the second electronic device, that is, the first electronic device may also perform the operation of the second electronic device in the above-described embodiment (at this time, the second electronic device performs the operation of the first electronic device in the above-described embodiment).
For example, if a first electronic device adds a new capability, the first electronic device adds a capability field corresponding to the newly added capability in the device capability set of the first electronic device; the first electronic equipment sends the equipment capability set of the first electronic equipment added with the capability field to the second electronic equipment; the second electronic equipment updates the equipment capacity set of the first electronic equipment, which is locally stored by the second electronic equipment, according to the equipment capacity set of the first electronic equipment after the capacity field is added; the second electronic equipment searches the metadata matched with the updated equipment capability set of the first electronic equipment in the metadata synchronously obtained by the second electronic equipment; the second electronic device synchronizes the matched metadata to the first electronic device.
For another example, if the first electronic device reduces the capability, the first electronic device deletes the capability field corresponding to the reduced capability in the device capability set of the first electronic device; the first electronic equipment sends the equipment capability set of the first electronic equipment after the capability field is deleted to the second electronic equipment; the first electronic equipment updates the equipment capacity set of the second electronic equipment, which is locally stored by the first electronic equipment, according to the equipment capacity set of the second electronic equipment after the capacity field is added; the second electronic equipment updates the equipment capacity set of the first electronic equipment, which is locally stored by the second electronic equipment, according to the equipment capacity set of the first sub-equipment after the capacity field is deleted; the first electronic equipment searches the metadata matched with the deleted capability field in the metadata synchronously obtained by the first electronic equipment; and the first electronic equipment deletes the metadata matched with the deleted capability field in the metadata synchronized by the first electronic equipment.
Fig. 6 is a schematic structural diagram of an electronic device (a first electronic device or a second electronic device) disclosed in the present application. As shown in fig. 6, the electronic device 60 includes one or more processors 601 and memory 602. The processor 601, memory 602 are connected by one or more communication buses 603. The memory 602 is used to store one or more computer programs 604. One or more computer programs 604 are configured to be executed by the processor 601. The one or more computer programs 604 include instructions that can be used to perform the steps performed by the electronic device (e.g., a cell phone) in the embodiments described above to implement data synchronization functionality in the electronic device.
The present embodiment also provides a computer storage medium, where computer instructions are stored in the computer storage medium, and when the computer instructions are run on an electronic device, the electronic device is caused to execute the above related method steps to implement the data synchronization method in the above embodiments.
The present embodiment also provides a computer program product, which, when running on an electronic device, causes the electronic device to execute the above related steps to implement the data synchronization method in the above embodiments.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the data synchronization method in the above-mentioned method embodiments.
The electronic device, the computer storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, and therefore, the beneficial effects that can be achieved by the electronic device, the computer storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the module or unit is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (19)

1. A data synchronization method applied to a first electronic device, where the first electronic device is in communication connection with a second electronic device, the first electronic device stores a device capability set of the first electronic device and metadata of a local file, the metadata includes a capability field, the second electronic device stores a device capability set of the second electronic device, the device capability set of the first electronic device represents software and hardware capabilities that the first electronic device has, the device capability set of the second electronic device represents software and hardware capabilities that the second electronic device has, and the capability field in the metadata represents software and hardware capabilities that the file needs to use, the method comprising:
acquiring a device capability set of the second electronic device;
determining metadata to be synchronized in the first electronic device;
and if the metadata to be synchronized is matched with the equipment capability set of the second electronic equipment, synchronizing the metadata to be synchronized to the second electronic equipment.
2. The data synchronization method of claim 1, wherein the obtaining the set of device capabilities of the second electronic device comprises:
sending a device capability query request to the second electronic device, wherein the device capability query request is used for querying the device capability of the second electronic device;
receiving a device capability set of the second electronic device returned by the second electronic device, wherein the device capability set of the second electronic device is returned to the first electronic device by the second electronic device after receiving the device capability query request; or
Receiving a device capability set of the second electronic device sent by the second electronic device, where the device capability set of the second electronic device is sent to the first electronic device after the second electronic device adds a capability, and the device capability set of the second electronic device includes a capability field corresponding to the added capability; or
Reading a device capability set of the second electronic device stored locally by the first electronic device.
3. The data synchronization method of claim 2, wherein the reading the set of device capabilities of the second electronic device stored locally by the first electronic device comprises:
if the first electronic device locally stores the device capability set of the second electronic device and the device capability set of the second electronic device locally stored by the first electronic device meets the timeliness requirement, reading the device capability set of the second electronic device locally stored by the first electronic device.
4. The data synchronization method of claim 2, wherein the sending a device capability query request to the second electronic device comprises:
when the first connection is made with the second electronic equipment, sending the equipment capacity query request to the second electronic equipment; or alternatively
And when a certain synchronous trigger condition is met, sending the equipment capability query request to the second electronic equipment.
5. The data synchronization method of claim 4, wherein the satisfying of the certain synchronization trigger condition comprises:
adding or modifying a local file of the first electronic device; or
Receiving a synchronization instruction; or alternatively
And reaching the preset synchronous time.
6. The data synchronization method of claim 4, wherein before sending the device capability query request to the second electronic device when a certain synchronization trigger condition is satisfied, the method further comprises:
judging whether the first electronic equipment locally stores the equipment capability set of the second electronic equipment;
if the first electronic device does not locally store the device capability set of the second electronic device, sending the device capability query request to the second electronic device; or
And if the first electronic device locally stores the device capability set of the second electronic device but the device capability set of the second electronic device locally stored by the first electronic device does not meet timeliness requirements, sending the device capability query request to the second electronic device.
7. The data synchronization method according to claim 6, wherein the first electronic device locally stores the device capability set of the second electronic device, a version number corresponding to the device capability set of the second electronic device, and a storage time;
the locally stored device capability set of the second electronic device by the first electronic device not meeting timeliness requirements comprises:
the difference value between the current time of the first electronic device and the storage time is greater than or equal to a preset time threshold value; or
The version number of the device capability set of the second electronic device stored locally by the first electronic device is not consistent with the latest version number of the device capability set of the second electronic device.
8. The data synchronization method of claim 2, wherein the determining metadata to be synchronized in the first electronic device comprises:
if the local file of the first electronic device is newly added or modified, determining the metadata of the newly added or modified local file as the metadata to be synchronized; or
If a synchronization instruction aiming at a specific file is received, determining the metadata of the specific file as the metadata to be synchronized; or
If the preset synchronization time is reached, determining metadata of all local files in the first electronic device as the metadata to be synchronized, or determining metadata of a local file newly added or modified in the first electronic device as the metadata to be synchronized; or
And determining that the metadata of the local file of the first electronic equipment is matched with the equipment capability set of the second electronic equipment and is the metadata to be synchronized.
9. The data synchronization method of claim 1, wherein the metadata to be synchronized matches a device capability set of the second electronic device by:
the capability fields of the metadata to be synchronized are all contained in the device capability set of the second electronic device.
10. The data synchronization method of any one of claims 1 to 9, wherein the method further comprises:
receiving a device capability set of the second electronic device sent by the second electronic device, where the device capability set of the second electronic device is sent to the first electronic device after the second electronic device reduces the capability, and the device capability set of the second electronic device does not contain a capability field corresponding to the reduced capability;
and updating the device capability set of the second electronic device locally stored by the first electronic device according to the received device capability set of the second electronic device.
11. The data synchronization method of any of claims 1 to 9, wherein after the synchronizing the metadata to be synchronized to the second electronic device, the method further comprises:
and synchronizing the file corresponding to the metadata to be synchronized from the first electronic equipment to the second electronic equipment.
12. The data synchronization method of any of claims 1-9, wherein after synchronizing the metadata to be synchronized to the second electronic device, the method further comprises:
receiving a file operation request sent by the second electronic device, wherein the file operation request carries the metadata to be synchronized;
and operating the file corresponding to the metadata to be synchronized on the first electronic equipment according to the metadata to be synchronized carried by the file operation request.
13. A data synchronization method applied to a second electronic device, wherein the second electronic device is communicatively connected to a first electronic device, the first electronic device stores a device capability set of the first electronic device and metadata of a file, the metadata includes a capability field, the capability field is used for representing software and hardware capabilities required by file use, the second electronic device stores a device capability set of the second electronic device, the device capability set of the first electronic device is used for representing software and hardware capabilities that the first electronic device has, and the device capability set of the second electronic device is used for representing software and hardware capabilities that the second electronic device has, the method includes:
and sending the device capability set of the second electronic device to the first electronic device, so that the first electronic device synchronizes the metadata to be synchronized to the second electronic device when the metadata to be synchronized is matched with the device capability set of the second electronic device.
14. The data synchronization method of claim 13, wherein the sending the set of device capabilities of the second electronic device to the first electronic device comprises:
if receiving a device capability query request sent by the second electronic device, sending a device capability set of the second electronic device to the first electronic device; or
If the second electronic device has the newly added capability, adding a capability field corresponding to the newly added capability in the device capability set of the second electronic device, and sending the device capability set of the second electronic device or the capability field corresponding to the newly added capability after the capability field is added to the first electronic device.
15. The data synchronization method of claim 13, wherein the set of device capabilities of the second electronic device that the second electronic device sends to the first electronic device includes a version number.
16. The data synchronization method of any one of claims 13 to 15, wherein the method further comprises:
if the second electronic device reduces the capacity, deleting a capacity field corresponding to the reduced capacity in the equipment capacity set of the second electronic device;
sending the device capability set of the second electronic device or the capability field corresponding to the reduced capability after the capability field is deleted to the first electronic device;
searching the metadata matched with the deleted capability field in the second electronic equipment;
and deleting the metadata matched with the deleted capability field in the second electronic equipment.
17. A computer readable storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the data synchronization method of any of claims 1 to 12 or 13 to 16.
18. An electronic device, comprising a processor and a memory, the memory storing instructions, the processor being configured to invoke the instructions in the memory such that the electronic device performs the data synchronization method of any of claims 1 to 12 or 13 to 16.
19. A chip system is applied to electronic equipment; the chip system comprises an interface circuit and a processor; the interface circuit and the processor are interconnected through a line; the interface circuit is used for receiving signals from a memory of the electronic equipment and sending the signals to the processor, and the signals comprise computer instructions stored in the memory; when the computer instructions are executed by a processor, the system-on-chip performs the data synchronization method of any one of claims 1 to 12 or 13 to 16.
CN202011540821.6A 2020-12-23 2020-12-23 Data synchronization method and related equipment Pending CN114661681A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011540821.6A CN114661681A (en) 2020-12-23 2020-12-23 Data synchronization method and related equipment
PCT/CN2021/138557 WO2022135244A1 (en) 2020-12-23 2021-12-15 Data synchronization method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011540821.6A CN114661681A (en) 2020-12-23 2020-12-23 Data synchronization method and related equipment

Publications (1)

Publication Number Publication Date
CN114661681A true CN114661681A (en) 2022-06-24

Family

ID=82024983

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011540821.6A Pending CN114661681A (en) 2020-12-23 2020-12-23 Data synchronization method and related equipment

Country Status (2)

Country Link
CN (1) CN114661681A (en)
WO (1) WO2022135244A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701526A (en) * 2022-12-05 2023-09-05 荣耀终端有限公司 Data synchronization method and electronic equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114925140A (en) * 2022-07-21 2022-08-19 中化现代农业有限公司 Data synchronization system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103139671B (en) * 2011-11-29 2017-09-01 中兴通讯股份有限公司 The method of data synchronization and optical line terminal of Ethernet passive optical network equipment
CN103186865B (en) * 2011-12-28 2015-09-16 腾讯科技(深圳)有限公司 A kind of dissemination method of promotional content and device
CN103944709A (en) * 2014-03-26 2014-07-23 小米科技有限责任公司 Data synchronization method and device
CN107547599B (en) * 2016-06-28 2021-03-23 百度在线网络技术(北京)有限公司 Resource allocation method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701526A (en) * 2022-12-05 2023-09-05 荣耀终端有限公司 Data synchronization method and electronic equipment

Also Published As

Publication number Publication date
WO2022135244A1 (en) 2022-06-30

Similar Documents

Publication Publication Date Title
CN101065945B (en) Method and system for implementing madie content synchronization between portable media player and media host device
CN110955631B (en) File access tracking method and device, storage medium and terminal
WO2022135244A1 (en) Data synchronization method and related device
US20090132606A1 (en) Mobile device and data synchronization method thereof
CN108038231B (en) Log processing method and device, terminal equipment and storage medium
US20130297563A1 (en) Timestamp management method for data synchronization and terminal therefor
CN102223361A (en) Communication systems and data synchronization methods
US20130339296A1 (en) File synchronization method, files synchronization apparatus and electronic device
CN113656490B (en) Data synchronization method, device, terminal and storage medium
CN104167216A (en) Audio frequency file sharing method, device and sound box
CN110460660B (en) Method and device for synchronizing contact information
KR101467583B1 (en) - - - identifying changes to media-device contents
CN104038922A (en) File synchronization method and related device
CN116701413A (en) Main data processing method and device
CN115004662A (en) Data synchronization method, data synchronization device, data storage system and computer readable medium
CN116701526A (en) Data synchronization method and electronic equipment
CN115314427A (en) Protocol testing method, electronic equipment and chip system
CN111447267B (en) Information synchronization method, device, computer readable storage medium and equipment
CN110321332B (en) Multimedia file recovery method, device, terminal and storage medium
CN117251456B (en) Main key value generation method and device, electronic equipment and storage medium
KR20130050539A (en) Mobile terminal and system for providing a sound source, and method for providing a sound source
WO2024087960A1 (en) Search system and method, terminal device, and computer readable storage medium
US20230267099A1 (en) Data Management Method and Apparatus
CN110287060B (en) Data processing method and device
CN115730093A (en) Multimedia recommendation method and device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination