WO2022022546A1 - Data synchronization method and device for mobile distributed system - Google Patents

Data synchronization method and device for mobile distributed system Download PDF

Info

Publication number
WO2022022546A1
WO2022022546A1 PCT/CN2021/108814 CN2021108814W WO2022022546A1 WO 2022022546 A1 WO2022022546 A1 WO 2022022546A1 CN 2021108814 W CN2021108814 W CN 2021108814W WO 2022022546 A1 WO2022022546 A1 WO 2022022546A1
Authority
WO
WIPO (PCT)
Prior art keywords
synchronization
change
list
media asset
node
Prior art date
Application number
PCT/CN2021/108814
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2022022546A1 publication Critical patent/WO2022022546A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Definitions

  • the present application relates to the field of terminals, and more particularly, to a method and device for data synchronization in a mobile distributed system.
  • Mobile distributed system is a brand new distributed system, which is different from traditional distributed system.
  • the traditional distributed system is a master-slave mechanism, while the mobile distributed system is a peer-to-peer distributed system.
  • the system member devices are equal, and there is no master-slave relationship; the traditional distributed system requires the system member devices to be online in real time, while the Mobile distributed systems do not require member devices to be online in real time.
  • the structure and function of the mobile distributed system are different from those of the traditional distributed system, the data synchronization method of the traditional distributed system is not suitable for the mobile distributed system. Therefore, how to synchronize mobile distributed system data is an urgent problem to be solved.
  • the present application provides a method and device for data synchronization in a mobile distributed system, and the method realizes asynchronous synchronization of data between devices in a mobile distributed system.
  • a first aspect provides a method for data synchronization in a mobile distributed system, comprising: a first device sending a first query request to a second device, where the first query request is used to query whether there is media on the second device Asset change; the first device receives the first synchronization message sent by the second device, the first synchronization message is that the second device receives the first query request and determines that the first media asset is changed.
  • the first synchronization message carries the first media asset change content of the second device, and the first media asset change content includes the changed first media asset and the first media
  • the action corresponding to the asset change; the first device generates a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list.
  • the first synchronization node is used to record the information of the first data synchronization
  • the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset
  • the first device list is used to record the first data synchronization device.
  • the first device sends the first query request to the second device; after the second device receives the first query request and determines that the first media asset is changed, The first device sends the first synchronization message, and the first device generates a first synchronization record according to the first synchronization message, where the first synchronization record includes a first synchronization node, a first change list With the first device list, the asynchronous synchronization of the mobile distributed system is realized.
  • a media asset refers to files in various formats, such as audio, video, picture and other files, and the media asset may correspond to the metadata of the media asset, rather than the data of the media asset itself.
  • the file audio A, its media assets can be the metadata of the audio A (the storage location of the audio A, the size of the audio A, the owner of the audio A and other data attribute information).
  • the media asset change refers to the change of the media asset on the device, which may be a new media asset on the device, or a modification of the original media asset content on the device. If the second device has recorded audio A, the media asset change on the second device means that the second device has recorded audio A. Another example is that the second device has modified audio B, which is the original media asset of the second device. , the media asset change on the second device means that the second device modifies audio B.
  • the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node.
  • a synchronization device wherein the first synchronization node ID is used to identify the first data synchronization;
  • the first change list includes: a first change list ID and the second device's The first media asset changes content;
  • the first device list includes: the first device list ID and the device ID of the second device.
  • the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the second device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to look up the first device list; or, the first synchronization change content includes the index of the first media asset change content, and the first synchronization device includes the second device-related index. an index, where the index of the change list is used to look up the content of the first media asset change, and the index related to the second device is used to look up information related to the second device.
  • the information related to the second device may include one or more pieces of information such as the type of the second device, the name of the second device, and the storage size of the second device.
  • the method before the first device receives the first synchronization message sent by the second device, the method further includes: a media asset on the first device is changed , the first device adds a second change list, and the second change list includes the second change list ID and the content of the media asset change on the first device.
  • the second change list includes the second change list ID and the content of the media asset change on the first device.
  • the method further includes: the first device according to the first synchronization message message, generate a second synchronization record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization timestamp , one or more of the second parent synchronization node identifier, the second synchronization change content and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list, add The content of the media asset of the second device is changed; the device ID of the second device is added to the second device list.
  • the method further includes: the first device sends a second query request to the second device, where the second query request is used to query the Whether there is a media asset change on the second device; the first device receives a second synchronization message sent by the second device, where the second synchronization message is that the second device receives the second query request, and Sent to the first device after judging that there is a second media asset change, the second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed content.
  • the first device generates a third synchronization record according to the second synchronization message
  • the third synchronization record includes a third synchronization node, a third modification A list and a third device list
  • the third synchronization node includes: a third synchronization node ID, a third synchronization time stamp, a third parent synchronization node identifier, a third synchronization change content, and one or more of the third synchronization device where the third synchronization node ID is used to identify three data synchronizations
  • the third change list includes a third change list ID, and the second media asset of the second device changes content
  • the third device list includes The third device list ID, and the device ID of the second device; remove the device ID of the second device in the first device list ID.
  • the first device and the second device have performed multiple data synchronizations, only the device ID of the second device for the latest data synchronization is retained in the device list of the synchronization record, and the second device in the previous device list is deleted.
  • the device ID of the first device and the second device can quickly find the status information of the data synchronization that has been performed before, and delete the device ID of the second device in the previous device list to save The storage space of the first device.
  • the device ID in the first device list is empty, and the first device list is deleted.
  • deleting the first device list can save the storage space of the first device.
  • the first synchronization node is a root (Root) node
  • the root node and the first change list are deleted, and the root node and the root node are deleted.
  • the adjacent sync node becomes the new root node.
  • the root node is a node created when the first device performs data synchronization with other devices in the mobile distributed system for the first time.
  • deleting the root node and the first change list can save the storage space of the first device.
  • the third synchronization node is a top node, and a node between the top node and the root node is a middle node.
  • the temporary intermediate node when the data synchronization process between the first device and the second device terminates abnormally, a temporary intermediate node is created, and the temporary intermediate node includes a temporary state identifier, the temporary intermediate node is used to save the synchronization data for which data synchronization is not completed.
  • the method further includes: when the first data is synchronized, the first device receives the first hash value sent by the second device, The first hash value is obtained by the hash operation performed by the second device according to the changed content of the first media asset, and the first synchronization message includes the first hash value; the first device Perform hash calculation according to the content of the first change list to obtain a second hash value; when the first device determines that the first hash value is equal to the second hash value, the first device It is determined that the current data synchronization is successful.
  • the correctness of the data synchronization is ensured by verifying the first hash value and the second hash value.
  • a method for synchronizing data in a mobile distributed system including: a second device receiving a first query request sent by a first device, where the first query request is used to query whether the second device has changes to media assets;
  • the second device determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the first device, where the first synchronization message carries the first media of the second device Asset change content, where the first media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
  • the method before the second device receives the first query request sent by the first device, the method further includes:
  • the first media asset on the second device is changed, and the second device adds a first change list
  • the method also includes:
  • the second device sends a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
  • the second device receives the first feedback message sent by the first device, where the first feedback message is that the first device receives the third query request and determines that there is no media on the first device Sent to the second device after the asset is changed, the first feedback message is used to identify that no media asset change has occurred on the first device;
  • the second device generates a first synchronization record according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, so The first device list is used to record the first data synchronization device.
  • the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node.
  • a synchronization device wherein the first synchronization node ID is used to identify the first data synchronization;
  • the first change list includes: a first change list ID and the second device's The content of the media asset change;
  • the first device list includes: the first device list ID and the device ID of the first device.
  • the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, and the first synchronization device includes The relevant index, the index of the media asset modification content of the second device is used to find the media asset modification content of the second device, and the index related to the first device is used to search for the media asset modification content related to the first device. information.
  • the second device determining, according to the first query request, that the first media asset is changed, including: the second device according to the first query The request and the synchronization record on the second device determine that the first media asset is changed; or, the second device determines that the first media asset is changed according to the first query request and the change list on the second device.
  • the first synchronization message includes a first hash value
  • the first hash value is a change of the second device according to the first media asset The content is obtained by hashing.
  • a device in a third aspect, is provided, the device is a first device, and includes: a transceiver unit configured to send a first query request to a second device, where the first query request is used to query the second device Whether there is a media asset change;
  • the transceiver unit is further configured to receive a first synchronization message sent by the second device, where the first synchronization message is sent to the second device after receiving the first query request and judging that the first media asset has been changed. Sent by the first device, the first synchronization message carries the first media asset modification content of the second device, and the first media asset modification content includes the modified first media asset and the first media asset.
  • a processing unit configured to generate a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list, and a first device list,
  • the first synchronization node is used to record the information of the first data synchronization
  • the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset
  • the first device list is used to record the first data synchronization device.
  • the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change One or more of a synchronization device, wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: a first change list ID and the second device's The first media asset changes content; the first device list includes: the first device list ID and the device ID of the second device.
  • the first synchronization change content includes first media asset change content of the second device, and the first synchronization device includes a device ID of the second device
  • the first synchronization change content includes an index of the first change list
  • the first synchronization device includes an index of the first device list
  • the index of the change list is used to find the first change list
  • the index of the device list is used to look up the first device list
  • the first synchronization change content includes an index of the first media asset change content
  • the first synchronization device includes a connection with the second device.
  • a related index where the index of the first media asset modification content is used to search for the first media asset modification content, and the index related to the second device is used to search for information related to the second device.
  • the processing unit before the first device receives the first synchronization message sent by the second device, the media asset on the first device is changed, and the processing unit further Used for: adding a second change list, where the second change list includes the second change list ID and the content of the media asset change on the first device.
  • the processing unit is further configured to: the first device according to the first synchronization message A synchronization message to generate a second synchronization record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization One or more of a timestamp, a second parent synchronization node ID, a second synchronization change content, and a second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list , and the content of the media asset modification of the second device is added; the device ID of the second device is added to the second device list.
  • the transceiver unit is further configured to: send a second query request to the second device, where the second query request is used to query the second device whether there are any changes to the media assets;
  • the processing unit is further configured to: generate a third synchronization record according to the second synchronization message, the third synchronization record includes a third synchronization node, a third change list and a third device list, wherein the third synchronization record
  • the three synchronization nodes include a third synchronization node ID, one or more of a third synchronization timestamp, a third parent synchronization node identifier, a third synchronization change content, and a third synchronization device, wherein the third synchronization node ID Used to identify three data synchronization; the third change list includes a third change list ID, the second media asset of the second device
  • the processing unit is further configured to: remove the device ID of the second device in the first device list ID.
  • the device ID in the first device list is empty, and the processing unit deletes the first device list.
  • the first synchronization node is a root (Root) node
  • the root node and the first change list are deleted, and the root node and the root node are deleted.
  • the adjacent sync node becomes the new root node.
  • the third synchronization node is a top (Top) node, and a node between the top node and the root node is a middle (middle) node.
  • the processing unit when the data synchronization process between the first device and the second device terminates abnormally, the processing unit is further configured to: create a temporary intermediate node, so The temporary intermediate node includes a temporary state identifier, and the temporary intermediate node is used to store synchronization data for which data synchronization is not completed.
  • the transceiver unit when the first data is synchronized, is further configured to receive a first hash value sent by the second device, the first hash value The hash value is obtained by the hash operation performed by the second device according to the changed content of the first media asset, and the first synchronization message includes the first hash value;
  • the processing unit is further configured to perform hash calculation according to the content of the first change list to obtain a second hash value; when the processing unit determines that the first hash value is equal to the second hash value , the processing unit determines that the current data synchronization is successful.
  • a device where the device is a second device, comprising: a transceiver unit configured to receive a first query request sent by the first device, where the first query request is used to query the second device Whether there is a media asset change on the server; the processing unit is configured to determine, according to the first query request, that there is a first media asset change, and send a first synchronization message to the first device, where the first synchronization message carries the The content of the first media asset change of the second device, where the content of the first media asset change includes the changed first media asset and an action corresponding to the change of the first media asset.
  • the processing unit is further configured to add a first change list;
  • the transceiver unit is further used for: sending a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
  • the processing unit is further configured to:
  • a first synchronization record is generated according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization record A synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, the first device list A device for recording the first data synchronization.
  • the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node.
  • a synchronization device wherein the first synchronization node ID is used to identify the first data synchronization;
  • the first change list includes: a first change list ID and the second device's The content of the media asset change;
  • the first device list includes: the first device list ID and the device ID of the first device.
  • the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, and the first synchronization device includes The relevant index, the index of the media asset modification content of the second device is used to find the media asset modification content of the second device, and the index related to the first device is used to search for the media asset modification content related to the first device. information.
  • the processing unit is specifically configured to: determine that the first media asset is changed according to the first query request and the synchronization record on the second device; or, According to the first query request and the change list on the second device, it is determined that the first media asset is changed.
  • the first synchronization message includes a first hash value
  • the first hash value is the content changed by the processing unit according to the first media asset obtained by hashing.
  • an apparatus comprising a processor connected to a memory for storing a computer program, and the processor for executing the computer program stored in the memory to cause the The apparatus performs the method of the first aspect or any possible implementation of the first aspect, or the method of the second aspect or any possible implementation of the second aspect.
  • a computer-readable storage medium stores a computer program.
  • the computer program When the computer program is executed, the first aspect or any possible implementation manner of the first aspect is realized.
  • a chip including a processor and an interface; the processor is configured to read instructions to execute the method in the first aspect or any possible implementation manner of the first aspect, or the second aspect or the first aspect. A method in any possible implementation manner of the second aspect.
  • the chip may further include a memory in which instructions are stored, and the processor is configured to execute the instructions stored in the memory or other instructions.
  • a mobile distributed system includes a device having functions for implementing the methods and various possible designs of the above-mentioned first aspect, and various methods and various possible designs for implementing the above-mentioned second aspect. functional device.
  • FIG. 1 is a schematic structural block diagram of an operating system according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of an application scenario of an embodiment of the present application
  • FIG. 3a is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application.
  • FIG. 3b is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application.
  • FIG. 3c is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application.
  • 4a is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • FIG. 4b is a schematic block diagram of a synchronization record according to an embodiment of the present application.
  • 4c is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • 5a is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • 5b is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • Fig. 5c is a schematic block diagram of a synchronization record according to an embodiment of the present application.
  • 6a is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • 6b is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • 6c is a schematic block diagram of a synchronization record in an embodiment of the present application.
  • FIG. 7 is a schematic block diagram showing that device A and other devices have performed data synchronization and device B and other devices have performed data synchronization according to an embodiment of the present application;
  • FIG. 8 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed;
  • FIG. 9 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application
  • 11 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • FIG. 12 is a schematic block diagram of a device A in an embodiment of the present application when a media asset is changed;
  • FIG. 13 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application
  • FIG. 14 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application
  • 15 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • FIG. 16 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed;
  • 17 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application.
  • 18 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • 19 is a schematic block diagram of a stateful data synchronization structure of a mobile distributed system according to an embodiment of the present application.
  • FIG. 20 shows a schematic block diagram of an apparatus according to an embodiment of the present application.
  • FIG. 21 is a schematic structural diagram of a terminal device provided by this application.
  • OS A computer program that manages computer hardware and software resources.
  • the operating system handles basic tasks such as managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating the network, and managing the file system.
  • the operating system also provides an interface for the user to interact with the system.
  • Common operating systems include: iOS operating system, Android operating system and Microsoft Windows series operating systems, among which, iOS operating system is a handheld device operating system developed by Apple, and Android operating system is a free and open source Linux-based operating system. code for the operating system.
  • the Microsoft Windows family of operating systems is a graphical operating system based on MS-DOS, which Microsoft designed for IBM machines.
  • FIG. 1 shows a schematic block diagram of an Android operating system.
  • the Android operating system adopts a layered architecture.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication functions of the device. For example, the management of call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications that appear on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library Media Libraries
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • Database A computer software system that stores and manages data according to the data structure, and generally has basic functions such as storage, interception, security assurance, and backup.
  • the database is a warehouse for storing data. It has a large storage space and can store millions, tens of millions, and hundreds of millions of data.
  • the data in the database is stored according to certain rules, and there are many sources of data, such as travel records, consumption records, web pages browsed, messages sent, and so on.
  • Metadata is stored in the database.
  • Metadata is the data describing the data (data about data), also known as intermediary data and relay data, mainly describing the information of the data properties, such as describing the content of the data, covering Information such as scope, quality, management methods, data owners, and data provision methods are the bridge between data and data users.
  • Metadata is information about the organization of data, data domains and their relationships.
  • metadata is data about data.
  • the metadata can be various attribute information of the data, such as the name of the data, the size of the data, the data type of the data, the length of the data, the fields of the data, the location of the data, the owner of the data, and the like.
  • the data synchronization in the embodiments of the present application refers to the synchronization of metadata, that is, the attribute information of the data that is synchronously changed between devices, such as the storage location and other information, and the specific data may not be synchronized.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
  • GSM global system for mobile communications
  • CDMA code division multiple access
  • WCDMA wideband code division multiple access
  • general packet radio service general packet radio service
  • GPRS general packet radio service
  • long term evolution long term evolution
  • LTE long term evolution
  • LTE frequency division duplex frequency division duplex
  • TDD time division duplex
  • UMTS universal mobile telecommunication system
  • WiMAX worldwide interoperability for microwave access
  • 5G 5th generation
  • NR new radio
  • it can also be applied to use subsequent evolution systems, such as the sixth-generation 6G communication system, or even the more advanced seventh-generation 7G communication system.
  • the terminal equipment in the embodiments of the present application may also be referred to as: user equipment (user equipment, UE), mobile station (mobile station, MS), mobile terminal (mobile terminal, MT), access terminal, subscriber unit, subscriber station, Mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, etc.
  • user equipment user equipment
  • MS mobile station
  • MT mobile terminal
  • access terminal subscriber unit, subscriber station, Mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, etc.
  • the terminal device can be a wireless terminal or a wired terminal, and the wireless terminal can be a device that provides voice and/or other service data connectivity to the user, a handheld device with wireless connection function, or other processing device connected to a wireless modem.
  • a wireless terminal may communicate with one or more core networks via a Radio Access Network (RAN), and the wireless terminal may be a mobile terminal such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal
  • RAN Radio Access Network
  • Mobile devices which may be portable, pocket-sized, hand-held, computer-embedded, or vehicle-mounted, for example, exchange language and/or data with the wireless access network.
  • a wireless terminal may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, a connection Access Terminal, User Terminal, User Agent, User Device or User Equipment, mobile internet device (MID), wearable device, virtual reality (virtual reality) reality, VR) equipment, augmented reality (AR) equipment, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery , wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, in-vehicle equipment, wearable equipment, terminal equipment in a 5G network, or terminal equipment in a future evolved public land mobile network (public land mobile network, PLMN), etc., which are not limited in
  • a wearable device may also be referred to as a wearable smart device, which is a general term for intelligently designing daily wearable devices and developing wearable devices using wearable technology, such as glasses, Gloves, watches, clothing and shoes, etc.
  • a wearable device is a portable device that is worn directly on the body or integrated into the user's clothing or accessories. Wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction.
  • wearable smart devices include full-featured, large-scale, complete or partial functions without relying on smart phones, such as smart watches or smart glasses, and only focus on a certain type of application function, which needs to cooperate with other devices such as smart phones.
  • the terminal device may also be a terminal device in an Internet of Things (IoT) system.
  • IoT Internet of Things
  • IoT is an important part of the future development of information technology, and its main technical feature is that items pass through communication technology Connect with the network, so as to realize the intelligent network of human-machine interconnection and interconnection of things.
  • the various terminal devices described above if they are located on the vehicle (for example, placed in the vehicle or installed in the vehicle), can be considered as on-board terminal equipment.
  • the on-board terminal equipment is also called on-board unit (OBU). ).
  • the terminal device may further include a relay (relay).
  • a relay relay
  • any device capable of data communication with the base station can be regarded as a terminal device.
  • FIG. 2 shows a schematic diagram of an application scenario 100 of the embodiment of the present application.
  • a terminal device 110 a terminal device 120 , a terminal device 130 , and a terminal device 140 are included.
  • the terminal device 110, the terminal device 120, the terminal device 130 and the terminal device 140 constitute a mobile distributed system.
  • the terminal device in FIG. 2 may be a smart phone, a notebook computer, or other terminal devices such as a vehicle-mounted computer, and the terminal device included in the mobile distributed system shown in FIG. 1 may be the above-mentioned various forms of terminal devices .
  • FIG. 2 may also include more terminal devices.
  • the embodiments of the present application are not shown one by one in the drawings.
  • the mobile distributed system is distributed in a peer-to-peer structure, and the member devices of the system are equal, and there is no master-slave relationship;
  • the mobile distributed system is composed of smart terminal devices such as mobile phones, watches, TVs, car machines, and stereos. These terminal devices are member devices of the mobile distributed system;
  • the mobile distributed system is a loose system, which does not require the real-time online of system member devices;
  • the application, service, data and other resources of the mobile distributed system are scattered and deployed on different system member devices; the resources available to the system member devices include local resources and distributed resources, and each member device maintains the synchronization of system data information;
  • the online member devices can share local resources (applications, services, data and other resources of the device) to other member devices in the mobile distributed system; use of distributed resources (mobile applications, services, data and other resources of other member devices in the distributed system);
  • the user of the offline member device can still use the local resources of the offline device (such as the application, service, data and other resources of the device);
  • the re-connected member devices can share the local resources to other member devices in the mobile distributed system according to the local data resource status (the local data resource status is the change of the local data resources recorded locally).
  • the local data resource status is the change of the local data resources recorded locally.
  • other member devices of the distributed system can also share data resources to the re-online member devices according to the local data resource status of other member devices;
  • the member devices of the mobile distributed system interact through distributed middleware, wherein the distributed middleware is used to realize the interaction between the member devices of the distributed system, such as wireless network, to realize the consistency of local data resources and distributed data resources, Availability of local data resources and distributed data resources, resource availability/fault tolerance under the full state (online/offline) of member devices.
  • distributed middleware is used to realize the interaction between the member devices of the distributed system, such as wireless network, to realize the consistency of local data resources and distributed data resources, Availability of local data resources and distributed data resources, resource availability/fault tolerance under the full state (online/offline) of member devices.
  • Partition Tolerance Most distributed systems are spread across multiple subnetworks. Each subnet is called a partition. Partition fault tolerance means that there will be a loss of connection between intervals, and communication may fail.
  • Consistency means that a read followed by a write must return this value.
  • Figure 3 specifically illustrates the requirements for consistency.
  • G1 and G2 are respectively two servers of a distributed system.
  • a record in the distributed system is v0, and the user initiates a write operation to G1 to change it to v1.
  • the user's read operation will get v1, as shown in Figure 3a.
  • Availability means that as long as a user's request is received, the server must respond. The user can choose to initiate a read operation to G1 or G2. No matter which server it is, as long as it receives a request, it must tell the user whether it is v0 or v1, otherwise the availability will not be satisfied.
  • the devices included in the mobile distributed system may be movable terminal devices, and may also include fixed and immovable terminal devices.
  • the mobile distributed system can also be called a peer-to-peer distributed system according to its structural characteristics.
  • Traditional distributed systems are generally master-slave structures; traditional distributed systems consist of multiple servers; traditional distributed systems require system member devices to be online in real time. It can be seen that the mobile distributed system is different from the traditional distributed system.
  • Raft protocol is a classic distributed consensus algorithm, a strong leader-type algorithm.
  • Each node has three states: "master node”, “candidate node”, and "slave node”, which can be transformed between the three states.
  • the client can only write data from the master node and read data from the node. Its throughput is basically the throughput of the leader, and it cannot resist attacks by nodes maliciously tampering with data.
  • the Raft protocol only supports the distributed master-slave structure, supports distributed consistency and availability, supports partition fault tolerance in the connected state, and does not provide local services in the disconnected state.
  • the mobile distributed system is distributed in a peer-to-peer structure, and requires member devices to be available even when they are offline. Therefore, Raft does not meet the demands of keeping local resources available and valid when the member devices of the mobile distributed system are offline.
  • the Paxos protocol algorithm can provide different types of consensus algorithms for different occasions.
  • the Paxos protocol compares each data request to a proposal. Each proposal has an independent number.
  • the proposal will be forwarded to the submitter (Proposer) for submission.
  • the proposal must be accepted by the voting committee (Quorum) to take effect.
  • the nodes in the voting committee are called Acceptors.
  • proposers propose proposals, and the proposal information includes proposal number and proposed value; acceptors can accept the proposal after receiving it. If a proposal is accepted by a majority of the acceptors, the proposal is said to be chosen.
  • Paxos supports peer-to-peer structure distribution, but does not support asynchronous synchronization.
  • Paxos does not meet the requirements of maintaining the consistency of local data resources and the validity/fault tolerance of local data resources when the member devices of the mobile distributed system come back online.
  • the improved method of Paxos fast Paxos, multi Paxos provides a master-slave distributed system, which partially supports asynchronous synchronization (the asynchronous synchronization mentioned here refers to data synchronization not real-time synchronization), similar to Raft, does not support peer-to-peer structure distribution, does not satisfy The demand for keeping local resources available and local resources valid when the member devices of the mobile distributed system are offline, and does not consider the case of partition fault tolerance.
  • the present application proposes a method and terminal device for data synchronization of a mobile distributed system, and the method is used to realize data synchronization of a mobile distributed system.
  • the target data processed by the mobile distributed operating system data synchronization method mainly includes synchronization records.
  • the synchronization record (Synchronous recording) includes the synchronization node, the change list (Change list), and the device list (device list). Synchronization records can be stored in databases, file systems, memory, etc.
  • Synchronization node A synchronization record node is formed each time the data is synchronized in batches.
  • a synchronization record includes a synchronization node.
  • the synchronization node includes a synchronization node identifier (Identity Document, ID) (hereinafter referred to as the synchronization node ID, which is used to identify this data synchronization, which is different from data synchronization at other times), a synchronization timestamp (the occurrence time of this data synchronization), The ID of the parent synchronization node (the synchronization ID of the last data synchronization), the content changed in this synchronization, and the device to be synchronized this time.
  • ID synchronization node identifier
  • Change list record the content of each media asset change. Once generated, it cannot be changed.
  • the change of the media asset can be the change of the media asset of the device itself. For example, if device A records audio A, the change list on device A will record the device. A records audio A; the change of the media asset can also be a change of the media asset of the device that is synchronizing. For example, if device A synchronizes data with device B, and device B creates audio B, the change list on device A will record the audio B; the change list includes a change list ID and media asset change content, wherein the media asset change content includes a changed media asset and an action corresponding to the media asset change.
  • the change list ID is used to identify the current media asset change, which is different from media asset changes at other times.
  • Media assets refer to files in various formats on the device, such as audio, video, and image files.
  • Actions corresponding to media assets can be regular operation logs such as creation, modification, deletion, and movement (creation, modification, deletion, and movement are all logs), or change operation logs of extended attributes, such as modification of file size. Operational logs, or other types of logs such as changes to file access permissions.
  • the change list can also include attribute information of the changed content. For example, if the changed content is to create picture A, the changed content also includes various attribute information such as the size, format, storage path, author, and creation time of the picture A.
  • a change list is a list of recorded media asset changes that exist on each device itself, and the change list can be stored in a database, file system, memory, etc.
  • Device list record the device or node for this data synchronization.
  • the device list can include: device list ID and device ID.
  • the device list ID is used to identify the device list of this data synchronization, which is different from the device list of other time data synchronization.
  • the device ID is used to identify the device, and the device ID of different devices is different.
  • the operations performed on the synchronization record include four types of operations: top (TOP) node update, root (Root) node update, device list deletion, and temporary middle (Middle) node creation.
  • TOP node update When new data synchronization occurs, a new TOP node is created, and the original TOP node is transformed into an intermediate node.
  • the TOP node update process is specifically described below with reference to FIG. 4 .
  • a root Root node As shown in Figure 4, when device D performs batch data synchronization for the first time, a root Root node is created. When a new data synchronization occurs, a TOP node is created. The node between the TOP node and the Root node is an intermediate node.
  • this data synchronization is the first data synchronization performed by device D, and the content of synchronization is to synchronize file A on device A. Then device D creates a Root node, as shown in Figure 4a.
  • the Root node includes the following information:
  • Timestamp the first moment
  • Synchronization parent ID null; the synchronization parent ID refers to the synchronization node identifier of the adjacent last data synchronization of this data synchronization. Because this data synchronization is the first data synchronization performed by device D, the synchronization parent ID is Is empty.
  • the device to be synchronized this time the index of device A.
  • this data synchronization is the second data synchronization performed by device D, and the content of synchronization is to synchronize file B on device B. Then device D creates a new TOP node, as shown in Figure 4b.
  • the new TOP node includes the following information:
  • Timestamp second moment
  • the device to be synchronized this time the index of device B.
  • this data synchronization is the second data synchronization performed by device D, and the content of synchronization is to synchronize file C on device C. Then the device D creates a new TOP node, and the original TOP node S y is transformed into an intermediate node, as shown in Figure 4c.
  • the new TOP node includes the following information:
  • Timestamp the third moment
  • the device to be synchronized this time the index of device C.
  • the attribute information of this synchronization change content can also be recorded.
  • the change content also includes the size and format of the picture A, Storage path and other attribute information.
  • this synchronization change may be recorded in the content of the synchronization change this time, and the identification ID of the device synchronized this time may be recorded in the device synchronized this time.
  • what is recorded in the content of this synchronization change and the device to be synchronized this time can be the index of the change list and the index of the device list, and the corresponding data synchronization can be found according to the index of the change list and the index of the device list. list of changes and devices. If the content of this synchronization change is a pointer to the storage location of the change list, the pointer can point to the change list, and the device to be synchronized this time can be a pointer to the storage location of the device list, and this pointer can point to the device list.
  • the index of the content of this synchronization change can be recorded in the content of this synchronization change
  • the index related to the device of this synchronization can be recorded in the device of this synchronization
  • the index of the content of this synchronization change can be used to find this time.
  • the index related to the device to be synchronized this time is used to search for information related to the device to be synchronized this time.
  • Device List node deletion If the device in the intermediate node device list is reduced to zero, the current device list can be deleted.
  • the mobile distributed system includes device A, device B, device C, and device D.
  • Device A has performed data synchronization with other devices included in the mobile distributed system.
  • data has been synchronized.
  • a sync node, change list, and device list are created, as shown in Figure 5a, where the sync node includes:
  • the list of changes corresponding to the Root node S X includes:
  • the device list corresponding to the Root node includes:
  • the change list corresponding to the intermediate node S y includes:
  • the device list corresponding to the intermediate node S y includes:
  • Device ID Device D;
  • the list of changes corresponding to the Top node S y+1 includes:
  • the device list corresponding to the Top node S y+1 includes:
  • Device ID Device B and Device C.
  • device D needs to synchronize data with device A.
  • a new top node S y+2 will be generated in the synchronization record on device A, and the original top node S y+1 will be transformed into an intermediate node.
  • the list of changes corresponding to the Top node S y+2 includes:
  • the device list corresponding to the Top node S y+2 includes:
  • Device ID Device D.
  • the device D in the device list D y corresponding to the intermediate node S y can be deleted, as shown in FIG. This will help device A to determine the content of the previous data synchronization faster when synchronizing data with device D next time, and the information about data synchronization between device A and device D will be recorded in the change list, so delete device list D Device D in y will not have any effect on data synchronization by intermediate node Sy.
  • the device in the device list Dy is reduced to zero, and the current device list Dy can be deleted, as shown in Figure 5c.
  • Root node update The device in the root node device list is reduced to zero, the root node is deleted, and the adjacent intermediate node becomes the new root node.
  • the mobile distributed system includes device A, device B, device C, and device D.
  • Device A has performed data synchronization with other devices included in the mobile distributed system.
  • data has been synchronized.
  • a sync node, change list, and device list are created, as shown in Figure 6a, where the sync node includes:
  • the list of changes corresponding to the Root node S X includes:
  • the device list corresponding to the Root node includes:
  • Device ID Device D;
  • the change list corresponding to the intermediate node S y includes:
  • the device list corresponding to the intermediate node S y includes:
  • Device ID Device B;
  • the list of changes corresponding to the Top node S y+1 includes:
  • the device list corresponding to the Top node S y+1 includes:
  • Device ID Device C.
  • a new top node S y+2 will be generated in the synchronization record on device A, and the original top node S y+1 will be transformed into an intermediate node, and the top node
  • the list of changes corresponding to S y+2 includes:
  • the device list corresponding to the Top node S y+2 includes:
  • Device ID Device D.
  • the device D in the device list Dx corresponding to the root node Sx can be deleted, as shown in FIG. 6b.
  • the device in the device list Dx is reduced to zero, the root node Sx can be deleted, and the adjacent intermediate node Sy is the new root node, as shown in Figure 6c, where, Deleting the root node only deletes the ID of the root node, but the contents included in the root node, such as the synchronization timestamp, the synchronization parent ID, the content changed in this synchronization, and the devices synchronized this time, are still retained.
  • Temporary intermediate node creation The data synchronization process terminates abnormally, and a temporary intermediate node is created.
  • the abnormal termination of the data synchronization process can be caused by an error in the synchronization data, and the data synchronization process is terminated;
  • the TOP node that originally performed data synchronization can be marked as a temporary intermediate node.
  • the temporary intermediate node contains a temporary status identifier.
  • the temporary intermediate node is used to save the synchronization data that has not completed data synchronization. When the data synchronization is completed again After that, the temporary intermediate node can be deleted.
  • the first embodiment mainly describes how to synchronize data between device A and device B when there is no data change in device A in the mobile distributed system and data change in device B.
  • the mobile distributed system includes device A and device B, device A has performed data synchronization with other devices included in the mobile distributed system, and device B has also performed data synchronization with other devices included in the mobile distributed system.
  • FIG. 7 is a schematic block diagram showing that device A and other devices have performed data synchronization and device B and other devices have performed data synchronization according to an embodiment of the present application.
  • Root node S X the change list corresponding to the Root node S X includes: change list ID: C x ;
  • the device list corresponding to the synchronization record of the Root node includes: device list ID: D x ;
  • the change list corresponding to the intermediate node S y includes: change list ID: C y ;
  • the device list corresponding to the synchronization record of the intermediate node includes: device list ID: D y ;
  • the change list corresponding to the synchronization record of Top node S y+1 includes: change list ID: C y+1 ;
  • the device list corresponding to the synchronization record of Top node S y+1 includes: device list ID: D y+1 , device ID: device D (the device ID being device D indicates that the current data synchronization is the data of device A synchronized with device D).
  • Root node S X the change list corresponding to the Root node S X includes: change list ID: C x ; the device list corresponding to the Root node includes: device list ID: D x ;
  • the change list corresponding to the intermediate node S y includes: change list ID: C y ;
  • the device list corresponding to the intermediate node includes: device list ID: D y ;
  • the change list corresponding to Top node S y+1 includes: change list ID: C y+1 ; the device list corresponding to the synchronization record of Top node S y+1 includes: device list ID: D y+ 1.
  • FIG. 8 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed.
  • the device B can be a data change that occurs when it leaves the mobile distributed system, or it can be a data change that occurs when it is in the mobile distributed system. In the mobile distributed system, that is, device B does not leave the mobile distributed system.
  • the mobile distributed system for a distributed system, for example, a user builds a mobile distributed system in a home, the mobile distributed system includes terminal equipment 1, terminal equipment 2 and terminal equipment 3, and being located in the mobile distributed system means that the terminal equipment is located in the home.
  • FIG. 9 is a schematic flowchart of a method 200 for synchronizing data in a mobile distributed system according to an embodiment of the present application.
  • the method 200 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
  • the method is described by taking the device A (as the first device) and the device B (as the second device) as the execution subjects of the execution method as examples.
  • the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
  • the method 200 shown in FIG. 9 may include S201 to S206. Each step in the method 200 will be described in detail below with reference to FIG. 9 .
  • the media asset of the device B is changed, and the device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on the device B.
  • S202 Device A sends a first query request to device B, where the first query request is used to query whether there is a media asset change on device B.
  • the device B receives the first query request sent by the device A.
  • the device B determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the device A, where the first synchronization message carries the content of the first media asset change of the device B, and the first synchronization message carries the content of the first media asset change of the device B.
  • a media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
  • the first synchronization message includes device B downloading audio B, or the first media asset carried in the first synchronization message is changed.
  • the content is: download audio B, and the first synchronization message may also carry metadata of the content of the first media asset change, that is, the metadata of audio B.
  • the changed first media asset is audio B
  • the action corresponding to the first media asset change is download.
  • S205 Device A receives the first synchronization message sent by device B.
  • the device A generates a first synchronization record according to the first synchronization message, where the first synchronization record includes a first synchronization node, a first change list and a first device list, and the first synchronization node is used to record the first synchronization node.
  • the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset
  • the first device list is used to record the first data Synchronized devices.
  • the first data synchronization can be understood as the process of generating the first synchronization record after the device A receives the first synchronization message, which is a data synchronization.
  • a first synchronization record is generated, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list, which realizes the asynchronous synchronization of the mobile distributed system.
  • FIG. 10 is a schematic flowchart of a method 300 for data synchronization in a mobile distributed system according to an embodiment of the present application.
  • the method 300 can be applied to the scenario shown in FIG. 1 , and of course can also be applied to other scenarios. The embodiment is not limited here.
  • the method is described by taking the device A and the device B as the execution subjects of the execution method as an example.
  • the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
  • the method 300 shown in FIG. 10 may include S301 to S306. Each step in the method 300 will be described in detail below with reference to FIG. 10 .
  • the media asset of device B is changed, and device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on device B.
  • the device B sends a third query request to the device A, where the third query request is used to query whether there is a media asset change on the device A.
  • the device A receives the third query request sent by the device B.
  • the device A determines that there is no media asset change according to the third query request, and sends a first feedback message to the device B, where the first feedback message is used to inform the device B that there is no media asset change on the device A.
  • the device B receives the first feedback message sent by the device A.
  • the device B generates a first synchronization record (which can be understood as the first synchronization record on the device B) according to the first feedback message and the first synchronization message, wherein the first synchronization message is the message sent by the device B to the device B.
  • a first synchronization record (which can be understood as the first synchronization record on the device B) according to the first feedback message and the first synchronization message, wherein the first synchronization message is the message sent by the device B to the device B.
  • the first synchronization message sent by device A the first synchronization message carries the first media asset modification content of device B, and the first media asset modification content includes the modified first media asset and the first media asset modification corresponding
  • the first synchronization record includes a first synchronization node, a first change list and a first device list, the first synchronization node is used for the information of the first data synchronization; the first change list is used to record the first data synchronization
  • the media asset that has changed and the action corresponding to the change of the media asset, the first change list is the first change list newly added by device B in S301. At this time, since there is no media asset change on device A, the first change list is The update list will not add new content; the first device list is used to record the device for this data synchronization.
  • the first data synchronization can be understood as the process of generating the first synchronization record on the device B after the device B receives the first feedback message, which is a data synchronization.
  • FIG. 11 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • the device on the left is Device A
  • the first synchronization node is generated on Device A
  • the first synchronization node is the Top node
  • the original Top node Sy+ 1 becomes an intermediate node
  • the Top node includes one or more of the following information : the first synchronization node identifier S y+2 , the first synchronization timestamp at the Mth time, the first parent synchronization node identifier S y+1 , the first synchronization change content, and the first synchronization device.
  • the first synchronization change content includes the media asset change content of the device B, and the first synchronization device includes the device ID of the device B; or, the first synchronization change content includes the index of the first change list, the The first synchronization device includes an index of the device A list, the index of the change list is used to find the first change list, and the index of the device list is used to find the device A list; Or, the first synchronization change content includes the The index of the changed content of the first media asset, the first synchronization device includes an index related to the device B, the index of the change list is used to find the changed content of the first media asset, and the index related to the device B is used to find the content related to the device B. Information about the device B.
  • the information related to the device B may include one or more pieces of information such as the type of the device B, the name of the device B, and the storage size of the device B.
  • Device A creates a first changelist, the first changelist includes the first changelist ID: C y+2 , and device B downloads audio B.
  • Device A creates a first device list, and the first device list includes first device list ID: Dy+2 , device ID: device B.
  • the metadata is metadata of the audio B downloaded by the device B, such as attribute information such as the storage location of the downloaded audio B, the download time, and the size of the audio B.
  • the metadata of audio B downloaded by device B may be that when device A and device B perform data synchronization, device B transmits the metadata of audio B downloaded by device B to device A.
  • the device on the right is device B.
  • device B device A has no data update, but device B has its own media asset update, and device A synchronizes the content of device B's media asset update, and generates the first synchronization on device B.
  • the first synchronization node is the Top node
  • the original Top node Sy+ 1 becomes an intermediate node
  • the Top node includes one or more of the following information: the first synchronization node identifier Sy+ 2 , the first synchronization timestamp at the Mth time , the first parent synchronization node identifier S y+1 , the first synchronization change content and the first synchronization device.
  • Device B is in the first change list C y+2 and does not make any changes.
  • Device B creates a first device list, and the first device list includes first device list ID: Dy+2 , device ID: device A.
  • the device A and the device B perform data synchronization as an example, and the device A or the device B may also send a query message to all other online devices in the mobile distributed system.
  • the second embodiment mainly describes how to synchronize data between device A and device B when device A in the mobile distributed system has a media asset change and device B has a media asset change, and the process of device B having a media asset change can refer to the figure. 8 to understand.
  • the media assets on the device A are changed. For example, if the device A creates a picture A, the device A adds a second change list, and the second change list includes the first change list. 2.
  • FIG. 13 is a schematic flowchart of a method 400 for synchronizing data in a mobile distributed system according to an embodiment of the present application.
  • the method 400 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
  • the method is described by taking the device A and the device B as the execution subjects of the execution method as an example.
  • the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
  • the method 400 shown in FIG. 13 may include S401 to S407 . Each step in the method 400 will be described in detail below with reference to FIG. 13 .
  • the media asset of device B is changed, and device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on device B
  • the media asset of the device A is changed, and the device A adds a second modification list, and the second modification list includes the second modification list ID and the media asset modification content on the device A.
  • S401 and S402 are not limited here.
  • S403 Device A sends a first query request to device B, where the first query request is used to query whether there is a media asset change on device B.
  • the device B receives the first query request sent by the device A.
  • the device B determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the device A, where the first synchronization message carries the content of the first media asset change of the device B, and the first synchronization message carries the content of the first media asset change of the device B.
  • a media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
  • the first synchronization message carries the media asset change content of device B: download audio B
  • the first synchronization message can also carry The first media asset alters the metadata of the content.
  • S406 Device A receives the first synchronization message sent by device B.
  • the device A generates a second synchronization record according to the first synchronization message, where the second synchronization record includes a second synchronization node, a second change list and a second device list; the second synchronization node includes a second synchronization node ID, One or more of the second synchronization timestamp, the second parent synchronization node ID, the second synchronization change content, and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list , add the media asset modification content of the device B; add the device ID of the device B in the second device list.
  • Device A has previously generated a second change list due to a media asset change. Therefore, after synchronizing data with device B, device A adds the media asset change content of device B to the second change list.
  • FIG. 14 is a schematic flowchart of a method 500 for synchronizing data in a mobile distributed system according to an embodiment of the present application.
  • the method 500 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
  • the method is described by taking the device A and the device B as the execution subjects of the execution method as an example.
  • the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
  • the method 500 shown in FIG. 14 may include S501 to S505. Each step in the method 500 will be described in detail below with reference to FIG. 14 .
  • the media assets of device B are changed, and device B adds a first change list, and the first change list includes the change list ID and the content of the media asset changes on device B.
  • the media assets of device A are changed, and device A adds a second change list, and the second change list includes the second change list ID and the content of media asset changes on device A.
  • the sequence of S501 and S502 is not limited here.
  • the device B sends a fourth query request to the device A, where the fourth query request is used to query whether there is a media asset change on the device A.
  • the device A receives the fourth query request sent by the device B.
  • the device A determines that the first media asset is changed according to the fourth query request, and sends a third synchronization message to the device B, where the third synchronization message carries the content of the first media asset change of the device A, and the first media asset is changed.
  • a media asset change content includes the first media asset changed on device A and the action corresponding to the first media asset change.
  • the third synchronization message includes the media asset change content of device A: create picture A, the third synchronization message
  • the metadata of the content of the first media asset change may also be carried.
  • the device B receives the third synchronization message sent by the device A.
  • the device B generates a second synchronization record (the second synchronization record on the device B) according to the third synchronization message, and the second synchronization record includes the second synchronization node, the first change list and the second device list;
  • the second synchronization node includes a second synchronization node ID, one or more of a second synchronization timestamp, a second parent synchronization node identifier, a second synchronization change content, and a second synchronization device, and the second synchronization node ID is used for Identifies the second data synchronization; in the second modification list, adds the media asset modification content of the first device; and adds the device ID of the first device in the second device list.
  • FIG. 15 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • the device on the left is device A
  • a new synchronization node is generated on device A
  • the new synchronization node is the Top node
  • the original Top node S y+1 becomes an intermediate node
  • the Top node includes one or more of the following information : the synchronization node identifier S y+2 , the M-th time of the synchronization timestamp, the parent synchronization node identifier S y+1 , the synchronization change content and the synchronization device.
  • the device A adds the content of the media asset change of the device B in the change list C y+2 .
  • the content of the change list includes: the device A creates a picture A and the device B downloads the audio B.
  • Device A creates a device list, and the device list includes device list ID: D y+2 , device ID: device B.
  • Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
  • the device on the right is device B.
  • device A has media asset updates, and a new synchronization node is generated on device B.
  • the new synchronization node is the Top node, and the original Top node S y+1 becomes an intermediate node.
  • the node includes one or more of the following information: synchronization node identifier S y+2 , synchronization timestamp M-th time, parent synchronization node identifier S y+1 , synchronization change content and synchronization device.
  • the device B adds the content of the media asset change of the device A in the change list C y+2 .
  • the content of the change list includes: the device A creates a picture A and the device B downloads the audio B.
  • Device B creates a device list, and the device list includes device A list ID: D y+2 , device ID: device A.
  • the third embodiment mainly describes that after device A and device B in the mobile distributed system have performed data synchronization, because the media assets of device B are changed (such as when device B changes data again, such as when device B downloads audio C, Device B adds a new change list to the change list, such as adding a new change list ID: C y+3 , the content of the change list C y+3 is to download audio C, as shown in Figure 16)
  • the device How to synchronize data between A and device B.
  • FIG. 17 is a schematic flowchart of a method 600 for synchronizing data in a mobile distributed system according to an embodiment of the present application.
  • the method 600 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
  • the method is described by taking the device A and the device B as the execution subjects of the execution method as an example.
  • the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
  • the method 600 shown in FIG. 17 may include S601 to S606. Each step in the method 600 will be described in detail below with reference to FIG. 17 .
  • a media asset of the device B is changed, and the device B adds a third change list, and the third change list includes the change list ID and the content of the media asset change on the device B.
  • S602 Device A sends a second query request to device B, where the second query request is used to query whether there is a media asset change on device B.
  • the device B receives the second query request sent by the device A.
  • the device B determines that there is a second media asset change according to the second query request, and sends a second synchronization message to the device A, where the second synchronization message carries the content of the second media asset change of the device B, the first The second media asset change content includes the changed second media asset and the action corresponding to the second media asset change.
  • the second synchronization message includes device B downloading audio B, and the second synchronization message can also carry the second media asset change content. metadata.
  • S605 Device A receives the second synchronization message sent by device B.
  • S606 Device A generates a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list, where the third synchronization node includes: a third synchronization node ID, one or more of the third synchronization timestamp, the third parent synchronization node identifier, the third synchronization change content and the third synchronization device, wherein the third synchronization node ID is used to identify the three data synchronization; the third modification The list includes a third change list ID, and the second media asset of the second device changes content; the third device list includes a third device list ID, and a device ID of the second device.
  • the device A removes the device ID of the device B in the first device list ID.
  • the above method 600 describes how device A and device B have already performed data synchronization once.
  • device B will also synchronize the data of device A, but only There is no media asset update on device A, device B will generate a new synchronization record, the new synchronization record includes the new node, the third change list and the device list, device B removes the device of device A in the first device list ID ID, the specific details can refer to the process of device A, which will not be repeated here.
  • FIG. 18 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
  • the device on the left is device A
  • a third synchronization node is generated on device A
  • the third synchronization node is the Top node
  • the original Top node S y+2 becomes an intermediate node
  • the Top node includes one of the following information or Multiple: third synchronization node identification S y+3 , third synchronization timestamp M+1 th time, third parent synchronization node identification S y+2 , third synchronization change content and third synchronization device.
  • Device A creates a third changelist that includes the third changelist ID: C y+3 , and device B downloads audio C.
  • Device A creates a third device list, and the third device list includes device A list ID: Dy+3 , device ID: device B.
  • the device A removes the device ID of the device B in the first device list ID.
  • Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
  • Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
  • the device on the right is device B.
  • device A has no data update, but device B has its own media asset update, and device A synchronizes the content of device B's media asset update, and generates a new synchronization node on device B
  • the new synchronization node is the Top node
  • the original Top node S y+2 becomes an intermediate node
  • the Top node includes one or more of the following information: the synchronization node identifier S y+3 , the synchronization timestamp at the M+1th time, the parent
  • the synchronization node identifies S y+2 , synchronizes changes, and synchronizes equipment.
  • Device B creates a device list, and the device list includes device list ID: D y+3 , device ID: device A.
  • the device B removes the device ID of the device A in the fourth device list ID.
  • Device B synchronizes the metadata corresponding to the change list in the database according to the change state information of the third synchronization record.
  • the above embodiments specifically describe how the terminal device performs data synchronization in the mobile distributed system.
  • the terminal device performs data synchronization, data security needs to be considered, and the synchronized data cannot be arbitrarily tampered with.
  • the embodiment of the present application also proposes a method for data synchronization of a mobile distributed system, which realizes the block chaining and state encryption of log data, and ensures that the log data is tamper-proof.
  • the embodiments of the present application mainly implement the block chaining and state encryption of log data according to a hash algorithm, so as to ensure that the log data is tamper-proof.
  • a hash algorithm is briefly described below.
  • a hash algorithm is a mapping rule that maps a binary string of arbitrary length to a fixed-length binary string. We call it a hash algorithm, also known as a hash algorithm, and the binary value obtained after mapping the original data called the hash value.
  • the main features of the hash algorithm are:
  • the original data cannot be reversely derived from the hash value, which is one-way computational and extremely difficult to reverse;
  • FIG. 19 is a schematic block diagram of a stateful data synchronization structure of a mobile distributed system according to an embodiment of the present application.
  • the device whose data is changed will perform a hash operation on the content of each change in the change list to obtain a first hash value, and send the first hash value to the device performing data synchronization , the data synchronization device performs hash calculation according to the synchronized change list to obtain a second hash value. If the first hash value is equal to the second hash value, it means that the current data synchronization is successful, otherwise it is unsuccessful.
  • FIG. 19 A specific description will be given with reference to FIG. 19 .
  • C1 is the parent node of C2;
  • F CN Indicates the content of the change list header
  • F LN Indicates the node content of the change list, such as deleting pictures, deleting music, creating pictures, etc.;
  • the receiving node is a device for data synchronization
  • H CN Change the hash value of the list header, which is generated independently by each node and is not transmitted.
  • H LN Change the hash value of each change record in the list, apply for node generation, clear text transmission, and receive node verification;
  • the node shown in Figure 19 can be regarded as a request node, where C1 is the parent node of C2.
  • the hash value of the change list header of the parent node C1 is calculated according to formula (1):
  • H c1 HASH(F C1 ,Nouce) (1)
  • the hash value of the change record L1 is calculated according to formula (2):
  • H L1 HASH(H C1 ,F L1 ) (2)
  • the hash value of the change record L2 is calculated according to formula (3):
  • H L2 HASH(H C1 ,H L1 ,F L2 ) (3)
  • the hash value of the change record L3 is calculated according to formula (4):
  • H L3 HASH(H C1 ,H L2 ,F L3 ) (4)
  • the hash value of the change record L4 is calculated according to formula (5):
  • H L4 HASH(H C1 ,H L3 ,F L4 ) (5)
  • the hash value of the change record L5 is calculated according to formula (6):
  • H L5 HASH (H C1 , H L4 , F L5 ) (6)
  • the hash factor of each change record LN in the node C1 change list is the hash value of the header of the C1 change list, the hash value of the last change record LN -1 , and the change content of LN .
  • the hash value of the change list header of the child node C2 is calculated according to formula (7):
  • H c2 HASH(H C1 , H L5 , F C2 ) (7)
  • H L5 in the formula (7) is the last node of the C1 node.
  • the hash value of the change record L6 in the change list of the child node C2 is calculated according to formula (8):
  • H L6 HASH(H C2 ,F L6 ) (8)
  • the hash value of the change record L7 is calculated according to formula (9):
  • H L7 HASH(H C1 ,H L6 ,F L7 ) (9)
  • the hash factor of each change record LN in the node C2 change list is the hash value of the C2 change list header, the hash value of the last change record LN -1 , and the change content of LN .
  • the requesting node performs node-by-node synchronization status, synchronization content and system key hash for the synchronization data block, and the requesting node calculates the value of each data synchronization change. And pass it to the receiving node.
  • the receiving node parses the synchronized data, a protection mechanism is introduced in the change list node, and the hash is obtained through the pre-hash of the parent node and the content of the parent node. compare and if equal Indicates that the synchronization content is correct and data synchronization can be performed; if not equal to Indicates that the content of the synchronization is wrong and needs to be re-synchronized.
  • FIG. 19 can be combined with the embodiments of the present application shown in FIGS. 4 to 19 , that is, a verification mechanism is introduced during data synchronization in a distributed system to ensure the reliability and security of synchronized data. sex.
  • a method for data synchronization of a mobile distributed system according to an embodiment of the present application has been described in detail above with reference to FIG. 1 to FIG. 19 .
  • the device according to the embodiment of the present application will be described in detail with reference to FIG. 20 to FIG. 21 .
  • FIG. 20 shows a schematic block diagram of an apparatus 800 according to an embodiment of the present application.
  • the apparatus 700 may be a terminal device, or may be a chip or a circuit, for example, a chip or a circuit that can be provided in the terminal device.
  • the apparatus 700 may be an access network device, or may be a chip or a circuit, for example, a chip or a circuit that may be provided in the access network device.
  • the apparatus 700 may be a core network device, or may be a chip or a circuit, for example, a chip or a circuit that may be provided in the core network device.
  • the apparatus 700 may include a processing unit 710 (ie, an example of a processor) and a transceiver unit 730 .
  • the processing unit 710 may also be referred to as a determination unit.
  • the transceiver unit 730 may include a receiving unit and a sending unit.
  • the transceiver unit 730 may be implemented by a transceiver or a transceiver-related circuit or an interface circuit.
  • the apparatus may further include a storage unit 720 .
  • the storage unit 720 is used to store instructions.
  • the storage unit may also be used to store data or information.
  • the storage unit 720 may be implemented by a memory.
  • the processing unit 710 is configured to execute the instructions stored in the storage unit 720, so that the apparatus 700 implements the steps performed by the terminal device in the above method.
  • the processing unit 710 can be used to call the data of the storage unit 720, so that the apparatus 700 can implement the steps performed by the terminal device in the above method.
  • the processing unit 710 is configured to execute the instructions stored in the storage unit 720, so that the apparatus 700 implements the steps performed by the access network device in the above method.
  • the processing unit 710 may be configured to call the data of the storage unit 720, so that the apparatus 700 implements the steps performed by the access network device in the above method.
  • the processing unit 710, the storage unit 720, and the transceiver unit 730 can communicate with each other through an internal connection path to transmit control and/or data signals.
  • the storage unit 720 is used to store a computer program, and the processing unit 710 can be used to call and run the computer program from the storage unit 720 to control the transceiver unit 730 to receive signals and/or send signals to complete the above method. Steps for terminal equipment or access network equipment.
  • the storage unit 720 may be integrated in the processing unit 710 , or may be provided separately from the processing unit 710 .
  • the transceiver unit 730 includes a receiver and a transmitter.
  • the receiver and the transmitter may be the same or different physical entities. When they are the same physical entity, they can be collectively referred to as transceivers.
  • the transceiver unit 730 can be a sending unit or a transmitter when sending information, the transceiver unit 730 can be a receiving unit or a receiver when receiving information, and the transceiver unit can be a transceiver, the transceiver,
  • the transmitter or receiver may be a radio frequency circuit, and when the device includes a storage unit, the storage unit is used to store computer instructions, the processor is communicatively connected to the memory, and the processor executes the computer instructions stored in the memory, so that the device can perform the method 200 , method 500 or method 600 .
  • the processor may be a general-purpose central processing unit (CPU), a microprocessor, or an application specific integrated circuit (ASIC).
  • the transceiver unit 730 includes an input interface and an output interface.
  • the transceiver unit 730 may be an input and/or output interface, a pin or a circuit, or the like.
  • the processing unit 710 can execute computer-executable instructions stored in the storage unit, so that the apparatus can perform the method 200 , the method 500 or the method 600 .
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit in the terminal located outside the chip, such as a read-only memory (Read Only Memory). Only Memory, ROM) or other types of static storage devices that can store static information and instructions, random access memory (Random Access Memory, RAM), etc.
  • the function of the transceiver unit 730 can be considered to be implemented by a transceiver circuit or a dedicated chip for transceiver.
  • the processing unit 710 can be considered to be implemented by a dedicated processing chip, a processing circuit, a processing unit or a general-purpose chip.
  • a general-purpose computer may be used to implement the communication device (for example, a terminal device, or an access network device) provided in this embodiment of the present application.
  • the program codes that will implement the functions of the processing unit 710 and the transceiver unit 730 are stored in the storage unit 720 , and the general processing unit implements the functions of the processing unit 710 and the transceiver unit 730 by executing the codes in the storage unit 720 .
  • the apparatus 700 may be the first device, or a chip or circuit provided in the first device.
  • the transceiver unit 730 is configured to send a first query request to the second device, where the first query request is used to query the second device Whether there is a media asset change; the transceiver unit 730 is further configured to receive the first synchronization message sent by the second device, the first synchronization message is that the second device receives the first query request and determines that there is a Sent to the first device after the first media asset is changed, the first synchronization message carries the first media asset change content of the second device, and the first media asset change content includes the changed first media asset.
  • the action corresponding to the change of the media asset and the first media asset; the processing unit 710 is configured to generate a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first synchronization A change list and a first device list, the first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the first media assets that have been changed in the first data synchronization and the The action corresponding to the change of the first media asset, and the first device list is used to record the device for which the first data is synchronized.
  • the first synchronization node includes: one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device , wherein the first synchronization node ID is used to identify the first data synchronization;
  • the first change list includes: the first change list ID and the first media asset change content of the second device;
  • the first device list includes: the first device list ID and the device ID of the second device.
  • the first synchronization change content includes the first media asset change content of the second device, and the first synchronization device includes the device ID of the second device; or, the first synchronization change The content includes an index of the first change list, the first synchronization device includes an index of the first device list, the index of the change list is used to find the first change list, and the index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the first media asset change content, the first synchronization device includes an index related to a second device, the first media The index of the asset modification content is used to search for the first media asset modification content, and the index related to the second device is used to search for information related to the second device.
  • the processing unit 710 is further configured to: add a second change list, the second change list includes a second change list ID and media asset changes on the first device.
  • the processing unit 710 is further configured to: the first device generates a second synchronization message according to the first synchronization message record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization timestamp, the second parent synchronization node One or more of the identifier, the second synchronization change content, and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list, add the media assets of the second device Change the content; add the device ID of the second device to the second device list.
  • the transceiver unit 730 is further configured to: send a second query request to the second device, where the second query request is used to query whether there is a media asset change on the second device; receive The second synchronization message sent by the second device, where the second synchronization message is sent to the first device after the second device receives the second query request and determines that the second media asset is changed , the second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed second media asset and the action corresponding to the second media asset change;
  • the processing unit 710 is further configured to: generate a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list, wherein the third synchronization record is
  • the three synchronization nodes include a third synchronization node ID, one or more of a third synchronization timestamp, a third parent synchronization node identifier, a
  • the processing unit is further configured to: remove the device ID of the second device in the first device list ID.
  • the device ID in the first device list is empty, and the processing unit deletes the first device list.
  • the root node and the first change list are deleted, and the synchronization node adjacent to the root node becomes a new root node .
  • the third synchronization node is a top node, and a node between the top node and the root node is a middle node.
  • the processing unit 710 is further configured to: create a temporary intermediate node, where the temporary intermediate node includes a temporary state identifier, the temporary intermediate node is used to save the synchronization data for which data synchronization is not completed.
  • the transceiver unit 730 is further configured to receive a first hash value sent by the second device, where the first hash value is the second hash value Obtained from the hash operation performed by the device according to the content of the first media asset change, the first synchronization message includes the first hash value; the processing unit 710 is further configured to perform the change according to the content of the first change list Hash calculation to obtain a second hash value; when the processing unit determines that the first hash value is equal to the second hash value, the processing unit determines that the current data synchronization is successful.
  • each module or unit in the apparatus 700 can be used to perform each action or processing process performed by the device A in the above method.
  • the detailed description thereof is omitted. .
  • the apparatus 700 may be the second device, or a chip or circuit provided in the second device.
  • the transceiver unit 730 is configured to receive a first query request sent by the first device, where the first query request is used to query the second device Whether there is a media asset change on the server;
  • the processing unit 710 is configured to determine, according to the first query request, that there is a first media asset change, and send a first synchronization message to the first device, where the first synchronization message carries the The content of the first media asset change of the second device, where the content of the first media asset change includes the changed first media asset and an action corresponding to the change of the first media asset.
  • the processing unit 710 when the first media asset on the second device is changed, the processing unit 710 is further configured to add a first change list; the transceiver unit 730 is further configured to: send a message to the The first device sends a third query request, where the third query request is used to query whether there is a media asset change on the first device; and receives a first feedback message sent by the first device, where the first feedback message is Sent by the first device to the second device after receiving the third query request and judging that there is no media asset change on the first device, the first feedback message is used to identify the first No media asset change has occurred on the device; the processing unit 710 is further configured to: generate a first synchronization record according to the first feedback message and the first synchronization message, where the first synchronization record includes the first synchronization node, the first change list and the first device list, the first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the changed media in the first data synchronization
  • the first synchronization node includes: one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device , wherein the first synchronization node ID is used to identify the first data synchronization;
  • the first change list includes: the first change list ID and the content of the media asset change of the second device;
  • the first change list includes: a first device list ID and a device ID of the first device.
  • the first synchronization change content includes the media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or, in the first synchronization change content Including the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, and the index of the device list is used to find the A first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, the first synchronization device includes an index related to the first device, and the second device The index of the modified content of the media asset is used to look up the modified content of the media asset of the second device, and the index related to the first device is used to look up the information related to the first device.
  • the processing unit 710 is specifically configured to: determine that the first media asset is changed according to the first query request and the synchronization record on the second device; or, according to the first query request and the synchronization record on the second device The change list on the second device determines that the first media asset is changed.
  • the first synchronization message includes a first hash value
  • the first hash value is obtained by the processing unit performing a hash operation according to the changed content of the first media asset.
  • each module or unit in the apparatus 700 can be used to perform each action or processing process performed by the device B in the above method.
  • the detailed description thereof is omitted. .
  • FIG. 21 is a schematic structural diagram of a terminal device 800 provided by this application.
  • the terminal device 800 may perform the actions performed by the first device and the second device in the foregoing method embodiments.
  • FIG. 21 shows only the main components of the terminal device.
  • the terminal device 800 includes a processor, a memory, a control circuit, an antenna, and an input and output device.
  • the processor is mainly used to process communication protocols and communication data, and to control the entire terminal device, execute software programs, and process data of the software programs, for example, for supporting the terminal device to execute the above-mentioned transmission precoding matrix instruction method embodiment. the described action.
  • the memory is mainly used to store software programs and data, such as the codebook described in the above embodiments.
  • the control circuit is mainly used for the conversion of the baseband signal and the radio frequency signal and the processing of the radio frequency signal.
  • the control circuit together with the antenna can also be called a transceiver, which is mainly used to send and receive radio frequency signals in the form of electromagnetic waves.
  • Input and output devices such as touch screens, display screens, and keyboards, are mainly used to receive data input by users and output data to users.
  • the processor can read the software program in the storage unit, interpret and execute the instructions of the software program, and process the data of the software program.
  • the processor performs baseband processing on the data to be sent, and outputs the baseband signal to the radio frequency circuit.
  • the radio frequency circuit performs radio frequency processing on the baseband signal and sends the radio frequency signal through the antenna in the form of electromagnetic waves.
  • the radio frequency circuit receives the radio frequency signal through the antenna, converts the radio frequency signal into a baseband signal, and outputs the baseband signal to the processor, which converts the baseband signal into data and processes the data.
  • FIG. 21 only shows one memory and one processor. In an actual terminal device, there may be multiple processors and memories.
  • the memory may also be referred to as a storage medium or a storage device, etc., which is not limited in this embodiment of the present application.
  • the processor may include a baseband processor and a central processing unit.
  • the baseband processor is mainly used to process communication protocols and communication data.
  • the central processing unit is mainly used to control the entire terminal device, execute software programs, and process software programs. data.
  • the processor in FIG. 21 integrates the functions of the baseband processor and the central processing unit.
  • the baseband processor and the central processing unit may also be independent processors, interconnected by technologies such as a bus.
  • a terminal device may include multiple baseband processors to adapt to different network standards, a terminal device may include multiple central processors to enhance its processing capability, and various components of the terminal device may be connected through various buses.
  • the baseband processor may also be expressed as a baseband processing circuit or a baseband processing chip.
  • the central processing unit can also be expressed as a central processing circuit or a central processing chip.
  • the function of processing the communication protocol and communication data may be built in the processor, or may be stored in the storage unit in the form of a software program, and the processor executes the software program to realize the baseband processing function.
  • an antenna and a control circuit with a transceiver function may be regarded as the transceiver unit 810 of the terminal device 800
  • a processor with a processing function may be regarded as the processing unit 820 of the terminal device 800
  • the terminal device 800 includes a transceiver unit 810 and a processing unit 820 .
  • the transceiving unit may also be referred to as a transceiver, a transceiver, a transceiving device, or the like.
  • the device for implementing the receiving function in the transceiver unit 810 may be regarded as a receiving unit, and the device for implementing the transmitting function in the transceiver unit 810 may be regarded as a transmitting unit, that is, the transceiver unit includes a receiving unit and a transmitting unit.
  • the receiving unit may also be referred to as a receiver, a receiver, a receiving circuit, and the like
  • the transmitting unit may be referred to as a transmitter, a transmitter, or a transmitting circuit, or the like.
  • the processor may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), dedicated integrated Circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically programmable Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory may be random access memory (RAM), which acts as an external cache.
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • enhanced SDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous connection dynamic random access memory Fetch memory
  • direct memory bus random access memory direct rambus RAM, DR RAM
  • the above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above-described embodiments may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server or data center by wire (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that contains one or more sets of available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media.
  • the semiconductor medium may be a solid state drive.
  • Embodiments of the present application further provide a computer-readable medium on which a computer program is stored, and when the computer program is executed by a computer, implements the steps performed by the first device or the steps performed by the second device in any of the foregoing embodiments .
  • Embodiments of the present application further provide a computer program product, which, when executed by a computer, implements the steps performed by the first device or the steps performed by the second device in any of the foregoing embodiments.
  • An embodiment of the present application also provides a system chip, where the system chip includes: a communication unit and a processing unit.
  • the processing unit may, for example, be a processor.
  • the communication unit may be, for example, a communication interface, an input/output interface, a pin or a circuit, or the like.
  • the processing unit can execute computer instructions, so that the chip in the communication apparatus executes the steps performed by the first device or the steps performed by the second device provided in the foregoing embodiments of the present application.
  • the computer instructions are stored in a storage unit.
  • the embodiment of the present application further provides a communication system, which includes the aforementioned first device and the second device.
  • various aspects or features of the present application may be implemented as a method, apparatus, or article of manufacture using standard programming and/or engineering techniques.
  • article of manufacture encompasses a computer program accessible from any computer readable device, carrier or medium.
  • computer readable media may include, but are not limited to: magnetic storage devices (eg, hard disks, floppy disks, or magnetic tapes, etc.), optical disks (eg, compact discs (CDs), digital versatile discs (DVDs) etc.), smart cards and flash memory devices (eg, erasable programmable read-only memory (EPROM), card, stick or key drives, etc.).
  • various storage media described herein can represent one or more devices and/or other machine-readable media for storing information.
  • the term "machine-readable medium” may include, but is not limited to, wireless channels and various other media capable of storing, containing, and/or carrying instructions and/or data.
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium.
  • the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

Abstract

The present application provides a data synchronization method and device for a mobile distributed system. The method can realize data synchronization of a mobile distributed system. The method comprises: a first device sending a first query request to a second device; the first device receiving a first synchronization message sent by the second device, wherein the first synchronization message carries first media asset change content of the second device, the first media asset change content comprising a first media asset that is changed and an action corresponding to the changing of the first media asset; and the first device generating a first synchronization record according to the first synchronization message, the first synchronization record comprising a first synchronization node, a first change list and a first device list, wherein the first synchronization node is used for recording first data synchronization information, the first change list records the first media asset that is changed during the first data synchronization and the action corresponding to the changing of the first media asset, and the first device list is used for recording a device on which the first data synchronization is carried out.

Description

一种移动分布式系统数据同步的方法和设备A method and device for data synchronization in a mobile distributed system
本申请要求于2020年07月31日提交中国专利局、申请号为202010763598.5、申请名称为“一种移动分布式系统数据同步的方法和设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on July 31, 2020 with the application number of 202010763598.5 and titled "A method and device for data synchronization of mobile distributed systems", the entire contents of which are by reference Incorporated in this application.
技术领域technical field
本申请涉及终端领域,并且更具体的,涉及一种移动分布式系统数据同步的方法和设备。The present application relates to the field of terminals, and more particularly, to a method and device for data synchronization in a mobile distributed system.
背景技术Background technique
移动分布式系统是一种全新的分布式系统,不同于传统的分布式系统。如传统分布式系统是主从机构,而移动分布式系统是一种对等结构的分布式,系统成员设备是平等的,不存在主从关系;传统分布式系统要求系统成员设备实时在线,而移动分布式系统不要求成员设备实时在线。正因为移动分布式系统的结构、功能等有别于传统分布式系统,因此传统分布式系统数据同步的方法不适用于移动分布式系统。因此,移动分布式系统数据如何同步是一项亟待解决的问题。Mobile distributed system is a brand new distributed system, which is different from traditional distributed system. For example, the traditional distributed system is a master-slave mechanism, while the mobile distributed system is a peer-to-peer distributed system. The system member devices are equal, and there is no master-slave relationship; the traditional distributed system requires the system member devices to be online in real time, while the Mobile distributed systems do not require member devices to be online in real time. Because the structure and function of the mobile distributed system are different from those of the traditional distributed system, the data synchronization method of the traditional distributed system is not suitable for the mobile distributed system. Therefore, how to synchronize mobile distributed system data is an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种移动分布式系统数据同步的方法和设备,所述方法实现移动分布式系统中设备间数据异步同步。The present application provides a method and device for data synchronization in a mobile distributed system, and the method realizes asynchronous synchronization of data between devices in a mobile distributed system.
第一方面,提供了一种移动分布式系统数据同步的方法,包括:第一设备向第二设备发送第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;第一设备接收第二设备发送的第一同步消息,所述第一同步消息是所述第二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送的,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作;所述第一设备根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的第一媒体资产和所述第一媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。A first aspect provides a method for data synchronization in a mobile distributed system, comprising: a first device sending a first query request to a second device, where the first query request is used to query whether there is media on the second device Asset change; the first device receives the first synchronization message sent by the second device, the first synchronization message is that the second device receives the first query request and determines that the first media asset is changed. sent by the first device, the first synchronization message carries the first media asset change content of the second device, and the first media asset change content includes the changed first media asset and the first media The action corresponding to the asset change; the first device generates a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list. The first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset, The first device list is used to record the first data synchronization device.
在所述方法中,所述第一设备向所述第二设备发送所述第一查询请求;所述第二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送所述第一同步消息,所述第一设备根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,实现了移动分布式系统的异步同步。In the method, the first device sends the first query request to the second device; after the second device receives the first query request and determines that the first media asset is changed, The first device sends the first synchronization message, and the first device generates a first synchronization record according to the first synchronization message, where the first synchronization record includes a first synchronization node, a first change list With the first device list, the asynchronous synchronization of the mobile distributed system is realized.
应理解,媒体资产是指多种不同格式的文件,如音频、视频、图片等文件,媒体资产可以对应的媒体资产的元数据,而不是媒体资产的本身数据。如文件音频A,其媒体资产 可以是音频A的元数据(音频A的存储位置、音频A的大小、音频A的拥有者等数据属性信息)。It should be understood that a media asset refers to files in various formats, such as audio, video, picture and other files, and the media asset may correspond to the metadata of the media asset, rather than the data of the media asset itself. For example, the file audio A, its media assets can be the metadata of the audio A (the storage location of the audio A, the size of the audio A, the owner of the audio A and other data attribute information).
媒体资产变更是指设备上的媒体资产发生了变化,可以是设备上新增了媒体资产,也可以是修改设备上原有的媒体资产内容。如第二设备录制了音频A,则第二设备上的媒体资产变更是指第二设备录制了音频A,又如,第二设备修改了音频B,音频B是第二设备的原有媒体资产,则第二设备上的媒体资产变更是指第二设备修改了音频B。The media asset change refers to the change of the media asset on the device, which may be a new media asset on the device, or a modification of the original media asset content on the device. If the second device has recorded audio A, the media asset change on the second device means that the second device has recorded audio A. Another example is that the second device has modified audio B, which is the original media asset of the second device. , the media asset change on the second device means that the second device modifies audio B.
结合第一方面,在第一方面的某些实现方式中,所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述第一媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第二设备的设备ID。With reference to the first aspect, in some implementations of the first aspect, the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node. One or more of a synchronization device, wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: a first change list ID and the second device's The first media asset changes content; the first device list includes: the first device list ID and the device ID of the second device.
结合第一方面,在第一方面的某些实现方式中,所述第一同步变更内容包括第二设备的媒体资产变更内容,所述第一同步设备包括所述第二设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第一媒体资产变更内容的索引,所述第一同步设备中包括与第二设备相关的索引,所述更改列表的索引用于查找所述第一媒体资产变更内容,所述与第二设备相关的索引用于查找与所述第二设备相关的信息。With reference to the first aspect, in some implementations of the first aspect, the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the second device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to look up the first device list; or, the first synchronization change content includes the index of the first media asset change content, and the first synchronization device includes the second device-related index. an index, where the index of the change list is used to look up the content of the first media asset change, and the index related to the second device is used to look up information related to the second device.
应理解,所述第二设备相关的信息可以包括所述第二设备的类型、所述第二设备的称和所述第二设备的存储大小等一个或多个信息。It should be understood that the information related to the second device may include one or more pieces of information such as the type of the second device, the name of the second device, and the storage size of the second device.
结合第一方面,在第一方面的某些实现方式中,所述第一设备接收第二设备发送的第一同步消息之前,所述方法还包括:所述第一设备上的媒体资产发生变更,所述第一设备新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容。With reference to the first aspect, in some implementations of the first aspect, before the first device receives the first synchronization message sent by the second device, the method further includes: a media asset on the first device is changed , the first device adds a second change list, and the second change list includes the second change list ID and the content of the media asset change on the first device.
通过在第一设备上的媒体资产发生变更时,所述第一设备新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容可以实现满足移动分布式系统中成员设备离开分布式系统后线状态时,设备上的媒体资产变更依然有效。By adding a second change list to the first device when the media asset on the first device is changed, the second change list includes the second change list ID and the content of the media asset change on the first device. When the member device in the mobile distributed system leaves the backline state of the distributed system, the media asset changes on the device are still valid.
结合第一方面,在第一方面的某些实现方式中,所述第一设备接收第二设备发送的第一同步消息后,所述方法还包括:所述第一设备根据所述第一同步消息,生成第二同步记录,所述第二同步记录包括第二同步节点、所述第二更改列表和第二设备列表;所述第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,所述第二同步节点ID用于标识第二数据同步;在所述第二更改列表中,增加第二设备的媒体资产变更内容;在所述第二设备列表中增加所述第二设备的设备ID。With reference to the first aspect, in some implementations of the first aspect, after the first device receives the first synchronization message sent by the second device, the method further includes: the first device according to the first synchronization message message, generate a second synchronization record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization timestamp , one or more of the second parent synchronization node identifier, the second synchronization change content and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list, add The content of the media asset of the second device is changed; the device ID of the second device is added to the second device list.
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:所述第一设备向所述第二设备发送第二查询请求,所述第二查询请求用于查询所述第二设备上是否有媒体资产变更;所述第一设备接收所述第二设备发送的第二同步消息,所述第二同步消息是所述第二设备接收到所述第二查询请求,并判断有第二媒体资产变更后向所述第一设备发送的,所述第二同步消息携带有所述第二设备的第二媒体资产变更内容,所述第二媒体资产变更 内容包括发生变更的第二媒体资产和所述第二媒体资产变更对应的动作;所述第一设备根据所述第二同步消息,生成第三同步记录,所述第三同步记录包括第三同步节点、第三更改列表和第三设备列表,所述第三同步节点中包括:第三同步节点ID,第三同步时间戳、第三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,所述第三同步节点ID用于标识三数据同步;第三更改列表包括第三更改列表ID,所述第二设备的第二媒体资产变更内内容;所述第三设备列表包括第三设备列表ID,和所述第二设备的设备ID;移除所述第一设备列表ID中的所述第二设备的设备ID。With reference to the first aspect, in some implementations of the first aspect, the method further includes: the first device sends a second query request to the second device, where the second query request is used to query the Whether there is a media asset change on the second device; the first device receives a second synchronization message sent by the second device, where the second synchronization message is that the second device receives the second query request, and Sent to the first device after judging that there is a second media asset change, the second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed content. The second media asset and the action corresponding to the change of the second media asset; the first device generates a third synchronization record according to the second synchronization message, and the third synchronization record includes a third synchronization node, a third modification A list and a third device list, the third synchronization node includes: a third synchronization node ID, a third synchronization time stamp, a third parent synchronization node identifier, a third synchronization change content, and one or more of the third synchronization device where the third synchronization node ID is used to identify three data synchronizations; the third change list includes a third change list ID, and the second media asset of the second device changes content; the third device list includes The third device list ID, and the device ID of the second device; remove the device ID of the second device in the first device list ID.
如果所述第一设备与所述第二设备进行了多次数据同步,在同步记录的设备列表只保留最新的一次数据同步的第二设备的设备ID,删除之前的设备列表中的第二设备的设备ID,使得第一设备与第二设备再进行数据同步时,可以快速查找到之前已进行过的数据同步的状态信息,并且,删除之前的设备列表中的第二设备的设备ID可以节省第一设备的存储空间。If the first device and the second device have performed multiple data synchronizations, only the device ID of the second device for the latest data synchronization is retained in the device list of the synchronization record, and the second device in the previous device list is deleted. The device ID of the first device and the second device can quickly find the status information of the data synchronization that has been performed before, and delete the device ID of the second device in the previous device list to save The storage space of the first device.
结合第一方面,在第一方面的某些实现方式中,所述第一设备列表中的设备ID为空,删除所述第一设备列表。With reference to the first aspect, in some implementations of the first aspect, the device ID in the first device list is empty, and the first device list is deleted.
在所述第一设备列表中的设备ID为空时,删除所述第一设备列表可以节省第一设备的存储空间。When the device ID in the first device list is empty, deleting the first device list can save the storage space of the first device.
结合第一方面,在第一方面的某些实现方式中,当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,与所述根节点的相邻同步节点成为新的根节点。With reference to the first aspect, in some implementations of the first aspect, when the first synchronization node is a root (Root) node, the root node and the first change list are deleted, and the root node and the root node are deleted. The adjacent sync node becomes the new root node.
应理解,根节点为所述第一设备第一次与移动分布式系统的其他设备进行数据同步时创建的节点。It should be understood that the root node is a node created when the first device performs data synchronization with other devices in the mobile distributed system for the first time.
当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,可以节省第一设备的存储空间。When the first synchronization node is a root (Root) node, deleting the root node and the first change list can save the storage space of the first device.
结合第一方面,在第一方面的某些实现方式中,所述第三同步节点为顶(Top)节点,所述顶节点和所述根节点之间的节点为中间(middle)节点。With reference to the first aspect, in some implementations of the first aspect, the third synchronization node is a top node, and a node between the top node and the root node is a middle node.
结合第一方面,在第一方面的某些实现方式中,当所述第一设备与所述第二设备的数据同步过程异常终止时,创建临时中间节点,所述临时中间节点中包含临时状态标识,所述临时中间节点用于保存未完成数据同步的同步数据。With reference to the first aspect, in some implementations of the first aspect, when the data synchronization process between the first device and the second device terminates abnormally, a temporary intermediate node is created, and the temporary intermediate node includes a temporary state identifier, the temporary intermediate node is used to save the synchronization data for which data synchronization is not completed.
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:在所述第一数据同步时,所述第一设备接收所述第二设备发送的第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行的哈希运算得到的,所述第一同步消息包括所述第一哈希值;所述第一设备根据所述第一更改列表内容进行哈希计算,得到第二哈希值;当所述第一设备判断所述第一哈希值与所述第二哈希值相等时,所述第一设备确定所述本次数据同步成功。With reference to the first aspect, in some implementations of the first aspect, the method further includes: when the first data is synchronized, the first device receives the first hash value sent by the second device, The first hash value is obtained by the hash operation performed by the second device according to the changed content of the first media asset, and the first synchronization message includes the first hash value; the first device Perform hash calculation according to the content of the first change list to obtain a second hash value; when the first device determines that the first hash value is equal to the second hash value, the first device It is determined that the current data synchronization is successful.
在所述第一设备同步所述第二设备的数据时,通过校验所述第一哈希值和所述第二哈希值,确保数据同步的正确性。When the first device synchronizes the data of the second device, the correctness of the data synchronization is ensured by verifying the first hash value and the second hash value.
第二方面,提供了一种移动分布式系统数据同步的方法,包括:第二设备接收第一设备发送的第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;In a second aspect, a method for synchronizing data in a mobile distributed system is provided, including: a second device receiving a first query request sent by a first device, where the first query request is used to query whether the second device has changes to media assets;
所述第二设备根据所述第一查询请求,确定有第一媒体资产变更,向所述第一设备发 送第一同步消息,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作。The second device determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the first device, where the first synchronization message carries the first media of the second device Asset change content, where the first media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
结合第二方面,在第二方面的某些实现方式中,所述第二设备接收第一设备发送的第一查询请求之前,所述方法还包括:With reference to the second aspect, in some implementations of the second aspect, before the second device receives the first query request sent by the first device, the method further includes:
所述第二设备上的所述第一媒体资产发生变更,所述第二设备新增第一更改列表;The first media asset on the second device is changed, and the second device adds a first change list;
所述方法还包括:The method also includes:
所述第二设备向所述第一设备发送第三查询请求,所述第三查询请求用于查询所述第一设备上是否有媒体资产变更;The second device sends a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
所述第二设备接收所述第一设备发送的第一反馈消息,所述第一反馈消息是所述第一设备在接收到所述第三查询请求,并判断所述第一设备上没有媒体资产变更后向所述第二设备发送的,所述第一反馈消息用于标识所述第一设备上没有发生媒体资产变更;The second device receives the first feedback message sent by the first device, where the first feedback message is that the first device receives the third query request and determines that there is no media on the first device Sent to the second device after the asset is changed, the first feedback message is used to identify that no media asset change has occurred on the first device;
所述第二设备根据所述第一反馈消息和所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、所述第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的媒体资产和所述媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。The second device generates a first synchronization record according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, so The first device list is used to record the first data synchronization device.
结合第二方面,在第二方面的某些实现方式中,所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第一设备的设备ID。With reference to the second aspect, in some implementations of the second aspect, the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node. One or more of a synchronization device, wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: a first change list ID and the second device's The content of the media asset change; the first device list includes: the first device list ID and the device ID of the first device.
结合第二方面,在第二方面的某些实现方式中,所述第一同步变更内容包括第二设备的媒体资产变更内容,所述第一同步设备包括所述第一设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第二设备的媒体资产变更内容的索引,所述第一同步设备中包括与第一设备相关的索引,所述第二设备的媒体资产变更内容的索引用于查找所述第二设备的媒体资产变更内容,所述与第一设备相关的索引用于查找与所述第一设备相关的信息。With reference to the second aspect, in some implementations of the second aspect, the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, and the first synchronization device includes The relevant index, the index of the media asset modification content of the second device is used to find the media asset modification content of the second device, and the index related to the first device is used to search for the media asset modification content related to the first device. information.
结合第二方面,在第二方面的某些实现方式中,所述第二设备根据所述第一查询请求,判断有第一媒体资产变更,包括:所述第二设备根据所述第一查询请求和第二设备上的同步记录,判断有第一媒体资产变更;或者,所述第二设备根据所述第一查询请求和第二设备上的更改列表,判断有第一媒体资产变更。With reference to the second aspect, in some implementations of the second aspect, the second device determining, according to the first query request, that the first media asset is changed, including: the second device according to the first query The request and the synchronization record on the second device determine that the first media asset is changed; or, the second device determines that the first media asset is changed according to the first query request and the change list on the second device.
结合第二方面,在第二方面的某些实现方式中,所述第一同步消息包括第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行哈希运算得到的。With reference to the second aspect, in some implementations of the second aspect, the first synchronization message includes a first hash value, and the first hash value is a change of the second device according to the first media asset The content is obtained by hashing.
第三方面,提供了一种设备,所述设备为第一设备,包括:收发单元,用于向第二设备发送第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;In a third aspect, a device is provided, the device is a first device, and includes: a transceiver unit configured to send a first query request to a second device, where the first query request is used to query the second device Whether there is a media asset change;
所述收发单元还用于接收第二设备发送的第一同步消息,所述第一同步消息是所述第 二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送的,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作;处理单元,用于根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的第一媒体资产和所述第一媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。The transceiver unit is further configured to receive a first synchronization message sent by the second device, where the first synchronization message is sent to the second device after receiving the first query request and judging that the first media asset has been changed. Sent by the first device, the first synchronization message carries the first media asset modification content of the second device, and the first media asset modification content includes the modified first media asset and the first media asset. an action corresponding to a media asset change; a processing unit, configured to generate a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list, and a first device list, The first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset , the first device list is used to record the first data synchronization device.
结合第三方面,在第三方面的某些实现方式中,所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述第一媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第二设备的设备ID。With reference to the third aspect, in some implementations of the third aspect, the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change One or more of a synchronization device, wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: a first change list ID and the second device's The first media asset changes content; the first device list includes: the first device list ID and the device ID of the second device.
结合第三方面,在第三方面的某些实现方式中,所述第一同步变更内容包括第二设备的第一媒体资产变更内容,所述第一同步设备包括所述第二设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第一媒体资产变更内容的索引,所述第一同步设备中包括与第二设备相关的索引,所述第一媒体资产变更内容的索引用于查找所述第一媒体资产变更内容,所述与第二设备相关的索引用于查找与所述第二设备相关的信息。With reference to the third aspect, in some implementations of the third aspect, the first synchronization change content includes first media asset change content of the second device, and the first synchronization device includes a device ID of the second device Or, the first synchronization change content includes an index of the first change list, the first synchronization device includes an index of the first device list, and the index of the change list is used to find the first change list, The index of the device list is used to look up the first device list; or, the first synchronization change content includes an index of the first media asset change content, and the first synchronization device includes a connection with the second device. A related index, where the index of the first media asset modification content is used to search for the first media asset modification content, and the index related to the second device is used to search for information related to the second device.
结合第三方面,在第三方面的某些实现方式中,所述第一设备接收第二设备发送的第一同步消息之前,所述第一设备上的媒体资产发生变更,所述处理单元还用于:新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容。With reference to the third aspect, in some implementations of the third aspect, before the first device receives the first synchronization message sent by the second device, the media asset on the first device is changed, and the processing unit further Used for: adding a second change list, where the second change list includes the second change list ID and the content of the media asset change on the first device.
结合第三方面,在第三方面的某些实现方式中,所述第一设备接收第二设备发送的第一同步消息后,所述处理单元还用于:所述第一设备根据所述第一同步消息,生成第二同步记录,所述第二同步记录包括第二同步节点、所述第二更改列表和第二设备列表;所述第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,所述第二同步节点ID用于标识第二数据同步;在所述第二更改列表中,增加第二设备的媒体资产变更内容;在所述第二设备列表中增加所述第二设备的设备ID。With reference to the third aspect, in some implementations of the third aspect, after the first device receives the first synchronization message sent by the second device, the processing unit is further configured to: the first device according to the first synchronization message A synchronization message to generate a second synchronization record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization One or more of a timestamp, a second parent synchronization node ID, a second synchronization change content, and a second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list , and the content of the media asset modification of the second device is added; the device ID of the second device is added to the second device list.
结合第三方面,在第三方面的某些实现方式中,所述收发单元还用于:向所述第二设备发送第二查询请求,所述第二查询请求用于查询所述第二设备上是否有媒体资产变更;With reference to the third aspect, in some implementations of the third aspect, the transceiver unit is further configured to: send a second query request to the second device, where the second query request is used to query the second device whether there are any changes to the media assets;
接收所述第二设备发送的第二同步消息,所述第二同步消息是所述第二设备接收到所述第二查询请求,并判断有第二媒体资产变更后向所述第一设备发送的,所述第二同步消息携带有所述第二设备的第二媒体资产变更内容,所述第二媒体资产变更内容包括发生变更的第二媒体资产和所述第二媒体资产变更对应的动作;所述处理单元还用于:根据所述第二同步消息,生成第三同步记录,所述第三同步记录包括第三同步节点、第三更改列表和第三设备列表,其中,所述第三同步节点中包括第三同步节点ID,第三同步时间戳、第 三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,所述第三同步节点ID用于标识三数据同步;第三更改列表包括第三更改列表ID,所述第二设备的第二媒体资产变更内内容;所述第三设备列表包括第三设备列表ID,和所述第二设备的设备ID;Receive a second synchronization message sent by the second device, where the second synchronization message is sent to the first device after the second device receives the second query request and determines that the second media asset is changed The second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed second media asset and the action corresponding to the second media asset change ; the processing unit is further configured to: generate a third synchronization record according to the second synchronization message, the third synchronization record includes a third synchronization node, a third change list and a third device list, wherein the third synchronization record The three synchronization nodes include a third synchronization node ID, one or more of a third synchronization timestamp, a third parent synchronization node identifier, a third synchronization change content, and a third synchronization device, wherein the third synchronization node ID Used to identify three data synchronization; the third change list includes a third change list ID, the second media asset of the second device changes content; the third device list includes a third device list ID, and the second Device ID of the device;
所述处理单元还用于:移除所述第一设备列表ID中的所述第二设备的设备ID。The processing unit is further configured to: remove the device ID of the second device in the first device list ID.
结合第三方面,在第三方面的某些实现方式中,所述第一设备列表中的设备ID为空,所述处理单元删除所述第一设备列表。With reference to the third aspect, in some implementations of the third aspect, the device ID in the first device list is empty, and the processing unit deletes the first device list.
结合第三方面,在第三方面的某些实现方式中,当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,与所述根节点的相邻同步节点成为新的根节点。With reference to the third aspect, in some implementations of the third aspect, when the first synchronization node is a root (Root) node, the root node and the first change list are deleted, and the root node and the root node are deleted. The adjacent sync node becomes the new root node.
结合第三方面,在第三方面的某些实现方式中,所述第三同步节点为顶(Top)节点,所述顶节点和所述根节点之间的节点为中间(middle)节点。With reference to the third aspect, in some implementations of the third aspect, the third synchronization node is a top (Top) node, and a node between the top node and the root node is a middle (middle) node.
结合第三方面,在第三方面的某些实现方式中,当所述第一设备与所述第二设备的数据同步过程异常终止时,所述处理单元还用于:创建临时中间节点,所述临时中间节点中包含临时状态标识,所述临时中间节点用于保存未完成数据同步的同步数据。With reference to the third aspect, in some implementations of the third aspect, when the data synchronization process between the first device and the second device terminates abnormally, the processing unit is further configured to: create a temporary intermediate node, so The temporary intermediate node includes a temporary state identifier, and the temporary intermediate node is used to store synchronization data for which data synchronization is not completed.
结合第三方面,在第三方面的某些实现方式中,在所述第一数据同步时,所述收发单元还用于接收所述第二设备发送的第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行的哈希运算得到的,所述第一同步消息包括所述第一哈希值;With reference to the third aspect, in some implementations of the third aspect, when the first data is synchronized, the transceiver unit is further configured to receive a first hash value sent by the second device, the first hash value The hash value is obtained by the hash operation performed by the second device according to the changed content of the first media asset, and the first synchronization message includes the first hash value;
所述处理单元还用于根据所述第一更改列表内容进行哈希计算,得到第二哈希值;当所述处理单元判断所述第一哈希值与所述第二哈希值相等时,所述处理单元确定所述本次数据同步成功。The processing unit is further configured to perform hash calculation according to the content of the first change list to obtain a second hash value; when the processing unit determines that the first hash value is equal to the second hash value , the processing unit determines that the current data synchronization is successful.
第四方面,提供了一种设备,所述设备为第二设备,包括:收发单元,用于接收第一设备发送的第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;处理单元,用于根据所述第一查询请求,确定有第一媒体资产变更,向所述第一设备发送第一同步消息,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作。In a fourth aspect, a device is provided, where the device is a second device, comprising: a transceiver unit configured to receive a first query request sent by the first device, where the first query request is used to query the second device Whether there is a media asset change on the server; the processing unit is configured to determine, according to the first query request, that there is a first media asset change, and send a first synchronization message to the first device, where the first synchronization message carries the The content of the first media asset change of the second device, where the content of the first media asset change includes the changed first media asset and an action corresponding to the change of the first media asset.
结合第四方面,在第四方面的某些实现方式中,所述第二设备上的所述第一媒体资产发生变更,所述处理单元还用于新增第一更改列表;所述收发单元还用于:向所述第一设备发送第三查询请求,所述第三查询请求用于查询所述第一设备上是否有媒体资产变更;With reference to the fourth aspect, in some implementations of the fourth aspect, the first media asset on the second device is changed, and the processing unit is further configured to add a first change list; the transceiver unit is further used for: sending a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
接收所述第一设备发送的第一反馈消息,所述第一反馈消息是所述第一设备在接收到所述第三查询请求,并判断所述第一设备上没有媒体资产变更后向所述第二设备发送的,所述第一反馈消息用于标识所述第一设备上没有发生媒体资产变更;所述处理单元还用于:Receive a first feedback message sent by the first device, where the first feedback message is sent to the sent by the second device, the first feedback message is used to identify that there is no media asset change on the first device; the processing unit is further configured to:
根据所述第一反馈消息和所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、所述第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的媒体资产和所述媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。A first synchronization record is generated according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization record A synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, the first device list A device for recording the first data synchronization.
结合第四方面,在第四方面的某些实现方式中,所述第一同步节点包括:第一同步节 点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第一设备的设备ID。With reference to the fourth aspect, in some implementations of the fourth aspect, the first synchronization node includes: a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization change content and a first synchronization node. One or more of a synchronization device, wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: a first change list ID and the second device's The content of the media asset change; the first device list includes: the first device list ID and the device ID of the first device.
结合第四方面,在第四方面的某些实现方式中,所述第一同步变更内容包括第二设备的媒体资产变更内容,所述第一同步设备包括所述第一设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第二设备的媒体资产变更内容的索引,所述第一同步设备中包括与第一设备相关的索引,所述第二设备的媒体资产变更内容的索引用于查找所述第二设备的媒体资产变更内容,所述与第一设备相关的索引用于查找与所述第一设备相关的信息。With reference to the fourth aspect, in some implementations of the fourth aspect, the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or , the first synchronization change content includes the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, the The index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, and the first synchronization device includes The relevant index, the index of the media asset modification content of the second device is used to find the media asset modification content of the second device, and the index related to the first device is used to search for the media asset modification content related to the first device. information.
结合第四方面,在第四方面的某些实现方式中,所述处理单元具体用于:根据所述第一查询请求和第二设备上的同步记录,判断有第一媒体资产变更;或者,根据所述第一查询请求和第二设备上的更改列表,判断有第一媒体资产变更。With reference to the fourth aspect, in some implementations of the fourth aspect, the processing unit is specifically configured to: determine that the first media asset is changed according to the first query request and the synchronization record on the second device; or, According to the first query request and the change list on the second device, it is determined that the first media asset is changed.
结合第四方面,在第四方面的某些实现方式中,所述第一同步消息包括第一哈希值,所述第一哈希值是所述处理单元根据所述第一媒体资产变更内容进行哈希运算得到的。With reference to the fourth aspect, in some implementations of the fourth aspect, the first synchronization message includes a first hash value, and the first hash value is the content changed by the processing unit according to the first media asset obtained by hashing.
第五方面,提供了一种装置,包括处理器,所述处理器与存储器相连,所述存储器用于存储计算机程序,所述处理器用于执行所述存储器中存储的计算机程序,以使得所述装置执行上述第一方面或第一方面的任意可能的实现方式中的方法,或者第二方面或第二方面的任意可能的实现方式中的方法。In a fifth aspect, an apparatus is provided, comprising a processor connected to a memory for storing a computer program, and the processor for executing the computer program stored in the memory to cause the The apparatus performs the method of the first aspect or any possible implementation of the first aspect, or the method of the second aspect or any possible implementation of the second aspect.
第六方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,当所述计算机程序被运行时,实现上述第一方面或第一方面的任意可能的实现方式中的方法,或者第二方面或第二方面的任意可能的实现方式中的方法。In a sixth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program. When the computer program is executed, the first aspect or any possible implementation manner of the first aspect is realized. The method in , or the method in the second aspect or any possible implementation of the second aspect.
第七方面,提供了一种芯片,包括处理器和接口;所述处理器用于读取指令以执行上述第一方面或第一方面的任意可能的实现方式中的方法,或者第二方面或第二方面的任意可能的实现方式中的方法。In a seventh aspect, a chip is provided, including a processor and an interface; the processor is configured to read instructions to execute the method in the first aspect or any possible implementation manner of the first aspect, or the second aspect or the first aspect. A method in any possible implementation manner of the second aspect.
可选地,所述芯片还可以包括存储器,所述存储器中存储有指令,处理器用于执行存储器中存储的指令或源于其他的指令。Optionally, the chip may further include a memory in which instructions are stored, and the processor is configured to execute the instructions stored in the memory or other instructions.
第八方面,提供了一种移动分布式系统,所述系统包括具有实现上述第一方面的各方法及各种可能设计的功能的装置和具有实现上述第二方面的各方法及各种可能设计的功能的装置。In an eighth aspect, a mobile distributed system is provided, the system includes a device having functions for implementing the methods and various possible designs of the above-mentioned first aspect, and various methods and various possible designs for implementing the above-mentioned second aspect. functional device.
附图说明Description of drawings
图1是本申请实施例的操作系统的一种示意性结构框图;1 is a schematic structural block diagram of an operating system according to an embodiment of the present application;
图2是本申请实施例的一种应用场景的示意图;FIG. 2 is a schematic diagram of an application scenario of an embodiment of the present application;
图3a是本申请实施例的分布式系统一致性的要求的示意图;FIG. 3a is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application;
图3b是本申请实施例的分布式系统一致性的要求的示意图;FIG. 3b is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application;
图3c是本申请实施例的分布式系统一致性的要求的示意图;FIG. 3c is a schematic diagram of a requirement for consistency of a distributed system according to an embodiment of the present application;
图4a是本申请实施例的同步记录的示意性框图;4a is a schematic block diagram of a synchronization record in an embodiment of the present application;
图4b是本申请实施例的同步记录的示意性框图;FIG. 4b is a schematic block diagram of a synchronization record according to an embodiment of the present application;
图4c是本申请实施例的同步记录的示意性框图;4c is a schematic block diagram of a synchronization record in an embodiment of the present application;
图5a是本申请实施例的同步记录的示意性框图;5a is a schematic block diagram of a synchronization record in an embodiment of the present application;
图5b是本申请实施例的同步记录的示意性框图;5b is a schematic block diagram of a synchronization record in an embodiment of the present application;
图5c是本申请实施例的同步记录的示意性框图;Fig. 5c is a schematic block diagram of a synchronization record according to an embodiment of the present application;
图6a是本申请实施例的同步记录的示意性框图;6a is a schematic block diagram of a synchronization record in an embodiment of the present application;
图6b是本申请实施例的同步记录的示意性框图;6b is a schematic block diagram of a synchronization record in an embodiment of the present application;
图6c是本申请实施例的同步记录的示意性框图;6c is a schematic block diagram of a synchronization record in an embodiment of the present application;
图7是本申请实施例的设备A与其他设备已经进行了数据同步和设备B与其他设备已经进行了数据同步的示意性框图;FIG. 7 is a schematic block diagram showing that device A and other devices have performed data synchronization and device B and other devices have performed data synchronization according to an embodiment of the present application;
图8是本申请实施例的设备B有媒体资产变更时的示意性框图;8 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed;
图9是本申请实施例的一种移动分布式系统数据同步的方法的示意性流程图;9 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application;
图10是本申请实施例的一种移动分布式系统数据同步的方法的示意性流程图;10 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application;
图11是本申请实施例的设备A与设备B数据同步的示意性框图;11 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application;
图12是本申请实施例的设备A有媒体资产变更时的示意性框图;12 is a schematic block diagram of a device A in an embodiment of the present application when a media asset is changed;
图13是本申请实施例的一种移动分布式系统数据同步的方法的示意性流程图;13 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application;
图14是本申请实施例的一种移动分布式系统数据同步的方法的示意性流程图;14 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application;
图15是本申请实施例的设备A与设备B数据同步的示意性框图;15 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application;
图16是本申请实施例的设备B有媒体资产变更时的示意性框图;FIG. 16 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed;
图17是本申请实施例的一种移动分布式系统数据同步的方法的示意性流程图;17 is a schematic flowchart of a method for data synchronization in a mobile distributed system according to an embodiment of the present application;
图18是本申请实施例的设备A与设备B数据同步的示意性框图;18 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application;
图19是本申请实施例的移动分布式系统有状态数据同步结构示意性框图;19 is a schematic block diagram of a stateful data synchronization structure of a mobile distributed system according to an embodiment of the present application;
图20示出了本申请实施例的装置的示意性框图;FIG. 20 shows a schematic block diagram of an apparatus according to an embodiment of the present application;
图21为本申请提供的一种终端设备的结构示意图。FIG. 21 is a schematic structural diagram of a terminal device provided by this application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。The technical solutions in the present application will be described below with reference to the accompanying drawings.
为了更好地理解本申请,下面先对本申请出现的术语进行说明。For a better understanding of the present application, the terms appearing in the present application are first described below.
操作系统(Operating System,OS):管理计算机硬件与软件资源的计算机程序。操作系统需要处理如管理与配置内存、决定系统资源供需的优先次序、控制输入设备与输出设备、操作网络与管理文件系统等基本事务。操作系统也提供一个让用户与系统交互的操作界面。常见的操作系统有:iOS操作系统、Android操作系统和Microsoft Windows系列操作系统等,其中,iOS操作系统是由苹果公司开发的手持设备操作系统,Android操作系统是一种基于Linux的自由及开放源代码的操作系统。主要使用于移动设备,如智能手机和平板电脑,Microsoft Windows系列操作系统是在微软给IBM机器设计的MS-DOS的基础上设计的图形操作系统。Operating System (OS): A computer program that manages computer hardware and software resources. The operating system handles basic tasks such as managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating the network, and managing the file system. The operating system also provides an interface for the user to interact with the system. Common operating systems include: iOS operating system, Android operating system and Microsoft Windows series operating systems, among which, iOS operating system is a handheld device operating system developed by Apple, and Android operating system is a free and open source Linux-based operating system. code for the operating system. Primarily used on mobile devices such as smartphones and tablets, the Microsoft Windows family of operating systems is a graphical operating system based on MS-DOS, which Microsoft designed for IBM machines.
下面以Android操作系统为例,对操作系统架构进行简单说明。如图1所示,图1示出了一种Android操作系统的示意性框图。Android操作系统同其它操作系统一样,采用了分层的架构,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The following takes the Android operating system as an example to briefly describe the operating system architecture. As shown in FIG. 1 , FIG. 1 shows a schematic block diagram of an Android operating system. Like other operating systems, the Android operating system adopts a layered architecture. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 2, the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in Figure 2, the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make these data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications. A display interface can consist of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
电话管理器用于提供设备的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication functions of the device. For example, the management of call status (including connecting, hanging up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications that appear on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。A system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.
数据库:一个按数据结构来存储和管理数据的计算机软件系统,一般具有存储、截取、安全保障、备份等基础功能。数据库是存放数据的仓库,它的存储空间很大,可以存放百万条、千万条、上亿条数据。数据库中的数据按照一定的规则存放,数据的来源有很多,比如出行记录、消费记录、浏览的网页、发送的消息等等。Database: A computer software system that stores and manages data according to the data structure, and generally has basic functions such as storage, interception, security assurance, and backup. The database is a warehouse for storing data. It has a large storage space and can store millions, tens of millions, and hundreds of millions of data. The data in the database is stored according to certain rules, and there are many sources of data, such as travel records, consumption records, web pages browsed, messages sent, and so on.
数据库中存储有元数据(Metadata),元数据为描述数据的数据(data about data),又称中介数据、中继数据,主要是描述数据属性(property)的信息,如描述数据的内容、覆盖范围、质量、管理方式、数据的所有者、数据的提供方式等信息,是数据和数据用户之间的桥梁。元数据是关于数据的组织、数据域及其关系的信息,简言之,元数据就是关于数据的数据。元数据可以为数据的多种属性信息,如数据的名称、数据的大小、数据的数据类型、数据的长度、数据的字段、数据的位置、数据的拥有者等。Metadata is stored in the database. Metadata is the data describing the data (data about data), also known as intermediary data and relay data, mainly describing the information of the data properties, such as describing the content of the data, covering Information such as scope, quality, management methods, data owners, and data provision methods are the bridge between data and data users. Metadata is information about the organization of data, data domains and their relationships. In short, metadata is data about data. The metadata can be various attribute information of the data, such as the name of the data, the size of the data, the data type of the data, the length of the data, the fields of the data, the location of the data, the owner of the data, and the like.
应理解,本申请实施例中的数据同步是指元数据的同步,即设备之间同步更改的数据的属性信息,如存储位置等信息,具体的数据可以不进行同步。It should be understood that the data synchronization in the embodiments of the present application refers to the synchronization of metadata, that is, the attribute information of the data that is synchronously changed between devices, such as the storage location and other information, and the specific data may not be synchronized.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
本申请实施例的技术方案可以应用于各种通信系统,例如:全球移动通信(global system for mobile communications,GSM)系统、码分多址(code division multiple access,CDMA)系统、宽带码分多址(wideband code division multiple access,WCDMA)系统、通用分组无线业务(general packet radio service,GPRS)、长期演进(long term evolution,LTE)系统、LTE频分双工(frequency division duplex,FDD)系统、LTE时分双工(time division duplex,TDD)、通用移动通信系统(universal mobile telecommunication system,UMTS)、全球互联微波接入(worldwide interoperability for microwave access,WiMAX)通信系统、第五代(5th generation,5G)系统或新无线(new radio,NR),此外,还可以适用于使用后续的演进系统,如第六代6G通信系统、甚至更高级的第七代7G通信系统等。The technical solutions of the embodiments of the present application can be applied to various communication systems, for example: global system for mobile communications (GSM) system, code division multiple access (CDMA) system, wideband code division multiple access (wideband code division multiple access, WCDMA) system, general packet radio service (general packet radio service, GPRS), long term evolution (long term evolution, LTE) system, LTE frequency division duplex (frequency division duplex, FDD) system, LTE Time division duplex (TDD), universal mobile telecommunication system (UMTS), worldwide interoperability for microwave access (WiMAX) communication system, 5th generation (5G) system or new radio (NR), in addition, it can also be applied to use subsequent evolution systems, such as the sixth-generation 6G communication system, or even the more advanced seventh-generation 7G communication system.
本申请实施例中的终端设备也可以称为:用户设备(user equipment,UE)、移动台(mobile station,MS)、移动终端(mobile terminal,MT)、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置等。The terminal equipment in the embodiments of the present application may also be referred to as: user equipment (user equipment, UE), mobile station (mobile station, MS), mobile terminal (mobile terminal, MT), access terminal, subscriber unit, subscriber station, Mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, etc.
终端设备可以是无线终端也可以是有线终端,无线终端可以是指向用户提供语音和/或其他业务数据连通性的设备,具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。无线终端可以经无线接入网(Radio Access Network,RAN)与一个或多个核心网进行通信,无线终端可以是移动终端,如移动电话(或称为“蜂窝”电话)和具有移动终端的计算机,例如,可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语言和/或数据。例如,个人通信业务(Personal Communication Service,PCS)电话、无绳电话、会话发起协议(Session Initiation Protocol,SIP)话机、无线本地环路(Wireless Local Loop,WLL)站、个人数字助理(Personal Digital Assistant,PDA)等设备。无线终端也可以称为系统、订户单元(Subscriber Unit)、订户站(Subscriber Station),移动站(Mobile Station)、移动台(Mobile)、远程站(Remote Station)、远程终端(Remote Terminal)、接入终端(Access Terminal)、用户终端(User Terminal)、用户代理(User Agent)、用户设备(User Device or User Equipment),移动互联网设备(mobile internet device,MID)、可穿戴设备,虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终 端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、车载设备、可穿戴设备,5G网络中的终端设备或者未来演进的公用陆地移动通信网络(public land mobile network,PLMN)中的终端设备等,本申请实施例对此并不限定。The terminal device can be a wireless terminal or a wired terminal, and the wireless terminal can be a device that provides voice and/or other service data connectivity to the user, a handheld device with wireless connection function, or other processing device connected to a wireless modem. A wireless terminal may communicate with one or more core networks via a Radio Access Network (RAN), and the wireless terminal may be a mobile terminal such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal Mobile devices, which may be portable, pocket-sized, hand-held, computer-embedded, or vehicle-mounted, for example, exchange language and/or data with the wireless access network. For example, Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (Personal Digital Assistants), PDA) and other devices. A wireless terminal may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, a connection Access Terminal, User Terminal, User Agent, User Device or User Equipment, mobile internet device (MID), wearable device, virtual reality (virtual reality) reality, VR) equipment, augmented reality (AR) equipment, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery , wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, in-vehicle equipment, wearable equipment, terminal equipment in a 5G network, or terminal equipment in a future evolved public land mobile network (public land mobile network, PLMN), etc., which are not limited in the embodiments of the present application.
作为示例而非限定,在本申请实施例中,可穿戴设备也可以称为穿戴式智能设备,是应用穿戴式技术对日常穿戴进行智能化设计、开发出可以穿戴的设备的总称,如眼镜、手套、手表、服饰及鞋等。可穿戴设备即直接穿在身上,或是整合到用户的衣服或配件的一种便携式设备。可穿戴设备不仅仅是一种硬件设备,更是通过软件支持以及数据交互、云端交互来实现强大的功能。广义穿戴式智能设备包括功能全、尺寸大、可不依赖智能手机实现完整或者部分的功能,例如:智能手表或智能眼镜等,以及只专注于某一类应用功能,需要和其它设备如智能手机配合使用,如各类进行体征监测的智能手环、智能首饰等。As an example and not a limitation, in the embodiments of this application, a wearable device may also be referred to as a wearable smart device, which is a general term for intelligently designing daily wearable devices and developing wearable devices using wearable technology, such as glasses, Gloves, watches, clothing and shoes, etc. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothing or accessories. Wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction. In a broad sense, wearable smart devices include full-featured, large-scale, complete or partial functions without relying on smart phones, such as smart watches or smart glasses, and only focus on a certain type of application function, which needs to cooperate with other devices such as smart phones. Use, such as all kinds of smart bracelets, smart jewelry, etc. for physical sign monitoring.
此外,在本申请实施例中,终端设备还可以是物联网(internet of things,IoT)系统中的终端设备,IoT是未来信息技术发展的重要组成部分,其主要技术特点是将物品通过通信技术与网络连接,从而实现人机互连,物物互连的智能化网络。In addition, in the embodiments of the present application, the terminal device may also be a terminal device in an Internet of Things (IoT) system. IoT is an important part of the future development of information technology, and its main technical feature is that items pass through communication technology Connect with the network, so as to realize the intelligent network of human-machine interconnection and interconnection of things.
而如上介绍的各种终端设备,如果位于车辆上(例如放置在车辆内或安装在车辆内),都可以认为是车载终端设备,车载终端设备例如也称为车载单元(on-board unit,OBU)。The various terminal devices described above, if they are located on the vehicle (for example, placed in the vehicle or installed in the vehicle), can be considered as on-board terminal equipment. For example, the on-board terminal equipment is also called on-board unit (OBU). ).
本申请实施例中,终端设备还可以包括中继(relay)。或者理解为,能够与基站进行数据通信的都可以看作终端设备。In this embodiment of the present application, the terminal device may further include a relay (relay). Alternatively, it can be understood that any device capable of data communication with the base station can be regarded as a terminal device.
下面对本申请实施例的一种应用场景进行介绍,图2示出了本申请实施例的一种应用场景100的示意图。在图2中包括终端设备110、终端设备120、终端设备130和终端设备140。其中,该终端设备110、该终端设备120、该终端设备130和该终端设备140组成了移动分布式系统。An application scenario of the embodiment of the present application is introduced below. FIG. 2 shows a schematic diagram of an application scenario 100 of the embodiment of the present application. In FIG. 2 , a terminal device 110 , a terminal device 120 , a terminal device 130 , and a terminal device 140 are included. The terminal device 110, the terminal device 120, the terminal device 130 and the terminal device 140 constitute a mobile distributed system.
图2中的终端设备可以是智能手机,也可以是笔记本电脑,还可以是车载电脑等其他终端设备,图1所示的移动分布式系统中包括的终端设备可以是上述各种形式的终端设备。The terminal device in FIG. 2 may be a smart phone, a notebook computer, or other terminal devices such as a vehicle-mounted computer, and the terminal device included in the mobile distributed system shown in FIG. 1 may be the above-mentioned various forms of terminal devices .
应理解,图2所示的移动分布式系统中还可以包括更多的终端设备。本申请实施例在图中不再一一示出。It should be understood that the mobile distributed system shown in FIG. 2 may also include more terminal devices. The embodiments of the present application are not shown one by one in the drawings.
该移动分布式系统具备以下特点:The mobile distributed system has the following characteristics:
移动分布式系统是对等结构的分布式,系统成员设备是平等的,不存在主从关系;The mobile distributed system is distributed in a peer-to-peer structure, and the member devices of the system are equal, and there is no master-slave relationship;
移动分布式系统由手机、手表、TV、车机、音响等智能终端设备组成,这些终端设备是移动分布式系统的成员设备;The mobile distributed system is composed of smart terminal devices such as mobile phones, watches, TVs, car machines, and stereos. These terminal devices are member devices of the mobile distributed system;
移动分布式系统是松散系统,不要求系统成员设备实时在线;The mobile distributed system is a loose system, which does not require the real-time online of system member devices;
移动分布式系统的应用、服务、数据等资源分散部署在不同的系统成员设备上;系统成员设备可用的资源包含本地资源和分布式资源,每个成员设备保持系统数据信息的同步;The application, service, data and other resources of the mobile distributed system are scattered and deployed on different system member devices; the resources available to the system member devices include local resources and distributed resources, and each member device maintains the synchronization of system data information;
移动分布式系统成员设备在线时,在线的成员设备可以分享本地资源(本设备的应用、服务、数据等资源)给移动分布式系统中的其它成员设备;同时用户可通过在线的成员设备无感的使用分布式资源(移动分布式系统中其他成员设备的应用、服务、数据等资源);When the member devices of the mobile distributed system are online, the online member devices can share local resources (applications, services, data and other resources of the device) to other member devices in the mobile distributed system; use of distributed resources (mobile applications, services, data and other resources of other member devices in the distributed system);
移动分布式系统成员设备离线时,该离线的成员设备的用户仍然可以使用该离线设备的本地资源(如本设备的应用、服务、数据等资源);When the member device of the mobile distributed system is offline, the user of the offline member device can still use the local resources of the offline device (such as the application, service, data and other resources of the device);
移动分布式系统成员设备重新上线后,重新上线的成员设备可以根据本地数据资源状态(本地数据资源状态为本地所记录的本地数据资源的变化)分享本地资源给移动分布式 系统中的其他成员设备,并且分布式系统的其他成员设备也可以根据其他成员设备的本地数据资源状态将数据资源分享给重新上线的成员设备;After the member devices of the mobile distributed system are back online, the re-connected member devices can share the local resources to other member devices in the mobile distributed system according to the local data resource status (the local data resource status is the change of the local data resources recorded locally). , and other member devices of the distributed system can also share data resources to the re-online member devices according to the local data resource status of other member devices;
移动分布式系统的成员设备通过分布式中间件交互,其中分布式中间件用于实现分布式系统各成员设备之间的交互,如无线网络,实现本地数据资源和分布式数据资源的一致性、本地数据资源和分布式数据资源的可用性、成员设备全状态(在线/离线)下的资源有效性/容错性。The member devices of the mobile distributed system interact through distributed middleware, wherein the distributed middleware is used to realize the interaction between the member devices of the distributed system, such as wireless network, to realize the consistency of local data resources and distributed data resources, Availability of local data resources and distributed data resources, resource availability/fault tolerance under the full state (online/offline) of member devices.
其中,一致性、可用性和分区容错性是分布式系统(传统分布式系统和移动分布式系统)数据同步需要满足的要求。下面分别进行介绍:Among them, consistency, availability and partition fault tolerance are the requirements for data synchronization of distributed systems (traditional distributed systems and mobile distributed systems). The following are respectively introduced:
分区容错:大多数分布式系统都分布在多个子网络。每个子网络就叫做一个区(partition)。分区容错的意思是区间之间会出现失去连接,通信可能存在失败的情况。Partition Tolerance: Most distributed systems are spread across multiple subnetworks. Each subnet is called a partition. Partition fault tolerance means that there will be a loss of connection between intervals, and communication may fail.
一致性是指写操作之后的读操作,必须返回该值。图3具体说明一致性的要求,图3中G1和G2分别为分布式系统的两台服务器。图3a中,分布式系统某条记录是v0,用户向G1发起一个写操作,将其改为v1。接下来,用户的读操作就会得到v1,如图3a所示。Consistency means that a read followed by a write must return this value. Figure 3 specifically illustrates the requirements for consistency. In Figure 3, G1 and G2 are respectively two servers of a distributed system. In Figure 3a, a record in the distributed system is v0, and the user initiates a write operation to G1 to change it to v1. Next, the user's read operation will get v1, as shown in Figure 3a.
用户有可能向G2发起读操作,由于G2的值没有发生变化,因此返回的是v0。G1和G2读操作的结果不一致,这就不满足一致性了,如图3b所示。It is possible for the user to initiate a read operation to G2. Since the value of G2 has not changed, v0 is returned. The results of the G1 and G2 read operations are inconsistent, which does not satisfy the consistency, as shown in Figure 3b.
为了让G2也能变为v1,就要在G1写操作的时候,让G1向G2发送一条消息,要求G2也改成v1。这样当用户向G2发起读操作,也能得到v1,如图3c所示。In order to make G2 also change to v1, when G1 writes, let G1 send a message to G2, requesting that G2 also change to v1. In this way, when the user initiates a read operation to G2, v1 can also be obtained, as shown in Figure 3c.
可用性是指只要收到用户的请求,服务器就必须给出回应。用户可以选择向G1或G2发起读操作。不管是哪台服务器,只要收到请求,就必须告诉用户,到底是v0还是v1,否则就不满足可用性。Availability means that as long as a user's request is received, the server must respond. The user can choose to initiate a read operation to G1 or G2. No matter which server it is, as long as it receives a request, it must tell the user whether it is v0 or v1, otherwise the availability will not be satisfied.
应理解,移动分布式系统包括的设备可以是可移动的终端设备,也可以包括固定的不可移动的终端设备。移动分布式系统根据其结构特点还可以称为对等式分布式系统。It should be understood that the devices included in the mobile distributed system may be movable terminal devices, and may also include fixed and immovable terminal devices. The mobile distributed system can also be called a peer-to-peer distributed system according to its structural characteristics.
传统分布式系统一般是主从结构;传统分布式系统由多个服务器组成;传统分布式系统要求系统成员设备实时在线等。由此可见,移动式分布式系统不同于传统分布式系统。Traditional distributed systems are generally master-slave structures; traditional distributed systems consist of multiple servers; traditional distributed systems require system member devices to be online in real time. It can be seen that the mobile distributed system is different from the traditional distributed system.
传统分布式系统数据同步一般采用两种标准化的数据同步协议,分别是Raft协议和Paxos协议。Raft协议是经典分布式一致性算法,强Leader型算法。每个节点有“主节点”、“候选节点”、“从节点”三个状态,可以在三个状态之间变换。客户端只能从主节点写数据,从节点里读数据。它的吞吐量基本就是Leader的吞吐量,它无法抵御节点恶意篡改数据的攻击。Raft协议只支持主从结构分布式,支持分布式一致性与可用性,在连接状态时,支持分区容错性,在断开状态时,服务器不提供本地服务。移动分布式系统是对等结构分布式,要求成员设备离线时仍然可用,如手机断网时仍然可以拍照、编辑图片等。所以Raft不满足移动分布式系统成员设备离线状态时保持本地资源可用和本地资源有效性的诉求。Traditional distributed system data synchronization generally adopts two standardized data synchronization protocols, namely Raft protocol and Paxos protocol. The Raft protocol is a classic distributed consensus algorithm, a strong leader-type algorithm. Each node has three states: "master node", "candidate node", and "slave node", which can be transformed between the three states. The client can only write data from the master node and read data from the node. Its throughput is basically the throughput of the leader, and it cannot resist attacks by nodes maliciously tampering with data. The Raft protocol only supports the distributed master-slave structure, supports distributed consistency and availability, supports partition fault tolerance in the connected state, and does not provide local services in the disconnected state. The mobile distributed system is distributed in a peer-to-peer structure, and requires member devices to be available even when they are offline. Therefore, Raft does not meet the demands of keeping local resources available and valid when the member devices of the mobile distributed system are offline.
Paxos协议算法能提供不同场合不同种类的一致性算法。Paxos协议把每次数据请求比喻成一次提案(proposal),每个提案都有一个独立的编号,提案会转发到提交者(Proposer)来提交,提案必须经过投票委员会(Quorum)接受才会生效,投票委员会中的节点叫做Acceptor。角色分为proposers,acceptors(允许身兼数职):proposers提出提案,提案信息包括提案编号和提议的value;acceptor收到提案后可以接受(accept)提案。若提案获得多数acceptors的接受,则称该提案被批准(chosen)。Paxos支持对等结构分布式,但 不支持异步同步,成员重新上线后,必须无条件和分布式系统保持数据一致。移动分布式系统成员设备重新上线后,要求能够上传本地数据资源和本地数据资源状态,如手机断网时拍摄的照片、编辑的图片等信息在接入系统后,能够分享给其他成员设备。所以Paxos不满足移动分布式系统成员设备重新上线时保持本地数据资源一致性和本地数据资源有效性/容错性的诉求。The Paxos protocol algorithm can provide different types of consensus algorithms for different occasions. The Paxos protocol compares each data request to a proposal. Each proposal has an independent number. The proposal will be forwarded to the submitter (Proposer) for submission. The proposal must be accepted by the voting committee (Quorum) to take effect. The nodes in the voting committee are called Acceptors. The roles are divided into proposers and acceptors (allowing to hold multiple positions): proposers propose proposals, and the proposal information includes proposal number and proposed value; acceptors can accept the proposal after receiving it. If a proposal is accepted by a majority of the acceptors, the proposal is said to be chosen. Paxos supports peer-to-peer structure distribution, but does not support asynchronous synchronization. After members come back online, they must maintain data consistency with the distributed system unconditionally. After the member devices of the mobile distributed system are back online, they are required to be able to upload local data resources and local data resource status, such as photos taken when the mobile phone is disconnected from the network, edited pictures and other information can be shared with other member devices after accessing the system. Therefore, Paxos does not meet the requirements of maintaining the consistency of local data resources and the validity/fault tolerance of local data resources when the member devices of the mobile distributed system come back online.
Paxos的改进方法fast Paxos,multi Paxos提供主从分布式系统,部分支持异步同步(这里所说的异步同步是指数据同步不是实时同步),和Raft类似,不支持对等结构分布式,不满足移动分布式系统成员设备离线状态时保持本地资源可用和本地资源有效性的诉求,且未考虑分区容错的情况。The improved method of Paxos fast Paxos, multi Paxos provides a master-slave distributed system, which partially supports asynchronous synchronization (the asynchronous synchronization mentioned here refers to data synchronization not real-time synchronization), similar to Raft, does not support peer-to-peer structure distribution, does not satisfy The demand for keeping local resources available and local resources valid when the member devices of the mobile distributed system are offline, and does not consider the case of partition fault tolerance.
有鉴于此,本申请提出了一种移动分布式系统数据同步的方法和终端设备,该方法用于实现移动分布式系统的数据同步。In view of this, the present application proposes a method and terminal device for data synchronization of a mobile distributed system, and the method is used to realize data synchronization of a mobile distributed system.
移动分布式操作系统数据同步方法处理的目标数据主要包括同步记录。其中,同步记录(Synchronous recording)包括同步节点,更改列表(Change list),设备列表(device list)。同步记录可以存储于数据库,文件系统,内存中等。The target data processed by the mobile distributed operating system data synchronization method mainly includes synchronization records. Among them, the synchronization record (Synchronous recording) includes the synchronization node, the change list (Change list), and the device list (device list). Synchronization records can be stored in databases, file systems, memory, etc.
同步节点:每次数据批量同步的时候会形成一条同步记录节点。一条同步记录包括一个同步节点。该同步节点包含同步节点标识(Identity Document,ID)(以下简称同步节点ID,用于标识本次数据同步,区别于其他时间的数据同步)、同步时间戳(本次数据同步的发生时间)、父同步节点标识ID(上一次数据同步的同步ID)、本次同步变更内容、本次同步的设备。Synchronization node: A synchronization record node is formed each time the data is synchronized in batches. A synchronization record includes a synchronization node. The synchronization node includes a synchronization node identifier (Identity Document, ID) (hereinafter referred to as the synchronization node ID, which is used to identify this data synchronization, which is different from data synchronization at other times), a synchronization timestamp (the occurrence time of this data synchronization), The ID of the parent synchronization node (the synchronization ID of the last data synchronization), the content changed in this synchronization, and the device to be synchronized this time.
更改列表:记录每次媒体资产的变更内容,一旦生成则不可变更,该媒体资产的变更可以是设备本身媒体资产的变更,如设备A录制了音频A,则设备A上的更改列表会记录设备A录制音频A;该媒体资产的变更也可以是进行同步的设备的媒体资产的变更,如设备A与设备B进行数据同步,设备B创建了音频B,则设备A上的更改列表会记录音频B;更改列表包括更改列表ID和媒体资产变更内容,其中,所述媒体资产变更内容包括发生变更的媒体资产和媒体资产变更对应的动作。其中,更改列表ID用于标识本次媒体资产更改,区别于其他时间的媒体资产更改,媒体资产指的是设备上的多种不同格式的文件,如音频、视频、图片等文件。媒体资产对应的动作可以是创建、修改、删除、移动等常规操作日志(创建、修改、删除、移动等都属于一种日志),也可以是扩展属性的变更操作日志,如修改文件大小的变更操作日志,或者其他类型的日志,如更改文件访问权限的日志。在更改列表中,还可以包括更改的内容的属性信息,例如,更改内容为创建图片A,则更改内容还包括该图片A的大小,格式,存储路径,作者,创建时间等多种属性信息。更改列表是每个设备上自身存在的记录媒体资产变更的列表,更改列表可以存储于数据库,文件系统,内存中等。Change list: record the content of each media asset change. Once generated, it cannot be changed. The change of the media asset can be the change of the media asset of the device itself. For example, if device A records audio A, the change list on device A will record the device. A records audio A; the change of the media asset can also be a change of the media asset of the device that is synchronizing. For example, if device A synchronizes data with device B, and device B creates audio B, the change list on device A will record the audio B; the change list includes a change list ID and media asset change content, wherein the media asset change content includes a changed media asset and an action corresponding to the media asset change. The change list ID is used to identify the current media asset change, which is different from media asset changes at other times. Media assets refer to files in various formats on the device, such as audio, video, and image files. Actions corresponding to media assets can be regular operation logs such as creation, modification, deletion, and movement (creation, modification, deletion, and movement are all logs), or change operation logs of extended attributes, such as modification of file size. Operational logs, or other types of logs such as changes to file access permissions. The change list can also include attribute information of the changed content. For example, if the changed content is to create picture A, the changed content also includes various attribute information such as the size, format, storage path, author, and creation time of the picture A. A change list is a list of recorded media asset changes that exist on each device itself, and the change list can be stored in a database, file system, memory, etc.
设备列表:记录进行本次数据同步的设备或节点,设备列表可以包括:设备列表ID和设备ID。设备列表ID用于标识本次数据同步的设备列表,区别于其他时间数据同步的设备列表,设备ID用于标识设备,不同设备的设备标识不同。Device list: record the device or node for this data synchronization. The device list can include: device list ID and device ID. The device list ID is used to identify the device list of this data synchronization, which is different from the device list of other time data synchronization. The device ID is used to identify the device, and the device ID of different devices is different.
对同步记录进行的操作包括顶(TOP)节点更新、根(Root)节点更新、设备列表删除、临时中间(Middle)节点创建四类操作。The operations performed on the synchronization record include four types of operations: top (TOP) node update, root (Root) node update, device list deletion, and temporary middle (Middle) node creation.
TOP节点更新:新的数据同步发生时,创建新的TOP节点,原TOP节点蜕变为中间 节点。下面通过图4具体说明TOP节点更新过程。如图4所示,设备D首次进行数据批量同步时会创建根Root节点,新的数据同步发生时,创建TOP节点,TOP节点与Root节点之间的节点为中间节点。TOP node update: When new data synchronization occurs, a new TOP node is created, and the original TOP node is transformed into an intermediate node. The TOP node update process is specifically described below with reference to FIG. 4 . As shown in Figure 4, when device D performs batch data synchronization for the first time, a root Root node is created. When a new data synchronization occurs, a TOP node is created. The node between the TOP node and the Root node is an intermediate node.
如设备D在第一时刻与设备A进行数据同步,示例性的,本次数据同步为设备D第一次进行的数据同步,同步的内容为同步设备A上的文件A。则设备D创建Root节点,如图4a所示。If device D performs data synchronization with device A at the first moment, for example, this data synchronization is the first data synchronization performed by device D, and the content of synchronization is to synchronize file A on device A. Then device D creates a Root node, as shown in Figure 4a.
Root节点包括以下信息:The Root node includes the following information:
同步ID:S XSync ID: S X ;
时间戳:第一时刻;Timestamp: the first moment;
同步父ID:空;其中,同步父ID是指本次数据同步的相邻的上一次数据同步的同步节点标识,因为本次数据同步为设备D第一次进行的数据同步,所以同步父ID为空。Synchronization parent ID: null; the synchronization parent ID refers to the synchronization node identifier of the adjacent last data synchronization of this data synchronization. Because this data synchronization is the first data synchronization performed by device D, the synchronization parent ID is Is empty.
本次同步变更内容:文件A的索引;The content of this synchronization change: the index of file A;
本次同步的设备:设备A的索引。The device to be synchronized this time: the index of device A.
如设备D在第二时刻与设备B进行数据同步,示例性的,本次数据同步为设备D第二次进行的数据同步,同步的内容为同步设备B上的文件B。则设备D创建新的TOP节点,如图4b所示。For example, if device D performs data synchronization with device B at the second moment, exemplarily, this data synchronization is the second data synchronization performed by device D, and the content of synchronization is to synchronize file B on device B. Then device D creates a new TOP node, as shown in Figure 4b.
新的TOP节点包括以下信息:The new TOP node includes the following information:
同步ID:S ySync ID: S y ;
时间戳:第二时刻;Timestamp: second moment;
同步父ID:S xSync Parent ID: S x ;
本次同步变更内容:文件B的索引;The content of this synchronization change: the index of file B;
本次同步的设备:设备B的索引。The device to be synchronized this time: the index of device B.
如设备D在第三时刻与设备C进行数据同步,示例性的,本次数据同步为设备D第二次进行的数据同步,同步的内容为同步设备C上的文件C。则设备D创建新的TOP节点,原TOP节点S y蜕变为中间节点,如图4c所示。 For example, if device D performs data synchronization with device C at the third moment, exemplarily, this data synchronization is the second data synchronization performed by device D, and the content of synchronization is to synchronize file C on device C. Then the device D creates a new TOP node, and the original TOP node S y is transformed into an intermediate node, as shown in Figure 4c.
新的TOP节点包括以下信息:The new TOP node includes the following information:
同步ID:S y+1Sync ID: S y+1 ;
时间戳:第三时刻;Timestamp: the third moment;
同步父ID:S ySync Parent ID: S y ;
本次同步变更内容:文件C的索引;The content of this synchronization change: the index of file C;
本次同步的设备:设备C的索引。The device to be synchronized this time: the index of device C.
应理解,在同步节点列表包括本次同步变更内容中还可以记录本次同步变更内容的属性信息,例如,本次同步内容为创建图片A,则更改内容还包括该图片A的大小,格式,存储路径等多种属性信息。It should be understood that, in the synchronization node list including this synchronization change content, the attribute information of this synchronization change content can also be recorded. For example, if the synchronization content this time is to create picture A, the change content also includes the size and format of the picture A, Storage path and other attribute information.
还应理解,本次同步变更内容中可以记录本次同步变更的具体内容,本次同步的设备中可以记录本次同步的设备的标识ID。It should also be understood that the specific content of this synchronization change may be recorded in the content of the synchronization change this time, and the identification ID of the device synchronized this time may be recorded in the device synchronized this time.
还应理解,本次同步变更内容和本次同步的设备中记录的可以是更改列表的索引和设备列表的索引,根据该更改列表的索引和该设备列表的索引可以查找到本次数据同步对应的更改列表和设备列表。如本次同步变更内容为更改列表存储位置的指针,根据该指针可 以指向该更改列表,本次同步的设备可以是设备列表存储位置的指针,根据该指针可以指向该设备列表。It should also be understood that what is recorded in the content of this synchronization change and the device to be synchronized this time can be the index of the change list and the index of the device list, and the corresponding data synchronization can be found according to the index of the change list and the index of the device list. list of changes and devices. If the content of this synchronization change is a pointer to the storage location of the change list, the pointer can point to the change list, and the device to be synchronized this time can be a pointer to the storage location of the device list, and this pointer can point to the device list.
还应理解,本次同步变更内容中可以记录本次同步变更内容的索引,本次同步的设备中可以记录与本次同步的设备的相关的索引,本次同步变更内容的索引用于查找本次媒体资产变更内容,与本次同步的设备的相关的索引用于查找与本次同步的设备相关的信息。It should also be understood that the index of the content of this synchronization change can be recorded in the content of this synchronization change, the index related to the device of this synchronization can be recorded in the device of this synchronization, and the index of the content of this synchronization change can be used to find this time. When the content of the secondary media asset is changed, the index related to the device to be synchronized this time is used to search for information related to the device to be synchronized this time.
Device List节点删除:如果中间节点设备列表中设备减为零,可以删除当前设备列表。Device List node deletion: If the device in the intermediate node device list is reduced to zero, the current device list can be deleted.
下面通过图5具体说明设备列表删除过程。如图5所示,移动分布式系统包括设备A、设备B、设备C和设备D,设备A与该移动分布式系统包括的其他设备已经进行了数据同步,在设备A上的同步记录中已经创建了同步节点、更改列表和设备列表,如图5a所示,其中同步节点中包括:The following is a detailed description of the device list deletion process with reference to FIG. 5 . As shown in Figure 5, the mobile distributed system includes device A, device B, device C, and device D. Device A has performed data synchronization with other devices included in the mobile distributed system. In the synchronization record on device A, data has been synchronized. A sync node, change list, and device list are created, as shown in Figure 5a, where the sync node includes:
Root节点S XRoot node S X ,
Root节点S X对应的更改列表包括: The list of changes corresponding to the Root node S X includes:
更改列表ID:C xchangelist id: C x ;
Root节点对应的设备列表包括:The device list corresponding to the Root node includes:
设备列表ID:D xDevice List ID: D x ;
中间节点S yintermediate node S y ,
中间节点S y对应的更改列表包括: The change list corresponding to the intermediate node S y includes:
更改列表ID:C yChangelist ID: Cy ;
中间节点S y对应的设备列表包括: The device list corresponding to the intermediate node S y includes:
设备列表ID:D yDevice List ID: D y ,
设备ID:设备D;Device ID: Device D;
Top节点S y+1Top node S y+1 ,
Top节点S y+1对应的更改列表包括: The list of changes corresponding to the Top node S y+1 includes:
更改列表ID:C y+1change list id: C y+1 ;
Top节点S y+1对应的设备列表包括: The device list corresponding to the Top node S y+1 includes:
设备列表ID:D y+1Device List ID: D y+1 ,
设备ID:设备B和设备C。Device ID: Device B and Device C.
当前,设备D数据发生变化,设备D需要与设备A进行数据同步,设备A上的同步记录中会产生新的Top节点S y+2,原Top节点S y+1蜕变为中间节点, At present, when the data of device D changes, device D needs to synchronize data with device A. A new top node S y+2 will be generated in the synchronization record on device A, and the original top node S y+1 will be transformed into an intermediate node.
Top节点S y+2对应的更改列表包括: The list of changes corresponding to the Top node S y+2 includes:
更改列表ID:C y+2change list id: C y+2 ;
Top节点S y+2对应的设备列表包括: The device list corresponding to the Top node S y+2 includes:
设备列表ID:D y+2Device List ID: D y+2 ,
设备ID:设备D。Device ID: Device D.
设备A与设备D完成本次数据同步后,可以删除中间节点S y对应的设备列表D y中的设备D,如图5b所示,保留与设备D进行数据同步的最新的设备列表的记录,有助于设备A下次与设备D进行数据同步时可以更快确定前一次的数据同步的内容,并且设备A与设备D进行数据同步的信息会记录在更改列表中,因此删掉设备列表D y中的设备D不会对中间节点Sy进行的数据同步产生任何影响。 After device A and device D complete this data synchronization, the device D in the device list D y corresponding to the intermediate node S y can be deleted, as shown in FIG. This will help device A to determine the content of the previous data synchronization faster when synchronizing data with device D next time, and the information about data synchronization between device A and device D will be recorded in the change list, so delete device list D Device D in y will not have any effect on data synchronization by intermediate node Sy.
当删除设备列表D y中的设备D后,设备列表D y中设备减为零,可以删除当前设备列表Dy,如图5c所示。 After the device D in the device list Dy is deleted, the device in the device list Dy is reduced to zero, and the current device list Dy can be deleted, as shown in Figure 5c.
Root节点更新:Root节点设备列表中设备减为零,删除本Root节点,相邻中间节点成为新Root节点。Root node update: The device in the root node device list is reduced to zero, the root node is deleted, and the adjacent intermediate node becomes the new root node.
下面通过图6具体说明根节点更新过程。如图6所示,移动分布式系统包括设备A、设备B、设备C和设备D,设备A与该移动分布式系统包括的其他设备已经进行了数据同步,在设备A上的同步记录中已经创建了同步节点、更改列表和设备列表,如图6a所示,其中同步节点中包括:The root node update process is specifically described below with reference to FIG. 6 . As shown in Figure 6, the mobile distributed system includes device A, device B, device C, and device D. Device A has performed data synchronization with other devices included in the mobile distributed system. In the synchronization record on device A, data has been synchronized. A sync node, change list, and device list are created, as shown in Figure 6a, where the sync node includes:
Root节点S XRoot node S X ,
Root节点S X对应的更改列表包括: The list of changes corresponding to the Root node S X includes:
更改列表ID:C xchangelist id: C x ;
Root节点对应的设备列表包括:The device list corresponding to the Root node includes:
设备列表ID:D xDevice List ID: D x ;
设备ID:设备D;Device ID: Device D;
中间节点S yintermediate node S y ,
中间节点S y对应的更改列表包括: The change list corresponding to the intermediate node S y includes:
更改列表ID:C yChangelist ID: Cy ;
中间节点S y对应的设备列表包括: The device list corresponding to the intermediate node S y includes:
设备列表ID:D yDevice List ID: D y ,
设备ID:设备B;Device ID: Device B;
Top节点S y+1Top node S y+1 ,
Top节点S y+1对应的更改列表包括: The list of changes corresponding to the Top node S y+1 includes:
更改列表ID:C y+1change list id: C y+1 ;
Top节点S y+1对应的设备列表包括: The device list corresponding to the Top node S y+1 includes:
设备列表ID:D y+1Device List ID: D y+1 ,
设备ID:设备C。Device ID: Device C.
当前,设备D数据发生变化,设备D需要与设备A进行数据同步,设备A上的同步记录中会产生新的Top节点S y+2,原Top节点S y+1蜕变为中间节点,Top节点S y+2对应的更改列表包括: At present, when the data of device D changes, device D needs to synchronize data with device A. A new top node S y+2 will be generated in the synchronization record on device A, and the original top node S y+1 will be transformed into an intermediate node, and the top node The list of changes corresponding to S y+2 includes:
更改列表ID:C y+2change list id: C y+2 ;
Top节点S y+2对应的设备列表包括: The device list corresponding to the Top node S y+2 includes:
设备列表ID:D y+2Device List ID: D y+2 ,
设备ID:设备D。Device ID: Device D.
设备A与设备D完成本次数据同步后,可以删除根节点S x对应的设备列表D x中的设备D,如图6b所示。当删除设备列表D x中的设备D后,设备列表D x中设备减为零,可以删除根节点S X,相邻的中间节点S y为新的根节点,如图6c所示,其中,删除根节点只是删除了根节点的ID,但根节点包括的内容如同步时间戳、同步父ID、本次同步变更内容、本次同步的设备等还保留。 After the device A and the device D complete this data synchronization, the device D in the device list Dx corresponding to the root node Sx can be deleted, as shown in FIG. 6b. When the device D in the device list Dx is deleted, the device in the device list Dx is reduced to zero, the root node Sx can be deleted, and the adjacent intermediate node Sy is the new root node, as shown in Figure 6c, where, Deleting the root node only deletes the ID of the root node, but the contents included in the root node, such as the synchronization timestamp, the synchronization parent ID, the content changed in this synchronization, and the devices synchronized this time, are still retained.
临时中间节点创建:数据同步过程异常终止,创建临时中间节点。数据同步过程异常 终止可以是同步数据出错,数据同步过程终止;也可以是进行数据同步的设备突然发生故障,数据同步过程终止。在数据同步过程异常终止时,可标记原进行数据同步的TOP节点为临时中间节点,临时中间节点中包含临时状态标识,临时中间节点用于保存未完成数据同步的同步数据,当再次数据同步完成后,可以删除临时中间节点。Temporary intermediate node creation: The data synchronization process terminates abnormally, and a temporary intermediate node is created. The abnormal termination of the data synchronization process can be caused by an error in the synchronization data, and the data synchronization process is terminated; When the data synchronization process is abnormally terminated, the TOP node that originally performed data synchronization can be marked as a temporary intermediate node. The temporary intermediate node contains a temporary status identifier. The temporary intermediate node is used to save the synchronization data that has not completed data synchronization. When the data synchronization is completed again After that, the temporary intermediate node can be deleted.
下面,以两个设备之间的数据同步为例,对本申请的移动分布式系统有状态数据同步方法进行说明。Hereinafter, the stateful data synchronization method of the mobile distributed system of the present application will be described by taking the data synchronization between two devices as an example.
实施例一主要描述当移动分布式系统中的设备A没有数据变更,设备B有数据的变更时,设备A与设备B如何进行数据同步。The first embodiment mainly describes how to synchronize data between device A and device B when there is no data change in device A in the mobile distributed system and data change in device B.
移动分布式系统包括设备A与设备B,设备A与该移动分布式系统包括的其他设备已经进行了数据同步,设备B也与该移动分布式系统包括的其他设备已经进行了数据同步,具体如图7所示,图7是本申请实施例的设备A与其他设备已经进行了数据同步和设备B与其他设备已经进行了数据同步的示意性框图。The mobile distributed system includes device A and device B, device A has performed data synchronization with other devices included in the mobile distributed system, and device B has also performed data synchronization with other devices included in the mobile distributed system. As shown in FIG. 7 , FIG. 7 is a schematic block diagram showing that device A and other devices have performed data synchronization and device B and other devices have performed data synchronization according to an embodiment of the present application.
在设备A上的同步记录中已经创建了多个同步节点、多个更改列表和多个设备列表,如:Multiple sync nodes, multiple change lists, and multiple device lists have been created in the sync record on device A, such as:
Root节点S X,Root节点S X对应的更改列表包括:更改列表ID:C x;Root节点的同步记录对应的设备列表包括:设备列表ID:D xRoot node S X , the change list corresponding to the Root node S X includes: change list ID: C x ; the device list corresponding to the synchronization record of the Root node includes: device list ID: D x ;
中间节点S y,中间节点S y对应的更改列表包括:更改列表ID:C y;中间节点的同步记录对应的设备列表包括:设备列表ID:D yFor the intermediate node S y , the change list corresponding to the intermediate node S y includes: change list ID: C y ; the device list corresponding to the synchronization record of the intermediate node includes: device list ID: D y ;
Top节点S y+1,Top节点S y+1的同步记录对应的更改列表包括:更改列表ID:C y+1;Top节点S y+1的同步记录对应的设备列表包括:设备列表ID:D y+1,设备ID:设备D(设备ID为设备D表示本次数据同步是设备A同步了设备D的数据)。 Top node S y+1 , the change list corresponding to the synchronization record of Top node S y+1 includes: change list ID: C y+1 ; the device list corresponding to the synchronization record of Top node S y+1 includes: device list ID: D y+1 , device ID: device D (the device ID being device D indicates that the current data synchronization is the data of device A synchronized with device D).
在设备B上的同步记录中已经创建了多个同步节点、多个更改列表和多个设备列表,如:Multiple sync nodes, multiple change lists, and multiple device lists have been created in the sync record on device B, such as:
Root节点S X,Root节点S X对应的更改列表包括:更改列表ID:C x;Root节点对应的设备列表包括:设备列表ID:D xRoot node S X , the change list corresponding to the Root node S X includes: change list ID: C x ; the device list corresponding to the Root node includes: device list ID: D x ;
中间节点S y,中间节点S y对应的更改列表包括:更改列表ID:C y;中间节点对应的设备列表包括:设备列表ID:D yFor the intermediate node S y , the change list corresponding to the intermediate node S y includes: change list ID: C y ; the device list corresponding to the intermediate node includes: device list ID: D y ;
Top节点S y+1,Top节点S y+1对应的更改列表包括:更改列表ID:C y+1;Top节点S y+1的同步记录对应的设备列表包括:设备列表ID:D y+1,设备ID:设备D(设备ID为设备D表示本次数据同步是设备B同步了设备D的数据)。 Top node S y+1 , the change list corresponding to Top node S y+1 includes: change list ID: C y+1 ; the device list corresponding to the synchronization record of Top node S y+1 includes: device list ID: D y+ 1. Device ID: device D (device ID is device D, indicating that this data synchronization is the data of device B synchronized with device D).
当设备B发生媒体资产变更时,如设备B下载音频B,设备B在更改列表中新增更改列表,如新增更改列表ID:C y+2,更改列表C y+2的内容为下载音频B,具体如图8所示,图8是本申请实施例的设备B有媒体资产变更时的示意性框图。 When device B changes media assets, such as device B downloads audio B, device B adds a new change list to the change list, such as a new change list ID: C y+2 , the content of the change list C y+2 is to download audio B. Specifically, as shown in FIG. 8 , FIG. 8 is a schematic block diagram of a device B in an embodiment of the present application when a media asset is changed.
应理解,该设备B可以是离开移动分布式系统时发生的数据变更,也可以是在处于该移动式分布式系统中时发生的数据变更,处于该移动式分布式系统即设备B没有离开移动分布式系统,如用户在家庭内构建了移动分布式系统,该移动分布式系统包括终端设备1、终端设备2和终端设备3,位于该移动式分布式系统指终端设备位于家庭内。It should be understood that the device B can be a data change that occurs when it leaves the mobile distributed system, or it can be a data change that occurs when it is in the mobile distributed system. In the mobile distributed system, that is, device B does not leave the mobile distributed system. For a distributed system, for example, a user builds a mobile distributed system in a home, the mobile distributed system includes terminal equipment 1, terminal equipment 2 and terminal equipment 3, and being located in the mobile distributed system means that the terminal equipment is located in the home.
下面结合图9详细说明本申请提供的一种移动分布式系统数据同步的方法,图9是本申请实施例的一种移动分布式系统数据同步的方法200的示意性流程图,该方法200可以 应用在图1所示的场景中,当然也可以应用在其他场景中,本申请实施例在此不作限制。A method for synchronizing data in a mobile distributed system provided by the present application will be described in detail below with reference to FIG. 9 . FIG. 9 is a schematic flowchart of a method 200 for synchronizing data in a mobile distributed system according to an embodiment of the present application. The method 200 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
还应理解,在本申请实施例中,以设备A(作为第一设备)和设备B(作为第二设备)作为执行方法的执行主体为例,对方法进行说明。作为示例而非限定,执行方法的执行主体也可以是应用于设备A和设备B的芯片、芯片系统、或处理器等。It should also be understood that, in the embodiments of the present application, the method is described by taking the device A (as the first device) and the device B (as the second device) as the execution subjects of the execution method as examples. As an example but not a limitation, the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
如图9所示,图9中示出的方法200可以包括S201至S206。下面结合图9详细说明方法200中的各个步骤。As shown in FIG. 9, the method 200 shown in FIG. 9 may include S201 to S206. Each step in the method 200 will be described in detail below with reference to FIG. 9 .
S201,设备B的媒体资产发生变更,设备B新增第一更改列表,第一更改列表包括第一更改列表ID和设备B上的媒体资产变更内容。S201 , the media asset of the device B is changed, and the device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on the device B.
S202,设备A向设备B发送第一查询请求,该第一查询请求用于查询设备B上是否有媒体资产变更。S202: Device A sends a first query request to device B, where the first query request is used to query whether there is a media asset change on device B.
S203,设备B接收设备A发送的第一查询请求。S203, the device B receives the first query request sent by the device A.
S204,该设备B根据该第一查询请求,确定有第一媒体资产变更,向该设备A发送第一同步消息,该第一同步消息携带有该设备B的第一媒体资产变更内容,该第一媒体资产变更内容包括发生变更的第一媒体资产和该第一媒体资产变更对应的动作,如第一同步消息包括设备B下载音频B,或者该第一同步消息中携带的第一媒体资产变更内容为:下载音频B,该第一同步消息还可以携带第一媒体资产变更内容的元数据,即音频B的元数据。其中,发生变更的第一媒体资产为音频B,第一媒体资产变更对应的动作为下载。S204, the device B determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the device A, where the first synchronization message carries the content of the first media asset change of the device B, and the first synchronization message carries the content of the first media asset change of the device B. A media asset change content includes the changed first media asset and an action corresponding to the first media asset change. For example, the first synchronization message includes device B downloading audio B, or the first media asset carried in the first synchronization message is changed. The content is: download audio B, and the first synchronization message may also carry metadata of the content of the first media asset change, that is, the metadata of audio B. Wherein, the changed first media asset is audio B, and the action corresponding to the first media asset change is download.
S205,设备A接收设备B发送的该第一同步消息。S205: Device A receives the first synchronization message sent by device B.
S206,该设备A根据该第一同步消息,生成第一同步记录,其中,该第一同步记录包括第一同步节点、第一更改列表和第一设备列表,该第一同步节点用于记录第一数据同步的信息,该第一更改列表用于记录该第一数据同步中发生变更的第一媒体资产和该第一媒体资产变更对应的动作,该第一设备列表用于记录该第一数据同步的设备。S206, the device A generates a first synchronization record according to the first synchronization message, where the first synchronization record includes a first synchronization node, a first change list and a first device list, and the first synchronization node is used to record the first synchronization node. Information of data synchronization, the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset, the first device list is used to record the first data Synchronized devices.
应理解,该第一数据同步,可以理解为设备A接收到第一同步消息后,生成第一同步记录的过程,就是一次数据同步。It should be understood that the first data synchronization can be understood as the process of generating the first synchronization record after the device A receives the first synchronization message, which is a data synchronization.
通过该设备A向该设备B发送该第一查询请求;该设备B在接收到该第一查询请求,并判断有第一媒体资产变更后向该设备A发送该第一同步消息,该设备A根据该第一同步消息,生成第一同步记录,其中,该第一同步记录包括第一同步节点、第一更改列表和第一设备列表,实现了移动分布式系统的异步同步。Send the first query request to the device B through the device A; the device B sends the first synchronization message to the device A after receiving the first query request and judging that the first media asset is changed, and the device A According to the first synchronization message, a first synchronization record is generated, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list, which realizes the asynchronous synchronization of the mobile distributed system.
应理解,在设备A向设备B发送第一查询请求时,设备B也可以向设备A发送第三查询请求,下面结合图10详细说明本申请提供的一种移动分布式系统数据同步的方法,图10是本申请实施例的一种移动分布式系统数据同步的方法300的示意性流程图,该方法300可以应用在图1所示的场景中,当然也可以应用在其他场景中,本申请实施例在此不作限制。It should be understood that when device A sends a first query request to device B, device B can also send a third query request to device A. The following describes in detail a method for data synchronization of a mobile distributed system provided by the present application in conjunction with FIG. 10 , FIG. 10 is a schematic flowchart of a method 300 for data synchronization in a mobile distributed system according to an embodiment of the present application. The method 300 can be applied to the scenario shown in FIG. 1 , and of course can also be applied to other scenarios. The embodiment is not limited here.
还应理解,在本申请实施例中,以设备A和设备B作为执行方法的执行主体为例,对方法进行说明。作为示例而非限定,执行方法的执行主体也可以是应用于设备A和设备B的芯片、芯片系统、或处理器等。It should also be understood that, in the embodiments of the present application, the method is described by taking the device A and the device B as the execution subjects of the execution method as an example. As an example but not a limitation, the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
如图10所示,图10中示出的方法300可以包括S301至S306。下面结合图10详细说明方法300中的各个步骤。As shown in FIG. 10 , the method 300 shown in FIG. 10 may include S301 to S306. Each step in the method 300 will be described in detail below with reference to FIG. 10 .
S301(即S201),设备B的媒体资产发生变更,设备B新增第一更改列表,第一更 改列表包括第一更改列表ID和设备B上的媒体资产变更内容。S301 (that is, S201), the media asset of device B is changed, and device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on device B.
S302,设备B向设备A发送第三查询请求,该第三查询请求用于查询设备A上是否有媒体资产变更。S302 , the device B sends a third query request to the device A, where the third query request is used to query whether there is a media asset change on the device A.
S303,设备A接收设备B发送的第三查询请求。S303, the device A receives the third query request sent by the device B.
S304,该设备A根据该第三查询请求,确定没有媒体资产变更,向该设备B发送第一反馈消息,该第一反馈消息用于告知该设备B设备A上没有媒体资产变更。S304, the device A determines that there is no media asset change according to the third query request, and sends a first feedback message to the device B, where the first feedback message is used to inform the device B that there is no media asset change on the device A.
S305,设备B接收设备A发送的该第一反馈消息。S305, the device B receives the first feedback message sent by the device A.
S306,该设备B根据该第一反馈消息和第一同步消息,生成第一同步记录(可以理解为是设备B上的第一同步记录),其中,该第一同步消息为该设备B向该设备A发送的第一同步消息,该第一同步消息携带有该设备B的第一媒体资产变更内容,该第一媒体资产变更内容包括发生变更的第一媒体资产和该第一媒体资产变更对应的动作,该第一同步记录包括第一同步节点、第一更改列表和第一设备列表,该第一同步节点用于第一数据同步的信息;该第一更改列表用于记录第一数据同步中发生变更的媒体资产和该媒体资产变更对应的动作,该第一更改列表即设备B在S301中新增的第一更改列表,此时由于设备A上没有媒体资产变更,所以此时第一更新列表不会增加新的内容;该第一设备列表用于记录该次数据同步的设备。S306, the device B generates a first synchronization record (which can be understood as the first synchronization record on the device B) according to the first feedback message and the first synchronization message, wherein the first synchronization message is the message sent by the device B to the device B. The first synchronization message sent by device A, the first synchronization message carries the first media asset modification content of device B, and the first media asset modification content includes the modified first media asset and the first media asset modification corresponding The first synchronization record includes a first synchronization node, a first change list and a first device list, the first synchronization node is used for the information of the first data synchronization; the first change list is used to record the first data synchronization The media asset that has changed and the action corresponding to the change of the media asset, the first change list is the first change list newly added by device B in S301. At this time, since there is no media asset change on device A, the first change list is The update list will not add new content; the first device list is used to record the device for this data synchronization.
应理解,该第一数据同步,可以理解为设备B接收到第一反馈消息后,在设备B上生成第一同步记录的过程,就是一次数据同步。It should be understood that the first data synchronization can be understood as the process of generating the first synchronization record on the device B after the device B receives the first feedback message, which is a data synchronization.
下面结合图11具体说明设备A和设备B生成第一同步记录的过程。图11是本申请实施例的设备A与设备B数据同步的示意性框图。The process of generating the first synchronization record by device A and device B will be specifically described below with reference to FIG. 11 . FIG. 11 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
在图11中,左边的设备为设备A,设备A上生成第一同步节点,第一同步节点为Top节点,原Top节点Sy+ 1变为中间节点,Top节点包括以下信息中的一个或多个:第一同步节点标识S y+2、第一同步时间戳第M时刻、第一父同步节点标识S y+1、第一同步变更内容和第一同步设备。 In Figure 11, the device on the left is Device A, the first synchronization node is generated on Device A, the first synchronization node is the Top node, the original Top node Sy+ 1 becomes an intermediate node, and the Top node includes one or more of the following information : the first synchronization node identifier S y+2 , the first synchronization timestamp at the Mth time, the first parent synchronization node identifier S y+1 , the first synchronization change content, and the first synchronization device.
可选的,该第一同步变更内容包括设备B的媒体资产变更内容,该第一同步设备包括该设备B的设备ID;或者,该第一同步变更内容中包括第一更改列表的索引,该第一同步设备中包括设备A列表的索引,该更改列表的索引用于查找该第一更改列表,该设备列表的索引用于查找该设备A列表;或者,该第一同步变更内容中包括该第一媒体资产变更内容的索引,该第一同步设备中包括与设备B相关的索引,该更改列表的索引用于查找该第一媒体资产变更内容,该与设备B相关的索引用于查找与该设备B相关的信息。Optionally, the first synchronization change content includes the media asset change content of the device B, and the first synchronization device includes the device ID of the device B; or, the first synchronization change content includes the index of the first change list, the The first synchronization device includes an index of the device A list, the index of the change list is used to find the first change list, and the index of the device list is used to find the device A list; Or, the first synchronization change content includes the The index of the changed content of the first media asset, the first synchronization device includes an index related to the device B, the index of the change list is used to find the changed content of the first media asset, and the index related to the device B is used to find the content related to the device B. Information about the device B.
应理解,该设备B相关的信息可以包括该设备B的类型、该设备B的称和该设备B的存储大小等一个或多个信息。It should be understood that the information related to the device B may include one or more pieces of information such as the type of the device B, the name of the device B, and the storage size of the device B.
设备A创建第一更改列表,第一更改列表包括第一更改列表ID:C y+2,和设备B下载音频B。 Device A creates a first changelist, the first changelist includes the first changelist ID: C y+2 , and device B downloads audio B.
设备A创建第一设备列表,第一设备列表包括第一设备列表ID:D y+2,设备ID:设备B。 Device A creates a first device list, and the first device list includes first device list ID: Dy+2 , device ID: device B.
设备A根据同步记录的变更状态信息在数据库中进行更改列表对应的元数据的同步。该元数据为设备B下载的音频B的元数据,如下载的音频B的存储位置,下载时间,音频B的大小等属性信息。其中,设备B下载的音频B的元数据,可以是在设备A与设备 B进行数据同步时,由设备B将设备B下载的音频B的元数据传递给设备A。Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record. The metadata is metadata of the audio B downloaded by the device B, such as attribute information such as the storage location of the downloaded audio B, the download time, and the size of the audio B. The metadata of audio B downloaded by device B may be that when device A and device B perform data synchronization, device B transmits the metadata of audio B downloaded by device B to device A.
右边的设备为设备B,对于设备B来讲,设备A没有数据更新,但是设备B自身有媒体资产更新,并且设备A同步了设备B的媒体资产更新的内容,在设备B上生成第一同步节点,第一同步节点为Top节点,原Top节点Sy+ 1变为中间节点,Top节点包括以下信息中的一个或多个:第一同步节点标识S y+2、第一同步时间戳第M时刻、第一父同步节点标识S y+1、第一同步变更内容和第一同步设备。 The device on the right is device B. For device B, device A has no data update, but device B has its own media asset update, and device A synchronizes the content of device B's media asset update, and generates the first synchronization on device B. Node, the first synchronization node is the Top node, the original Top node Sy+ 1 becomes an intermediate node, and the Top node includes one or more of the following information: the first synchronization node identifier Sy+ 2 , the first synchronization timestamp at the Mth time , the first parent synchronization node identifier S y+1 , the first synchronization change content and the first synchronization device.
设备B在该第一更改列表中C y+2,不作任何改变。 Device B is in the first change list C y+2 and does not make any changes.
设备B创建第一设备列表,第一设备列表包括第一设备列表ID:D y+2,设备ID:设备A。 Device B creates a first device list, and the first device list includes first device list ID: Dy+2 , device ID: device A.
应理解,在本申请实施例中,仅以设备A与设备B进行数据同步为例,设备A或者设备B还可以向移动分布式系统中其他所有在线设备发送查询消息。It should be understood that, in the embodiments of the present application, only the device A and the device B perform data synchronization as an example, and the device A or the device B may also send a query message to all other online devices in the mobile distributed system.
实施例二,主要描述当移动分布式系统中的设备A有媒体资产变更,设备B有媒体资产变更时,设备A与设备B如何进行数据同步,其中设备B有媒体资产变更的过程可以参考图8进行理解。The second embodiment mainly describes how to synchronize data between device A and device B when device A in the mobile distributed system has a media asset change and device B has a media asset change, and the process of device B having a media asset change can refer to the figure. 8 to understand.
该设备A接收设备B发送的该第一同步消息之前,该设备A上的媒体资产发生变更,如该设备A创建图片A,该设备A新增第二更改列表,该第二更改列表包括第二更改列表ID:C y+2和该设备A上的媒体资产变更内容:创建图片A,如图12所示,图12是本申请实施例的设备A有媒体资产变更时的示意性框图。 Before the device A receives the first synchronization message sent by the device B, the media assets on the device A are changed. For example, if the device A creates a picture A, the device A adds a second change list, and the second change list includes the first change list. 2. Change list ID: C y+2 and the content of the media asset change on the device A: create a picture A, as shown in FIG. 12 , which is a schematic block diagram of the device A in the embodiment of the present application when the media asset is changed.
下面结合图13详细说明本申请提供的一种移动分布式系统数据同步的方法,图13是本申请实施例的一种移动分布式系统数据同步的方法400的示意性流程图,该方法400可以应用在图1所示的场景中,当然也可以应用在其他场景中,本申请实施例在此不作限制。A method for synchronizing data in a mobile distributed system provided by the present application will be described in detail below with reference to FIG. 13 . FIG. 13 is a schematic flowchart of a method 400 for synchronizing data in a mobile distributed system according to an embodiment of the present application. The method 400 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
还应理解,在本申请实施例中,以设备A和设备B作为执行方法的执行主体为例,对方法进行说明。作为示例而非限定,执行方法的执行主体也可以是应用于设备A和设备B的芯片、芯片系统、或处理器等。It should also be understood that, in the embodiments of the present application, the method is described by taking the device A and the device B as the execution subjects of the execution method as an example. As an example but not a limitation, the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
如图13所示,图13中示出的方法400可以包括S401至S407。下面结合图13详细说明方法400中的各个步骤。As shown in FIG. 13 , the method 400 shown in FIG. 13 may include S401 to S407 . Each step in the method 400 will be described in detail below with reference to FIG. 13 .
S401(即S201,S301),设备B的媒体资产发生变更,设备B新增第一更改列表,第一更改列表包括第一更改列表ID和设备B上的媒体资产变更内容S401 (ie, S201, S301), the media asset of device B is changed, and device B adds a first change list, and the first change list includes the first change list ID and the content of the media asset change on device B
S402,设备A的媒体资产发生变更,设备A新增第二更改列表,第二更改列表包括第二更改列表ID和设备A上的媒体资产变更内容。S402 , the media asset of the device A is changed, and the device A adds a second modification list, and the second modification list includes the second modification list ID and the media asset modification content on the device A.
此处S401和S402顺序不做限定。The sequence of S401 and S402 is not limited here.
S403,设备A向设备B发送第一查询请求,该第一查询请求用于查询设备B上是否有媒体资产变更。S403: Device A sends a first query request to device B, where the first query request is used to query whether there is a media asset change on device B.
S404,设备B接收设备A发送的第一查询请求。S404, the device B receives the first query request sent by the device A.
S405,该设备B根据该第一查询请求,确定有第一媒体资产变更,向该设备A发送第一同步消息,该第一同步消息携带有该设备B的第一媒体资产变更内容,该第一媒体资产变更内容包括发生变更的第一媒体资产和该第一媒体资产变更对应的动作,如第一同步消息携带设备B的媒体资产变更内容:下载音频B,该第一同步消息还可以携带第一媒体资产变更内容的元数据。S405, the device B determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the device A, where the first synchronization message carries the content of the first media asset change of the device B, and the first synchronization message carries the content of the first media asset change of the device B. A media asset change content includes the changed first media asset and an action corresponding to the first media asset change. For example, the first synchronization message carries the media asset change content of device B: download audio B, the first synchronization message can also carry The first media asset alters the metadata of the content.
S406,设备A接收设备B发送的该第一同步消息。S406: Device A receives the first synchronization message sent by device B.
S407,该设备A根据该第一同步消息,生成第二同步记录,第二同步记录包括第二同步节点、第二更改列表和第二设备列表;该第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,该第二同步节点ID用于标识第二数据同步;在该第二更改列表中,增加设备B的媒体资产变更内容;在该第二设备列表中增加该设备B的设备ID。S407, the device A generates a second synchronization record according to the first synchronization message, where the second synchronization record includes a second synchronization node, a second change list and a second device list; the second synchronization node includes a second synchronization node ID, One or more of the second synchronization timestamp, the second parent synchronization node ID, the second synchronization change content, and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list , add the media asset modification content of the device B; add the device ID of the device B in the second device list.
设备A由于存在媒体资产变更,之前已经生成了第二更改列表,因此在与设备B进行数据同步后,设备A的在第二更改列表中新增加设备B的媒体资产变更内容。Device A has previously generated a second change list due to a media asset change. Therefore, after synchronizing data with device B, device A adds the media asset change content of device B to the second change list.
下面结合图14详细说明本申请提供的一种移动分布式系统数据同步的方法,图14是本申请实施例的一种移动分布式系统数据同步的方法500的示意性流程图,该方法500可以应用在图1所示的场景中,当然也可以应用在其他场景中,本申请实施例在此不作限制。A method for synchronizing data in a mobile distributed system provided by the present application will be described in detail below with reference to FIG. 14 . FIG. 14 is a schematic flowchart of a method 500 for synchronizing data in a mobile distributed system according to an embodiment of the present application. The method 500 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
还应理解,在本申请实施例中,以设备A和设备B作为执行方法的执行主体为例,对方法进行说明。作为示例而非限定,执行方法的执行主体也可以是应用于设备A和设备B的芯片、芯片系统、或处理器等。It should also be understood that, in the embodiments of the present application, the method is described by taking the device A and the device B as the execution subjects of the execution method as an example. As an example but not a limitation, the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
如图14所示,图14中示出的方法500可以包括S501至S505。下面结合图14详细说明方法500中的各个步骤。As shown in FIG. 14, the method 500 shown in FIG. 14 may include S501 to S505. Each step in the method 500 will be described in detail below with reference to FIG. 14 .
S501(即S201,S302,S401),设备B的媒体资产发生变更,设备B新增第一更改列表,第一更改列表包括更改列表ID和设备B上的媒体资产变更内容。S501 (ie, S201, S302, S401), the media assets of device B are changed, and device B adds a first change list, and the first change list includes the change list ID and the content of the media asset changes on device B.
S502(即S402),设备A的媒体资产发生变更,设备A新增第二更改列表,第二更改列表包括第二更改列表ID和设备A上的媒体资产变更内容。S502 (ie, S402 ), the media assets of device A are changed, and device A adds a second change list, and the second change list includes the second change list ID and the content of media asset changes on device A.
此处S501和S502顺序不做限定。The sequence of S501 and S502 is not limited here.
S503,设备B向设备A发送第四查询请求,该第四查询请求用于查询设备A上是否有媒体资产变更。S503 , the device B sends a fourth query request to the device A, where the fourth query request is used to query whether there is a media asset change on the device A.
S504,设备A接收设备B发送的第四查询请求。S504, the device A receives the fourth query request sent by the device B.
S505,该设备A根据该第四查询请求,确定有第一媒体资产变更,向该设备B发送第三同步消息,该第三同步消息携带有该设备A的第一媒体资产变更内容,该第一媒体资产变更内容包括设备A上发生变更的第一媒体资产和该第一媒体资产变更对应的动作,如第三同步消息包括设备A的媒体资产变更内容:创建图片A,该第三同步消息还可以携带第一媒体资产变更内容的元数据。S505, the device A determines that the first media asset is changed according to the fourth query request, and sends a third synchronization message to the device B, where the third synchronization message carries the content of the first media asset change of the device A, and the first media asset is changed. A media asset change content includes the first media asset changed on device A and the action corresponding to the first media asset change. For example, the third synchronization message includes the media asset change content of device A: create picture A, the third synchronization message The metadata of the content of the first media asset change may also be carried.
S506,设备B接收设备A发送的该第三同步消息。S506, the device B receives the third synchronization message sent by the device A.
S507,该设备B根据该第三同步消息,生成第二同步记录(设备B上的第二同步记录),该第二同步记录包括第二同步节点、该第一更改列表和第二设备列表;该第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,该第二同步节点ID用于标识第二数据同步;在该第二更改列表中,增加第一设备的媒体资产变更内容;在该第二设备列表中增加该第一设备的设备ID。S507, the device B generates a second synchronization record (the second synchronization record on the device B) according to the third synchronization message, and the second synchronization record includes the second synchronization node, the first change list and the second device list; The second synchronization node includes a second synchronization node ID, one or more of a second synchronization timestamp, a second parent synchronization node identifier, a second synchronization change content, and a second synchronization device, and the second synchronization node ID is used for Identifies the second data synchronization; in the second modification list, adds the media asset modification content of the first device; and adds the device ID of the first device in the second device list.
下面结合图15具体说明设备A和设备B生成同步记录的过程。图15是本申请实施例的设备A与设备B数据同步的示意性框图。The process of generating synchronization records by device A and device B will be specifically described below with reference to FIG. 15 . FIG. 15 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
在图15中,左边的设备为设备A,设备A上生成新同步节点,新同步节点为Top节点,原Top节点S y+1变为中间节点,Top节点包括以下信息中的一个或多个:同步节点标 识S y+2、同步时间戳第M时刻、父同步节点标识S y+1、同步变更内容和同步设备。 In Figure 15, the device on the left is device A, a new synchronization node is generated on device A, the new synchronization node is the Top node, the original Top node S y+1 becomes an intermediate node, and the Top node includes one or more of the following information : the synchronization node identifier S y+2 , the M-th time of the synchronization timestamp, the parent synchronization node identifier S y+1 , the synchronization change content and the synchronization device.
该设备A在该更改列表C y+2中,增加设备B的媒体资产变更内容,如更改列表内容包括:设备A创建图片A和设备B下载音频B。 The device A adds the content of the media asset change of the device B in the change list C y+2 . For example, the content of the change list includes: the device A creates a picture A and the device B downloads the audio B.
设备A创建设备列表,设备列表包括设备列表ID:D y+2,设备ID:设备B。 Device A creates a device list, and the device list includes device list ID: D y+2 , device ID: device B.
设备A根据同步记录的变更状态信息在数据库中进行更改列表对应的元数据的同步。Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
右边的设备为设备B,对于设备B来讲,设备A有媒体资产更新,在设备B上生成新的同步节点,新同步节点为Top节点,原Top节点S y+1变为中间节点,Top节点包括以下信息中的一个或多个:同步节点标识S y+2、同步时间戳第M时刻、父同步节点标识S y+1、同步变更内容和同步设备。 The device on the right is device B. For device B, device A has media asset updates, and a new synchronization node is generated on device B. The new synchronization node is the Top node, and the original Top node S y+1 becomes an intermediate node. The node includes one or more of the following information: synchronization node identifier S y+2 , synchronization timestamp M-th time, parent synchronization node identifier S y+1 , synchronization change content and synchronization device.
该设备B在该更改列表C y+2中,增加设备A的媒体资产变更内容,如更改列表内容包括:设备A创建图片A和设备B下载音频B。 The device B adds the content of the media asset change of the device A in the change list C y+2 . For example, the content of the change list includes: the device A creates a picture A and the device B downloads the audio B.
设备B创建设备列表,设备列表包括设备A列表ID:D y+2,设备ID:设备A。 Device B creates a device list, and the device list includes device A list ID: D y+2 , device ID: device A.
实施例三,主要描述当移动分布式系统中的设备A和设备B已经进行过数据同步后,因为设备B的媒体资产发生变更(如设备B发生数据再次变更时,如设备B下载音频C,设备B在更改列表中新增更改列表,如新增更改列表ID:C y+3,更改列表C y+3的内容为下载音频C,如图16所示)又要进行数据同步时,设备A与设备B如何进行数据同步。 The third embodiment mainly describes that after device A and device B in the mobile distributed system have performed data synchronization, because the media assets of device B are changed (such as when device B changes data again, such as when device B downloads audio C, Device B adds a new change list to the change list, such as adding a new change list ID: C y+3 , the content of the change list C y+3 is to download audio C, as shown in Figure 16) When data synchronization is required, the device How to synchronize data between A and device B.
下面结合图17详细说明本申请提供的一种移动分布式系统数据同步的方法,图17是本申请实施例的一种移动分布式系统数据同步的方法600的示意性流程图,该方法600可以应用在图1所示的场景中,当然也可以应用在其他场景中,本申请实施例在此不作限制。The following describes a method for synchronizing data in a mobile distributed system provided by the present application in detail with reference to FIG. 17 . FIG. 17 is a schematic flowchart of a method 600 for synchronizing data in a mobile distributed system according to an embodiment of the present application. The method 600 may It is applied in the scenario shown in FIG. 1 , and of course can also be applied in other scenarios, which is not limited in this embodiment of the present application.
还应理解,在本申请实施例中,以设备A和设备B作为执行方法的执行主体为例,对方法进行说明。作为示例而非限定,执行方法的执行主体也可以是应用于设备A和设备B的芯片、芯片系统、或处理器等。It should also be understood that, in the embodiments of the present application, the method is described by taking the device A and the device B as the execution subjects of the execution method as an example. As an example but not a limitation, the execution body of the method may also be a chip, a chip system, or a processor, etc. applied to the device A and the device B.
如图17所示,图17中示出的方法600可以包括S601至S606。下面结合图17详细说明方法600中的各个步骤。As shown in FIG. 17 , the method 600 shown in FIG. 17 may include S601 to S606. Each step in the method 600 will be described in detail below with reference to FIG. 17 .
S601,设备B的媒体资产发生变更,设备B新增第三更改列表,第三更改列表包括更改列表ID和设备B上的媒体资产变更内容。S601 , a media asset of the device B is changed, and the device B adds a third change list, and the third change list includes the change list ID and the content of the media asset change on the device B.
S602,设备A向设备B发送第二查询请求,该第二查询请求用于查询设备B上是否有媒体资产变更。S602: Device A sends a second query request to device B, where the second query request is used to query whether there is a media asset change on device B.
S603,设备B接收设备A发送的第二查询请求。S603, the device B receives the second query request sent by the device A.
S604,该设备B根据该第二查询请求,确定有第二媒体资产变更,向该设备A发送第二同步消息,该第二同步消息携带有该设备B的第二媒体资产变更内容,该第二媒体资产变更内容包括发生变更的第二媒体资产和该第二媒体资产变更对应的动作,如第二同步消息包括设备B下载音频B,该第二同步消息还可以携带第二媒体资产变更内容的元数据。S604, the device B determines that there is a second media asset change according to the second query request, and sends a second synchronization message to the device A, where the second synchronization message carries the content of the second media asset change of the device B, the first The second media asset change content includes the changed second media asset and the action corresponding to the second media asset change. For example, the second synchronization message includes device B downloading audio B, and the second synchronization message can also carry the second media asset change content. metadata.
S605,设备A接收设备B发送的该第二同步消息。S605: Device A receives the second synchronization message sent by device B.
S606,设备A根据该第二同步消息,生成第三同步记录,该第三同步记录包括第三同步节点、第三更改列表和第三设备列表,该第三同步节点中包括:第三同步节点ID,第三同步时间戳、第三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,该第三同步节点ID用于标识三数据同步;第三更改列表包括第三更改列表ID,该第二设备的第二媒体资产变更内内容;该第三设备列表包括第三设备列表ID,和该第二设 备的设备ID。S606: Device A generates a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list, where the third synchronization node includes: a third synchronization node ID, one or more of the third synchronization timestamp, the third parent synchronization node identifier, the third synchronization change content and the third synchronization device, wherein the third synchronization node ID is used to identify the three data synchronization; the third modification The list includes a third change list ID, and the second media asset of the second device changes content; the third device list includes a third device list ID, and a device ID of the second device.
S607,设备A移除该第一设备列表ID中的设备B的设备ID。S607, the device A removes the device ID of the device B in the first device list ID.
应理解,上述方法600描述了设备A与设备B已经进行过一次数据同步,当设备B的媒体资产再次更新时,设备A如何同步设备B,同样,设备B也会同步设备A的数据,只是设备A上没有媒体资产更新,设备B会生成新的同步记录,新的同步记录包括新的节点、第三更改列表和设备列表,设备B移除该第一设备列表ID中的设备A的设备ID,具体细节可以参考设备A的过程,此处不再赘述。It should be understood that the above method 600 describes how device A and device B have already performed data synchronization once. When the media assets of device B are updated again, how device A synchronizes device B. Similarly, device B will also synchronize the data of device A, but only There is no media asset update on device A, device B will generate a new synchronization record, the new synchronization record includes the new node, the third change list and the device list, device B removes the device of device A in the first device list ID ID, the specific details can refer to the process of device A, which will not be repeated here.
下面结合图18具体说明设备A和设备B生成第三同步记录的过程。图18是本申请实施例的设备A与设备B数据同步的示意性框图。The process of generating the third synchronization record by device A and device B will be specifically described below with reference to FIG. 18 . FIG. 18 is a schematic block diagram of data synchronization between device A and device B according to an embodiment of the present application.
在图18中,左边的设备为设备A,设备A上生成第三同步节点,第三同步节点为Top节点,原Top节点S y+2变为中间节点,Top节点包括以下信息中的一个或多个:第三同步节点标识S y+3、第三同步时间戳第M+1时刻、第三父同步节点标识S y+2、第三同步变更内容和第三同步设备。 In Fig. 18, the device on the left is device A, a third synchronization node is generated on device A, the third synchronization node is the Top node, the original Top node S y+2 becomes an intermediate node, and the Top node includes one of the following information or Multiple: third synchronization node identification S y+3 , third synchronization timestamp M+1 th time, third parent synchronization node identification S y+2 , third synchronization change content and third synchronization device.
设备A创建第三更改列表,第三更改列表包括第三更改列表ID:C y+3,和设备B下载音频C。 Device A creates a third changelist that includes the third changelist ID: C y+3 , and device B downloads audio C.
设备A创建第三设备列表,第三设备列表包括设备A列表ID:D y+3,设备ID:设备B。 Device A creates a third device list, and the third device list includes device A list ID: Dy+3 , device ID: device B.
设备A移除该第一设备列表ID中的该设备B的设备ID。设备A根据同步记录的变更状态信息在数据库中进行更改列表对应的元数据的同步。The device A removes the device ID of the device B in the first device list ID. Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
设备A根据同步记录的变更状态信息在数据库中进行更改列表对应的元数据的同步。Device A synchronizes the metadata corresponding to the change list in the database according to the change state information of the synchronization record.
右边的设备为设备B,对于设备B来讲,设备A没有数据更新,但是设备B自身有媒体资产更新,并且设备A同步了设备B的媒体资产更新的内容,在设备B上生成新同步节点,新同步节点为Top节点,原Top节点S y+2变为中间节点,Top节点包括以下信息中的一个或多个:同步节点标识S y+3、同步时间戳第M+1时刻、父同步节点标识S y+2、同步变更内容和同步设备。 The device on the right is device B. For device B, device A has no data update, but device B has its own media asset update, and device A synchronizes the content of device B's media asset update, and generates a new synchronization node on device B , the new synchronization node is the Top node, the original Top node S y+2 becomes an intermediate node, and the Top node includes one or more of the following information: the synchronization node identifier S y+3 , the synchronization timestamp at the M+1th time, the parent The synchronization node identifies S y+2 , synchronizes changes, and synchronizes equipment.
在该更改列表C y+3中,不作任何改变。 In this change list C y+3 , no changes are made.
设备B创建设备列表,设备列表包括设备列表ID:D y+3,设备ID:设备A。 Device B creates a device list, and the device list includes device list ID: D y+3 , device ID: device A.
设备B移除第四设备列表ID中的该设备A的设备ID。设备B根据第三同步记录的变更状态信息在数据库中进行更改列表对应的元数据的同步。The device B removes the device ID of the device A in the fourth device list ID. Device B synchronizes the metadata corresponding to the change list in the database according to the change state information of the third synchronization record.
上述实施例具体描述了在移动式分布式系统中终端设备如何进行数据同步,终端设备进行数据同步时需要考虑数据的安全性,不能使得同步的数据被任意篡改等。本申请实施例还提出了一种移动分布式系统数据同步的方法,该方法实现日志数据块链化和状态加密,保证日志数据防篡改。The above embodiments specifically describe how the terminal device performs data synchronization in the mobile distributed system. When the terminal device performs data synchronization, data security needs to be considered, and the synchronized data cannot be arbitrarily tampered with. The embodiment of the present application also proposes a method for data synchronization of a mobile distributed system, which realizes the block chaining and state encryption of log data, and ensures that the log data is tamper-proof.
本申请实施例主要根据哈希算法来实现日志数据块链化和状态加密,保证日志数据防篡改。为了更清楚的理解本申请实施例,下面简单描述哈希算法。The embodiments of the present application mainly implement the block chaining and state encryption of log data according to a hash algorithm, so as to ensure that the log data is tamper-proof. For a clearer understanding of the embodiments of the present application, the hash algorithm is briefly described below.
哈希算法是将任意长度的二进制字符串映射为定长二进制字符串的映射规则我们称为散列(hash)算法,又叫哈希(hash)算法,而通过原始数据映射之后得到的二进制值称为哈希值。哈希算法主要特点:A hash algorithm is a mapping rule that maps a binary string of arbitrary length to a fixed-length binary string. We call it a hash algorithm, also known as a hash algorithm, and the binary value obtained after mapping the original data called the hash value. The main features of the hash algorithm:
1.从哈希值不能反向推导原始数据,具有单向计算性,极难逆推;1. The original data cannot be reversely derived from the hash value, which is one-way computational and extremely difficult to reverse;
2.对输入数据敏感,哪怕只改了一个Bit,最后得到的哈希值完全不相同,具有雪崩效应;2. Sensitive to input data, even if only one Bit is changed, the final hash value is completely different, which has an avalanche effect;
3.散列冲突的概率极小,哈希因子Key不同,计算出来的哈希值一样的概率极小。3. The probability of hash collision is extremely small, the hash factor Key is different, and the probability of the calculated hash value is the same is extremely small.
图19是本申请实施例的移动分布式系统有状态数据同步结构示意性框图。在不同设备进行数据同步时,数据更改的设备会对更改列表中的每次更改的内容进行哈希运算,得到第一哈希值,并将该第一哈希值发送给进行数据同步的设备,进行数据同步的设备根据同步后的更改列表进行哈希计算,得到第二哈希值,如果该第一哈希值等于该第二哈希值则说明本次数据同步成功,否则不成功。具体参照图19进行说明。FIG. 19 is a schematic block diagram of a stateful data synchronization structure of a mobile distributed system according to an embodiment of the present application. When different devices synchronize data, the device whose data is changed will perform a hash operation on the content of each change in the change list to obtain a first hash value, and send the first hash value to the device performing data synchronization , the data synchronization device performs hash calculation according to the synchronized change list to obtain a second hash value. If the first hash value is equal to the second hash value, it means that the current data synchronization is successful, otherwise it is unsuccessful. A specific description will be given with reference to FIG. 19 .
为了更清楚的理解本申请实施例,首先对图19中的参数进行解释说明。For a clearer understanding of the embodiments of the present application, the parameters in FIG. 19 are explained first.
如图19所示,C1是C2的父节点;As shown in Figure 19, C1 is the parent node of C2;
F CN:表示更改列表表头的内容; F CN : Indicates the content of the change list header;
F LN:表示更改列表的节点内容,如删除图片,删除音乐,创建图片等; F LN : Indicates the node content of the change list, such as deleting pictures, deleting music, creating pictures, etc.;
Nouce:一次性随机数,申请节点生成,即数据更改的设备生成,Nouce会加密传递给接收节点,通常在第一次建立连接时,申请节点将Nouce传递给接收节点。其中,接收节点为进行数据同步的设备;Nouce: A one-time random number, generated by the application node, that is, the device generated by the data change, the Nouce will be encrypted and transmitted to the receiving node, usually when the connection is established for the first time, the application node will pass the Nouce to the receiving node. Among them, the receiving node is a device for data synchronization;
H CN:更改列表表头的哈希值,各个节点独立生成,不传递。 H CN : Change the hash value of the list header, which is generated independently by each node and is not transmitted.
H LN:更改列表中每个更改记录的哈希值,申请节点生成,明文传递,接收节点验证; H LN : Change the hash value of each change record in the list, apply for node generation, clear text transmission, and receive node verification;
Change log:每次更改内容。Change log: Every time the content is changed.
图19所示的节点可以看作请求节点,其中C1是C2的父节点,在请求节点上,父节点C1更改列表表头的哈希值根据式(1)计算:The node shown in Figure 19 can be regarded as a request node, where C1 is the parent node of C2. On the request node, the hash value of the change list header of the parent node C1 is calculated according to formula (1):
H c1=HASH(F C1,Nouce)                  (1) H c1 =HASH(F C1 ,Nouce) (1)
更改记录L1的哈希值根据式(2)计算:The hash value of the change record L1 is calculated according to formula (2):
H L1=HASH(H C1,F L1)                  (2) H L1 =HASH(H C1 ,F L1 ) (2)
更改记录L2的哈希值根据式(3)计算:The hash value of the change record L2 is calculated according to formula (3):
H L2=HASH(H C1,H L1,F L2)              (3) H L2 =HASH(H C1 ,H L1 ,F L2 ) (3)
更改记录L3的哈希值根据式(4)计算:The hash value of the change record L3 is calculated according to formula (4):
H L3=HASH(H C1,H L2,F L3)              (4) H L3 =HASH(H C1 ,H L2 ,F L3 ) (4)
更改记录L4的哈希值根据式(5)计算:The hash value of the change record L4 is calculated according to formula (5):
H L4=HASH(H C1,H L3,F L4)              (5) H L4 =HASH(H C1 ,H L3 ,F L4 ) (5)
更改记录L5的哈希值根据式(6)计算:The hash value of the change record L5 is calculated according to formula (6):
H L5=HASH(H C1,H L4,F L5)              (6) H L5 = HASH (H C1 , H L4 , F L5 ) (6)
其中,节点C1更改列表中每次更改记录L N的哈希因子为C1更改列表表头的哈希值、上一次更改记录L N-1的哈希值和L N的更改内容。 Wherein, the hash factor of each change record LN in the node C1 change list is the hash value of the header of the C1 change list, the hash value of the last change record LN -1 , and the change content of LN .
子节点C2更改列表表头的哈希值根据式(7)计算:The hash value of the change list header of the child node C2 is calculated according to formula (7):
H c2=HASH(H C1,H L5,F C2)                  (7) H c2 = HASH(H C1 , H L5 , F C2 ) (7)
其中,式(7)中的H L5为C1节点最后一个节点。 Wherein, H L5 in the formula (7) is the last node of the C1 node.
子节点C2更改列表中更改记录L6的哈希值根据式(8)计算:The hash value of the change record L6 in the change list of the child node C2 is calculated according to formula (8):
H L6=HASH(H C2,F L6)                  (8) H L6 =HASH(H C2 ,F L6 ) (8)
更改记录L7的哈希值根据式(9)计算:The hash value of the change record L7 is calculated according to formula (9):
H L7=HASH(H C1,H L6,F L7)              (9) H L7 =HASH(H C1 ,H L6 ,F L7 ) (9)
其中,节点C2更改列表中每次更改记录L N的哈希因子为C2更改列表表头的哈希值、 上一次更改记录L N-1的哈希值和L N的更改内容。 Wherein, the hash factor of each change record LN in the node C2 change list is the hash value of the C2 change list header, the hash value of the last change record LN -1 , and the change content of LN .
请求节点对同步数据块做逐节点的同步状态、同步内容及系统秘钥hash,请求节点计算每次数据同步变更的
Figure PCTCN2021108814-appb-000001
并传递给接收节点,接收节点解析同步数据时,在更改列表节点中引入保护机制,通过父节点的pre-hash和父节点内容进行hash得到
Figure PCTCN2021108814-appb-000002
比较
Figure PCTCN2021108814-appb-000003
Figure PCTCN2021108814-appb-000004
如果
Figure PCTCN2021108814-appb-000005
等于
Figure PCTCN2021108814-appb-000006
表示此次同步内容正确,可以进行数据同步;如果
Figure PCTCN2021108814-appb-000007
不等于
Figure PCTCN2021108814-appb-000008
表示此次同步内容错误,需要重新进行数据同步。
The requesting node performs node-by-node synchronization status, synchronization content and system key hash for the synchronization data block, and the requesting node calculates the value of each data synchronization change.
Figure PCTCN2021108814-appb-000001
And pass it to the receiving node. When the receiving node parses the synchronized data, a protection mechanism is introduced in the change list node, and the hash is obtained through the pre-hash of the parent node and the content of the parent node.
Figure PCTCN2021108814-appb-000002
compare
Figure PCTCN2021108814-appb-000003
and
Figure PCTCN2021108814-appb-000004
if
Figure PCTCN2021108814-appb-000005
equal
Figure PCTCN2021108814-appb-000006
Indicates that the synchronization content is correct and data synchronization can be performed; if
Figure PCTCN2021108814-appb-000007
not equal to
Figure PCTCN2021108814-appb-000008
Indicates that the content of the synchronization is wrong and needs to be re-synchronized.
应理解,上述图19所示的本申请实施例可以结合在图4-图19所示的本申请实施例中,即分布式系统数据同步时引入校验机制,确保同步数据的可靠性和安全性。It should be understood that the embodiments of the present application shown in FIG. 19 can be combined with the embodiments of the present application shown in FIGS. 4 to 19 , that is, a verification mechanism is introduced during data synchronization in a distributed system to ensure the reliability and security of synchronized data. sex.
以上结合图1至图19对本申请实施例的一种移动分布式系统数据同步的方法做了详细说明。以下,结合图20至图21对本申请实施例装置进行详细说明。A method for data synchronization of a mobile distributed system according to an embodiment of the present application has been described in detail above with reference to FIG. 1 to FIG. 19 . Hereinafter, the device according to the embodiment of the present application will be described in detail with reference to FIG. 20 to FIG. 21 .
图20示出了本申请实施例的装置800的示意性框图。FIG. 20 shows a schematic block diagram of an apparatus 800 according to an embodiment of the present application.
一些实施例中,该装置700可以为终端设备,也可以为芯片或电路,比如可设置于终端设备的芯片或电路。In some embodiments, the apparatus 700 may be a terminal device, or may be a chip or a circuit, for example, a chip or a circuit that can be provided in the terminal device.
一些实施例中,该装置700可以为接入网设备,也可以为芯片或电路,比如可设置于接入网设备的芯片或电路。In some embodiments, the apparatus 700 may be an access network device, or may be a chip or a circuit, for example, a chip or a circuit that may be provided in the access network device.
一些实施例中,该装置700可以为核心网设备,也可以为芯片或电路,比如可设置于核心网设备的芯片或电路。In some embodiments, the apparatus 700 may be a core network device, or may be a chip or a circuit, for example, a chip or a circuit that may be provided in the core network device.
一种可能的方式中,该装置700可以包括处理单元710(即,处理器的一例)和收发单元730。一些可能的实现方式中,处理单元710还可以称为确定单元。一些可能的实现方式中,收发单元730可以包括接收单元和发送单元。In a possible manner, the apparatus 700 may include a processing unit 710 (ie, an example of a processor) and a transceiver unit 730 . In some possible implementations, the processing unit 710 may also be referred to as a determination unit. In some possible implementations, the transceiver unit 730 may include a receiving unit and a sending unit.
在一种实现方式中,收发单元730可以通过收发器或者收发器相关电路或者接口电路实现。In an implementation manner, the transceiver unit 730 may be implemented by a transceiver or a transceiver-related circuit or an interface circuit.
在一种实现方式中,该装置还可以包括存储单元720。一种可能的方式中,该存储单元720用于存储指令。在一种实现方式中,该存储单元也可以用于存储数据或者信息。存储单元720可以通过存储器实现。In one implementation, the apparatus may further include a storage unit 720 . In a possible manner, the storage unit 720 is used to store instructions. In one implementation, the storage unit may also be used to store data or information. The storage unit 720 may be implemented by a memory.
一些可能的设计中,该处理单元710用于执行该存储单元720存储的指令,以使装置700实现如上述方法中终端设备执行的步骤。或者,该处理单元710可以用于调用存储单元720的数据,以使装置700实现如上述方法中终端设备执行的步骤。In some possible designs, the processing unit 710 is configured to execute the instructions stored in the storage unit 720, so that the apparatus 700 implements the steps performed by the terminal device in the above method. Alternatively, the processing unit 710 can be used to call the data of the storage unit 720, so that the apparatus 700 can implement the steps performed by the terminal device in the above method.
一些可能的设计中,该处理单元710用于执行该存储单元720存储的指令,以使装置700实现如上述方法中接入网设备执行的步骤。或者,该处理单元710可以用于调用存储单元720的数据,以使装置700实现如上述方法中接入网设备执行的步骤。In some possible designs, the processing unit 710 is configured to execute the instructions stored in the storage unit 720, so that the apparatus 700 implements the steps performed by the access network device in the above method. Alternatively, the processing unit 710 may be configured to call the data of the storage unit 720, so that the apparatus 700 implements the steps performed by the access network device in the above method.
例如,该处理单元710、存储单元720、收发单元730可以通过内部连接通路互相通信,传递控制和/或数据信号。例如,该存储单元720用于存储计算机程序,该处理单元710可以用于从该存储单元720中调用并运行该计算计程序,以控制收发单元730接收信号和/或发送信号,完成上述方法中终端设备或接入网设备的步骤。该存储单元720可以集成在处理单元710中,也可以与处理单元710分开设置。For example, the processing unit 710, the storage unit 720, and the transceiver unit 730 can communicate with each other through an internal connection path to transmit control and/or data signals. For example, the storage unit 720 is used to store a computer program, and the processing unit 710 can be used to call and run the computer program from the storage unit 720 to control the transceiver unit 730 to receive signals and/or send signals to complete the above method. Steps for terminal equipment or access network equipment. The storage unit 720 may be integrated in the processing unit 710 , or may be provided separately from the processing unit 710 .
可选地,若该装置700为终端设备(例如,智能手机,或笔记本电脑),该收发单元730包括接收器和发送器。其中,接收器和发送器可以为相同或者不同的物理实体。为相同的物理实体时,可以统称为收发器。Optionally, if the apparatus 700 is a terminal device (eg, a smart phone, or a notebook computer), the transceiver unit 730 includes a receiver and a transmitter. The receiver and the transmitter may be the same or different physical entities. When they are the same physical entity, they can be collectively referred to as transceivers.
当该装置700为终端设备时,收发单元730在发送信息时可以为发送单元或发射器, 收发单元730在接收信息时可以为接收单元或接收器,收发单元可以为收发器,此收发器、发射器或接收器可以为射频电路,当该装置包含存储单元时,该存储单元用于存储计算机指令,该处理器与存储器通信连接,处理器执行存储器存储的计算机指令,使该装置可以执行方法200、方法500或者方法600。其中,处理器可以是一个通用中央处理器(CPU),微处理器,特定应用集成电路(Application Specific Intergrated Circuit,ASIC)。When the apparatus 700 is a terminal device, the transceiver unit 730 can be a sending unit or a transmitter when sending information, the transceiver unit 730 can be a receiving unit or a receiver when receiving information, and the transceiver unit can be a transceiver, the transceiver, The transmitter or receiver may be a radio frequency circuit, and when the device includes a storage unit, the storage unit is used to store computer instructions, the processor is communicatively connected to the memory, and the processor executes the computer instructions stored in the memory, so that the device can perform the method 200 , method 500 or method 600 . The processor may be a general-purpose central processing unit (CPU), a microprocessor, or an application specific integrated circuit (ASIC).
可选地,若该装置700为芯片或电路,该收发单元730包括输入接口和输出接口。Optionally, if the device 700 is a chip or a circuit, the transceiver unit 730 includes an input interface and an output interface.
当该装置700为芯片时,收发单元730可以是输入和/或输出接口、管脚或电路等。该处理单元710可执行存储单元存储的计算机执行指令,以使该装置可以执行方法200、方法500或者方法600。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述终端内的位于所述芯片外部的存储单元,如只读存储器(Read Only Memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(Random Access Memory,RAM)等。When the device 700 is a chip, the transceiver unit 730 may be an input and/or output interface, a pin or a circuit, or the like. The processing unit 710 can execute computer-executable instructions stored in the storage unit, so that the apparatus can perform the method 200 , the method 500 or the method 600 . Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit in the terminal located outside the chip, such as a read-only memory (Read Only Memory). Only Memory, ROM) or other types of static storage devices that can store static information and instructions, random access memory (Random Access Memory, RAM), etc.
作为一种实现方式,收发单元730的功能可以考虑通过收发电路或者收发的专用芯片实现。处理单元710可以考虑通过专用处理芯片、处理电路、处理单元或者通用芯片实现。As an implementation manner, the function of the transceiver unit 730 can be considered to be implemented by a transceiver circuit or a dedicated chip for transceiver. The processing unit 710 can be considered to be implemented by a dedicated processing chip, a processing circuit, a processing unit or a general-purpose chip.
作为另一种实现方式,可以考虑使用通用计算机的方式来实现本申请实施例提供的通信设备(例如终端设备,或接入网设备)。即将实现处理单元710、收发单元730功能的程序代码存储在存储单元720中,通用处理单元通过执行存储单元720中的代码来实现处理单元710、收发单元730的功能。As another implementation manner, a general-purpose computer may be used to implement the communication device (for example, a terminal device, or an access network device) provided in this embodiment of the present application. The program codes that will implement the functions of the processing unit 710 and the transceiver unit 730 are stored in the storage unit 720 , and the general processing unit implements the functions of the processing unit 710 and the transceiver unit 730 by executing the codes in the storage unit 720 .
一些实施例中,装置700可以为第一设备,或设置于第一设备的芯片或电路。当装置700为第一设备,或设置于第一设备的芯片或电路时,收发单元730用于向第二设备发送第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;所述收发单元730还用于接收第二设备发送的第一同步消息,所述第一同步消息是所述第二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送的,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作;处理单元710,用于根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的第一媒体资产和所述第一媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。In some embodiments, the apparatus 700 may be the first device, or a chip or circuit provided in the first device. When the apparatus 700 is the first device, or is provided in a chip or circuit of the first device, the transceiver unit 730 is configured to send a first query request to the second device, where the first query request is used to query the second device Whether there is a media asset change; the transceiver unit 730 is further configured to receive the first synchronization message sent by the second device, the first synchronization message is that the second device receives the first query request and determines that there is a Sent to the first device after the first media asset is changed, the first synchronization message carries the first media asset change content of the second device, and the first media asset change content includes the changed first media asset. The action corresponding to the change of the media asset and the first media asset; the processing unit 710 is configured to generate a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first synchronization A change list and a first device list, the first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the first media assets that have been changed in the first data synchronization and the The action corresponding to the change of the first media asset, and the first device list is used to record the device for which the first data is synchronized.
在一种实现方式中,所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述第一媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第二设备的设备ID。In an implementation manner, the first synchronization node includes: one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device , wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: the first change list ID and the first media asset change content of the second device; the The first device list includes: the first device list ID and the device ID of the second device.
在一种实现方式中,所述第一同步变更内容包括第二设备的第一媒体资产变更内容,所述第一同步设备包括所述第二设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第一媒体资产变更内容的索引,所述第一同步设备中包括与 第二设备相关的索引,所述第一媒体资产变更内容的索引用于查找所述第一媒体资产变更内容,所述与第二设备相关的索引用于查找与所述第二设备相关的信息。In an implementation manner, the first synchronization change content includes the first media asset change content of the second device, and the first synchronization device includes the device ID of the second device; or, the first synchronization change The content includes an index of the first change list, the first synchronization device includes an index of the first device list, the index of the change list is used to find the first change list, and the index of the device list is used to find the first device list; or, the first synchronization change content includes an index of the first media asset change content, the first synchronization device includes an index related to a second device, the first media The index of the asset modification content is used to search for the first media asset modification content, and the index related to the second device is used to search for information related to the second device.
在一种实现方式中,所述第一设备接收第二设备发送的第一同步消息之前,所述第一设备上的媒体资产发生变更,所述处理单元710还用于:新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容。In an implementation manner, before the first device receives the first synchronization message sent by the second device, the media asset on the first device is changed, and the processing unit 710 is further configured to: add a second change list, the second change list includes a second change list ID and media asset changes on the first device.
在一种实现方式中,所述第一设备接收第二设备发送的第一同步消息后,所述处理单元710还用于:所述第一设备根据所述第一同步消息,生成第二同步记录,所述第二同步记录包括第二同步节点、所述第二更改列表和第二设备列表;所述第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,所述第二同步节点ID用于标识第二数据同步;在所述第二更改列表中,增加第二设备的媒体资产变更内容;在所述第二设备列表中增加所述第二设备的设备ID。In an implementation manner, after the first device receives the first synchronization message sent by the second device, the processing unit 710 is further configured to: the first device generates a second synchronization message according to the first synchronization message record, the second synchronization record includes the second synchronization node, the second change list and the second device list; the second synchronization node includes the second synchronization node ID, the second synchronization timestamp, the second parent synchronization node One or more of the identifier, the second synchronization change content, and the second synchronization device, the second synchronization node ID is used to identify the second data synchronization; in the second change list, add the media assets of the second device Change the content; add the device ID of the second device to the second device list.
在一种实现方式中,所述收发单元730还用于:向所述第二设备发送第二查询请求,所述第二查询请求用于查询所述第二设备上是否有媒体资产变更;接收所述第二设备发送的第二同步消息,所述第二同步消息是所述第二设备接收到所述第二查询请求,并判断有第二媒体资产变更后向所述第一设备发送的,所述第二同步消息携带有所述第二设备的第二媒体资产变更内容,所述第二媒体资产变更内容包括发生变更的第二媒体资产和所述第二媒体资产变更对应的动作;所述处理单元710还用于:根据所述第二同步消息,生成第三同步记录,所述第三同步记录包括第三同步节点、第三更改列表和第三设备列表,其中,所述第三同步节点中包括第三同步节点ID,第三同步时间戳、第三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,所述第三同步节点ID用于标识三数据同步;第三更改列表包括第三更改列表ID,所述第二设备的第二媒体资产变更内内容;所述第三设备列表包括第三设备列表ID,和所述第二设备的设备ID;In an implementation manner, the transceiver unit 730 is further configured to: send a second query request to the second device, where the second query request is used to query whether there is a media asset change on the second device; receive The second synchronization message sent by the second device, where the second synchronization message is sent to the first device after the second device receives the second query request and determines that the second media asset is changed , the second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed second media asset and the action corresponding to the second media asset change; The processing unit 710 is further configured to: generate a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list, wherein the third synchronization record is The three synchronization nodes include a third synchronization node ID, one or more of a third synchronization timestamp, a third parent synchronization node identifier, a third synchronization change content, and a third synchronization device, wherein the third synchronization node ID Used to identify three data synchronization; the third change list includes a third change list ID, the second media asset of the second device changes content; the third device list includes a third device list ID, and the second Device ID of the device;
所述处理单元还用于:移除所述第一设备列表ID中的所述第二设备的设备ID。The processing unit is further configured to: remove the device ID of the second device in the first device list ID.
在一种实现方式中,所述第一设备列表中的设备ID为空,所述处理单元删除所述第一设备列表。In an implementation manner, the device ID in the first device list is empty, and the processing unit deletes the first device list.
在一种实现方式中,当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,与所述根节点的相邻同步节点成为新的根节点。In an implementation manner, when the first synchronization node is a root (Root) node, the root node and the first change list are deleted, and the synchronization node adjacent to the root node becomes a new root node .
在一种实现方式中,所述第三同步节点为顶(Top)节点,所述顶节点和所述根节点之间的节点为中间(middle)节点。In an implementation manner, the third synchronization node is a top node, and a node between the top node and the root node is a middle node.
在一种实现方式中,当所述第一设备与所述第二设备的数据同步过程异常终止时,所述处理单元710还用于:创建临时中间节点,所述临时中间节点中包含临时状态标识,所述临时中间节点用于保存未完成数据同步的同步数据。In an implementation manner, when the data synchronization process between the first device and the second device terminates abnormally, the processing unit 710 is further configured to: create a temporary intermediate node, where the temporary intermediate node includes a temporary state identifier, the temporary intermediate node is used to save the synchronization data for which data synchronization is not completed.
在一种实现方式中,在所述第一数据同步时,所述收发单元730还用于接收所述第二设备发送的第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行的哈希运算得到的,所述第一同步消息包括所述第一哈希值;所述处理单元710还用于根据所述第一更改列表内容进行哈希计算,得到第二哈希值;当所述处理单元判断所述第一哈希值与所述第二哈希值相等时,所述处理单元确定所述本次数据同步成功。In an implementation manner, when the first data is synchronized, the transceiver unit 730 is further configured to receive a first hash value sent by the second device, where the first hash value is the second hash value Obtained from the hash operation performed by the device according to the content of the first media asset change, the first synchronization message includes the first hash value; the processing unit 710 is further configured to perform the change according to the content of the first change list Hash calculation to obtain a second hash value; when the processing unit determines that the first hash value is equal to the second hash value, the processing unit determines that the current data synchronization is successful.
当该装置700配置在或本身即为第一设备时,装置700中各模块或单元可以用于执行上述方法中设备A所执行的各动作或处理过程,这里,为了避免赘述,省略其详细说明。When the apparatus 700 is configured in or is itself the first device, each module or unit in the apparatus 700 can be used to perform each action or processing process performed by the device A in the above method. Here, in order to avoid redundant description, the detailed description thereof is omitted. .
一些实施例中,装置700可以为第二设备,或设置于第二设备的芯片或电路。当装置700为第二设备,或设置于第二设备的芯片或电路时,收发单元730用于接收第一设备发送的第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;处理单元710用于根据所述第一查询请求,确定有第一媒体资产变更,向所述第一设备发送第一同步消息,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作。In some embodiments, the apparatus 700 may be the second device, or a chip or circuit provided in the second device. When the apparatus 700 is the second device, or is provided in a chip or circuit of the second device, the transceiver unit 730 is configured to receive a first query request sent by the first device, where the first query request is used to query the second device Whether there is a media asset change on the server; the processing unit 710 is configured to determine, according to the first query request, that there is a first media asset change, and send a first synchronization message to the first device, where the first synchronization message carries the The content of the first media asset change of the second device, where the content of the first media asset change includes the changed first media asset and an action corresponding to the change of the first media asset.
在一种实现方式中,所述第二设备上的所述第一媒体资产发生变更,所述处理单元710还用于新增第一更改列表;所述收发单元730还用于:向所述第一设备发送第三查询请求,所述第三查询请求用于查询所述第一设备上是否有媒体资产变更;接收所述第一设备发送的第一反馈消息,所述第一反馈消息是所述第一设备在接收到所述第三查询请求,并判断所述第一设备上没有媒体资产变更后向所述第二设备发送的,所述第一反馈消息用于标识所述第一设备上没有发生媒体资产变更;所述处理单元710还用于:根据所述第一反馈消息和所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、所述第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的媒体资产和所述媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。In an implementation manner, when the first media asset on the second device is changed, the processing unit 710 is further configured to add a first change list; the transceiver unit 730 is further configured to: send a message to the The first device sends a third query request, where the third query request is used to query whether there is a media asset change on the first device; and receives a first feedback message sent by the first device, where the first feedback message is Sent by the first device to the second device after receiving the third query request and judging that there is no media asset change on the first device, the first feedback message is used to identify the first No media asset change has occurred on the device; the processing unit 710 is further configured to: generate a first synchronization record according to the first feedback message and the first synchronization message, where the first synchronization record includes the first synchronization node, the first change list and the first device list, the first synchronization node is used to record the information of the first data synchronization, and the first change list is used to record the changed media in the first data synchronization The asset is an action corresponding to the change of the media asset, and the first device list is used to record the device for which the first data is synchronized.
在一种实现方式中,所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;所述第一更改列表包括:第一更改列表ID和所述第二设备的所述媒体资产变更内容;所述第一设备列表包括:第一设备列表ID和所述第一设备的设备ID。In an implementation manner, the first synchronization node includes: one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device , wherein the first synchronization node ID is used to identify the first data synchronization; the first change list includes: the first change list ID and the content of the media asset change of the second device; the first change list The device list includes: a first device list ID and a device ID of the first device.
在一种实现方式中,所述第一同步变更内容包括第二设备的媒体资产变更内容,所述第一同步设备包括所述第一设备的设备ID;或者,所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,所述第一同步变更内容中包括所述第二设备的媒体资产变更内容的索引,所述第一同步设备中包括与第一设备相关的索引,所述第二设备的媒体资产变更内容的索引用于查找所述第二设备的媒体资产变更内容,所述与第一设备相关的索引用于查找与所述第一设备相关的信息。In an implementation manner, the first synchronization change content includes the media asset change content of the second device, and the first synchronization device includes the device ID of the first device; or, in the first synchronization change content Including the index of the first change list, the first synchronization device includes the index of the first device list, the index of the change list is used to find the first change list, and the index of the device list is used to find the A first device list; or, the first synchronization change content includes an index of the media asset change content of the second device, the first synchronization device includes an index related to the first device, and the second device The index of the modified content of the media asset is used to look up the modified content of the media asset of the second device, and the index related to the first device is used to look up the information related to the first device.
在一种实现方式中,所述处理单元710具体用于:根据所述第一查询请求和第二设备上的同步记录,判断有第一媒体资产变更;或者,根据所述第一查询请求和第二设备上的更改列表,判断有第一媒体资产变更。In an implementation manner, the processing unit 710 is specifically configured to: determine that the first media asset is changed according to the first query request and the synchronization record on the second device; or, according to the first query request and the synchronization record on the second device The change list on the second device determines that the first media asset is changed.
在一种实现方式中,所述第一同步消息包括第一哈希值,所述第一哈希值是所述处理单元根据所述第一媒体资产变更内容进行哈希运算得到的。In an implementation manner, the first synchronization message includes a first hash value, and the first hash value is obtained by the processing unit performing a hash operation according to the changed content of the first media asset.
当该装置700配置在或本身即为第二设备时,装置700中各模块或单元可以用于执行上述方法中设备B所执行的各动作或处理过程,这里,为了避免赘述,省略其详细说明。When the apparatus 700 is configured in or itself is the second device, each module or unit in the apparatus 700 can be used to perform each action or processing process performed by the device B in the above method. Here, in order to avoid redundant description, the detailed description thereof is omitted. .
图21为本申请提供的一种终端设备800的结构示意图。该终端设备800可以执行上述方法实施例中第一设备和第二设备执行的动作。FIG. 21 is a schematic structural diagram of a terminal device 800 provided by this application. The terminal device 800 may perform the actions performed by the first device and the second device in the foregoing method embodiments.
为了便于说明,图21仅示出了终端设备的主要部件。如图21所示,终端设备800包括处理器、存储器、控制电路、天线以及输入输出装置。For convenience of explanation, FIG. 21 shows only the main components of the terminal device. As shown in FIG. 21 , the terminal device 800 includes a processor, a memory, a control circuit, an antenna, and an input and output device.
处理器主要用于对通信协议以及通信数据进行处理,以及对整个终端设备进行控制,执行软件程序,处理软件程序的数据,例如用于支持终端设备执行上述传输预编码矩阵的指示方法实施例中所描述的动作。存储器主要用于存储软件程序和数据,例如存储上述实施例中所描述的码本。控制电路主要用于基带信号与射频信号的转换以及对射频信号的处理。控制电路和天线一起也可以叫做收发器,主要用于收发电磁波形式的射频信号。输入输出装置,例如触摸屏、显示屏,键盘等主要用于接收用户输入的数据以及对用户输出数据。The processor is mainly used to process communication protocols and communication data, and to control the entire terminal device, execute software programs, and process data of the software programs, for example, for supporting the terminal device to execute the above-mentioned transmission precoding matrix instruction method embodiment. the described action. The memory is mainly used to store software programs and data, such as the codebook described in the above embodiments. The control circuit is mainly used for the conversion of the baseband signal and the radio frequency signal and the processing of the radio frequency signal. The control circuit together with the antenna can also be called a transceiver, which is mainly used to send and receive radio frequency signals in the form of electromagnetic waves. Input and output devices, such as touch screens, display screens, and keyboards, are mainly used to receive data input by users and output data to users.
当终端设备开机后,处理器可以读取存储单元中的软件程序,解释并执行软件程序的指令,处理软件程序的数据。当需要通过无线发送数据时,处理器对待发送的数据进行基带处理后,输出基带信号至射频电路,射频电路将基带信号进行射频处理后将射频信号通过天线以电磁波的形式向外发送。当有数据发送到终端设备时,射频电路通过天线接收到射频信号,将射频信号转换为基带信号,并将基带信号输出至处理器,处理器将基带信号转换为数据并对该数据进行处理。When the terminal device is powered on, the processor can read the software program in the storage unit, interpret and execute the instructions of the software program, and process the data of the software program. When data needs to be sent wirelessly, the processor performs baseband processing on the data to be sent, and outputs the baseband signal to the radio frequency circuit. The radio frequency circuit performs radio frequency processing on the baseband signal and sends the radio frequency signal through the antenna in the form of electromagnetic waves. When data is sent to the terminal device, the radio frequency circuit receives the radio frequency signal through the antenna, converts the radio frequency signal into a baseband signal, and outputs the baseband signal to the processor, which converts the baseband signal into data and processes the data.
本领域技术人员可以理解,为了便于说明,图21仅示出了一个存储器和处理器。在实际的终端设备中,可以存在多个处理器和存储器。存储器也可以称为存储介质或者存储设备等,本申请实施例对此不做限制。Those skilled in the art can understand that, for the convenience of description, FIG. 21 only shows one memory and one processor. In an actual terminal device, there may be multiple processors and memories. The memory may also be referred to as a storage medium or a storage device, etc., which is not limited in this embodiment of the present application.
例如,处理器可以包括基带处理器和中央处理器,基带处理器主要用于对通信协议以及通信数据进行处理,中央处理器主要用于对整个终端设备进行控制,执行软件程序,处理软件程序的数据。图21中的处理器集成了基带处理器和中央处理器的功能,本领域技术人员可以理解,基带处理器和中央处理器也可以是各自独立的处理器,通过总线等技术互联。本领域技术人员可以理解,终端设备可以包括多个基带处理器以适应不同的网络制式,终端设备可以包括多个中央处理器以增强其处理能力,终端设备的各个部件可以通过各种总线连接。所述基带处理器也可以表述为基带处理电路或者基带处理芯片。所述中央处理器也可以表述为中央处理电路或者中央处理芯片。对通信协议以及通信数据进行处理的功能可以内置在处理器中,也可以以软件程序的形式存储在存储单元中,由处理器执行软件程序以实现基带处理功能。For example, the processor may include a baseband processor and a central processing unit. The baseband processor is mainly used to process communication protocols and communication data. The central processing unit is mainly used to control the entire terminal device, execute software programs, and process software programs. data. The processor in FIG. 21 integrates the functions of the baseband processor and the central processing unit. Those skilled in the art can understand that the baseband processor and the central processing unit may also be independent processors, interconnected by technologies such as a bus. Those skilled in the art can understand that a terminal device may include multiple baseband processors to adapt to different network standards, a terminal device may include multiple central processors to enhance its processing capability, and various components of the terminal device may be connected through various buses. The baseband processor may also be expressed as a baseband processing circuit or a baseband processing chip. The central processing unit can also be expressed as a central processing circuit or a central processing chip. The function of processing the communication protocol and communication data may be built in the processor, or may be stored in the storage unit in the form of a software program, and the processor executes the software program to realize the baseband processing function.
示例性的,在本申请实施例中,可以将具有收发功能的天线和控制电路视为终端设备800的收发单元810,将具有处理功能的处理器视为终端设备800的处理单元820。如图21所示,终端设备800包括收发单元810和处理单元820。收发单元也可以称为收发器、收发机、收发装置等。可选的,可以将收发单元810中用于实现接收功能的器件视为接收单元,将收发单元810中用于实现发送功能的器件视为发送单元,即收发单元包括接收单元和发送单元。示例性的,接收单元也可以称为接收机、接收器、接收电路等,发送单元可以称为发射机、发射器或者发射电路等。Exemplarily, in this embodiment of the present application, an antenna and a control circuit with a transceiver function may be regarded as the transceiver unit 810 of the terminal device 800 , and a processor with a processing function may be regarded as the processing unit 820 of the terminal device 800 . As shown in FIG. 21 , the terminal device 800 includes a transceiver unit 810 and a processing unit 820 . The transceiving unit may also be referred to as a transceiver, a transceiver, a transceiving device, or the like. Optionally, the device for implementing the receiving function in the transceiver unit 810 may be regarded as a receiving unit, and the device for implementing the transmitting function in the transceiver unit 810 may be regarded as a transmitting unit, that is, the transceiver unit includes a receiving unit and a transmitting unit. Exemplarily, the receiving unit may also be referred to as a receiver, a receiver, a receiving circuit, and the like, and the transmitting unit may be referred to as a transmitter, a transmitter, or a transmitting circuit, or the like.
应理解,本申请实施例中,该处理器可以为中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this embodiment of the present application, the processor may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), dedicated integrated Circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
还应理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包 括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的随机存取存储器(random access memory,RAM)可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。It should also be understood that the memory in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically programmable Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. Volatile memory may be random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (DRAM) Access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory Fetch memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DR RAM).
上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令或计算机程序。在计算机上加载或执行所述计算机指令或计算机程序时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘。The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server or data center by wire (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that contains one or more sets of available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media. The semiconductor medium may be a solid state drive.
本申请实施例还提供了一种计算机可读介质,其上存储有计算机程序,该计算机程序被计算机执行时实现上述任一实施例中的第一设备执行的步骤,或者第二设备执行的步骤。Embodiments of the present application further provide a computer-readable medium on which a computer program is stored, and when the computer program is executed by a computer, implements the steps performed by the first device or the steps performed by the second device in any of the foregoing embodiments .
本申请实施例还提供了一种计算机程序产品,该计算机程序产品被计算机执行时实现上述任一实施例中的第一设备执行的步骤,或者第二设备执行的步骤。Embodiments of the present application further provide a computer program product, which, when executed by a computer, implements the steps performed by the first device or the steps performed by the second device in any of the foregoing embodiments.
本申请实施例还提供了一种系统芯片,该系统芯片包括:通信单元和处理单元。该处理单元,例如可以是处理器。该通信单元例如可以是通信接口、输入/输出接口、管脚或电路等。该处理单元可执行计算机指令,以使该通信装置内的芯片执行上述本申请实施例提供的第一设备执行的步骤,或者第二设备执行的步骤。An embodiment of the present application also provides a system chip, where the system chip includes: a communication unit and a processing unit. The processing unit may, for example, be a processor. The communication unit may be, for example, a communication interface, an input/output interface, a pin or a circuit, or the like. The processing unit can execute computer instructions, so that the chip in the communication apparatus executes the steps performed by the first device or the steps performed by the second device provided in the foregoing embodiments of the present application.
可选地,该计算机指令被存储在存储单元中。Optionally, the computer instructions are stored in a storage unit.
根据本申请实施例提供的方法,本申请实施例还提供一种通信系统,其包括前述的第一设备和第二设备。According to the method provided by the embodiment of the present application, the embodiment of the present application further provides a communication system, which includes the aforementioned first device and the second device.
本申请中的各个实施例可以独立的使用,也可以进行联合的使用,这里不做限定。Each embodiment in this application can be used independently or in combination, which is not limited here.
另外,本申请的各个方面或特征可以实现成方法、装置或使用标准编程和/或工程技术的制品。本申请中使用的术语“制品”涵盖可从任何计算机可读器件、载体或介质访问的计算机程序。例如,计算机可读介质可以包括,但不限于:磁存储器件(例如,硬盘、软盘或磁带等),光盘(例如,压缩盘(compact disc,CD)、数字通用盘(digital versatile disc, DVD)等),智能卡和闪存器件(例如,可擦写可编程只读存储器(erasable programmable read-only memory,EPROM)、卡、棒或钥匙驱动器等)。另外,本文描述的各种存储介质可代表用于存储信息的一个或多个设备和/或其它机器可读介质。术语“机器可读介质”可包括但不限于,无线信道和能够存储、包含和/或承载指令和/或数据的各种其它介质。Additionally, various aspects or features of the present application may be implemented as a method, apparatus, or article of manufacture using standard programming and/or engineering techniques. The term "article of manufacture" as used in this application encompasses a computer program accessible from any computer readable device, carrier or medium. For example, computer readable media may include, but are not limited to: magnetic storage devices (eg, hard disks, floppy disks, or magnetic tapes, etc.), optical disks (eg, compact discs (CDs), digital versatile discs (DVDs) etc.), smart cards and flash memory devices (eg, erasable programmable read-only memory (EPROM), card, stick or key drives, etc.). Additionally, various storage media described herein can represent one or more devices and/or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and/or carrying instructions and/or data.
应理解,“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。“至少一个”是指一个或一个以上;“A和B中的至少一个”,类似于“A和/或B”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和B中的至少一个,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。It should be understood that "and/or", which describes the relationship between related objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. condition. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one" refers to one or more than one; "at least one of A and B", similar to "A and/or B", describes the association relationship of associated objects, indicating that there can be three kinds of relationships, for example, A and B At least one of the three cases can represent: A exists alone, A and B exist simultaneously, and B exists alone.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (38)

  1. 一种移动分布式系统数据同步的方法,其特征在于,包括:A method for data synchronization in a mobile distributed system, comprising:
    第一设备向第二设备发送第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;The first device sends a first query request to the second device, where the first query request is used to query whether there is a media asset change on the second device;
    第一设备接收第二设备发送的第一同步消息,所述第一同步消息是所述第二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送的,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作;The first device receives the first synchronization message sent by the second device, where the first synchronization message is sent to the first device by the second device after receiving the first query request and judging that the first media asset is changed. Sent by the device, the first synchronization message carries the first media asset change content of the second device, and the first media asset change content includes the changed first media asset and the first media asset change corresponding Actions;
    所述第一设备根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的第一媒体资产和所述第一媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。The first device generates a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list, and the first synchronization node uses For recording the information of the first data synchronization, the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset, and the first device list A device for recording the first data synchronization.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识ID、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;The first synchronization node includes: one or more of a first synchronization node identification, a first synchronization timestamp, a first parent synchronization node identification ID, a first synchronization change content, and a first synchronization device, wherein the first synchronization node The synchronization node ID is used to identify the first data synchronization;
    所述第一更改列表包括:第一更改列表ID和所述第二设备的所述第一媒体资产变更内容;The first change list includes: a first change list ID and the first media asset change content of the second device;
    所述第一设备列表包括:第一设备列表ID和所述第二设备的设备ID。The first device list includes: a first device list ID and a device ID of the second device.
  3. 根据权利要求2所述的方法,其特征在于,所述第一同步变更内容包括第二设备的第一媒体资产变更内容,所述第一同步设备包括所述第二设备的设备ID;或者,The method according to claim 2, wherein the first synchronization change content comprises a first media asset change content of a second device, and the first synchronization device includes a device ID of the second device; or,
    所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,The first synchronization change content includes an index of a first change list, the first synchronization device includes an index of a first device list, and the index of the change list is used to find the first change list, the device The index of the list is used to look up the first device list; or,
    所述第一同步变更内容中包括所述第一媒体资产变更内容的索引,所述第一同步设备中包括与第二设备相关的索引,所述第一媒体资产变更内容的索引用于查找所述第一媒体资产变更内容,所述与第二设备相关的索引用于查找与所述第二设备相关的信息。The first synchronization change content includes an index of the first media asset change content, the first synchronization device includes an index related to the second device, and the index of the first media asset change content is used to find the index of the first media asset change content. The first media asset changes content, and the index related to the second device is used to search for information related to the second device.
  4. 根据权利要求1所述的方法,其特征在于,所述第一设备接收第二设备发送的第一同步消息之前,所述方法还包括:The method according to claim 1, wherein before the first device receives the first synchronization message sent by the second device, the method further comprises:
    所述第一设备上的媒体资产发生变更,所述第一设备新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容。When the media asset on the first device is changed, the first device adds a second change list, and the second change list includes the second change list ID and the content of the media asset change on the first device.
  5. 根据权利要求4所述的方法,其特征在于,所述第一设备接收第二设备发送的第一同步消息后,所述方法还包括:The method according to claim 4, wherein after the first device receives the first synchronization message sent by the second device, the method further comprises:
    所述第一设备根据所述第一同步消息,生成第二同步记录,所述第二同步记录包括第二同步节点、所述第二更改列表和第二设备列表;The first device generates a second synchronization record according to the first synchronization message, where the second synchronization record includes a second synchronization node, the second change list and a second device list;
    所述第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,所述第二同步节点ID用于标识第二数据同步;The second synchronization node includes a second synchronization node ID, one or more of a second synchronization time stamp, a second parent synchronization node identifier, a second synchronization change content, and a second synchronization device, and the second synchronization node ID for identifying the second data synchronization;
    在所述第二更改列表中,增加第二设备的媒体资产变更内容;In the second modification list, add the media asset modification content of the second device;
    在所述第二设备列表中增加所述第二设备的设备ID。The device ID of the second device is added to the second device list.
  6. 根据权利要求2至5中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 2 to 5, wherein the method further comprises:
    所述第一设备向所述第二设备发送第二查询请求,所述第二查询请求用于查询所述第二设备上是否有媒体资产变更;The first device sends a second query request to the second device, where the second query request is used to query whether there is a media asset change on the second device;
    所述第一设备接收所述第二设备发送的第二同步消息,所述第二同步消息是所述第二设备接收到所述第二查询请求,并判断有第二媒体资产变更后向所述第一设备发送的,所述第二同步消息携带有所述第二设备的第二媒体资产变更内容,所述第二媒体资产变更内容包括发生变更的第二媒体资产和所述第二媒体资产变更对应的动作;The first device receives the second synchronization message sent by the second device, where the second synchronization message is that the second device receives the second query request and determines that the second media asset is changed and then sends the message to the second device. sent by the first device, the second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed second media asset and the second media Actions corresponding to asset changes;
    所述第一设备根据所述第二同步消息,生成第三同步记录,所述第三同步记录包括第三同步节点、第三更改列表和第三设备列表,The first device generates a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list,
    所述第三同步节点中包括:第三同步节点ID,第三同步时间戳、第三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,所述第三同步节点ID用于标识三数据同步;The third synchronization node includes one or more of a third synchronization node ID, a third synchronization timestamp, a third parent synchronization node identifier, a third synchronization change content, and a third synchronization device, wherein the third synchronization node The three synchronization node ID is used to identify the three data synchronization;
    第三更改列表包括第三更改列表ID,所述第二设备的第二媒体资产变更内内容;The third change list includes a third change list ID, and the second media asset of the second device changes the content;
    所述第三设备列表包括第三设备列表ID,和所述第二设备的设备ID;The third device list includes a third device list ID, and the device ID of the second device;
    移除所述第一设备列表ID中的所述第二设备的设备ID。The device ID of the second device in the first device list ID is removed.
  7. 根据权利要求6所述的方法,其特征在于,所述第一设备列表中的设备ID为空,删除所述第一设备列表。The method according to claim 6, wherein the device ID in the first device list is empty, and the first device list is deleted.
  8. 根据权利要求7所述的方法,其特征在于,当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,与所述根节点的相邻同步节点成为新的根节点。The method according to claim 7, wherein when the first synchronization node is a root (Root) node, delete the root node and the first change list, and synchronize with the neighbors of the root node The node becomes the new root node.
  9. 根据权利要求6至8中任一项所述的方法,其特征在于,所述第三同步节点为顶(Top)节点,所述顶节点和所述根节点之间的节点为中间(middle)节点。The method according to any one of claims 6 to 8, wherein the third synchronization node is a top (Top) node, and a node between the top node and the root node is a middle (middle) node node.
  10. 根据权利要求1至8中任一项所述的方法,其特征在于,当所述第一设备与所述第二设备的数据同步过程异常终止时,创建临时中间节点,所述临时中间节点中包含临时状态标识,所述临时中间节点用于保存未完成数据同步的同步数据。The method according to any one of claims 1 to 8, wherein when a data synchronization process between the first device and the second device is abnormally terminated, a temporary intermediate node is created, and the temporary intermediate node It contains a temporary state identifier, and the temporary intermediate node is used to save the synchronization data for which data synchronization has not been completed.
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 10, wherein the method further comprises:
    在所述第一数据同步时,所述第一设备接收所述第二设备发送的第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行的哈希运算得到的,所述第一同步消息包括所述第一哈希值;When the first data is synchronized, the first device receives a first hash value sent by the second device, where the first hash value is the content modified by the second device according to the first media asset Obtained by the performed hash operation, the first synchronization message includes the first hash value;
    所述第一设备根据所述第一更改列表内容进行哈希计算,得到第二哈希值;The first device performs hash calculation according to the content of the first change list to obtain a second hash value;
    当所述第一设备判断所述第一哈希值与所述第二哈希值相等时,所述第一设备确定所述本次数据同步成功。When the first device determines that the first hash value is equal to the second hash value, the first device determines that the current data synchronization is successful.
  12. 一种移动分布式系统数据同步的方法,其特征在于,包括:A method for data synchronization in a mobile distributed system, comprising:
    第二设备接收第一设备发送的第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;The second device receives a first query request sent by the first device, where the first query request is used to query whether there is a media asset change on the second device;
    所述第二设备根据所述第一查询请求,确定有第一媒体资产变更,向所述第一设备发送第一同步消息,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作。The second device determines that the first media asset is changed according to the first query request, and sends a first synchronization message to the first device, where the first synchronization message carries the first media of the second device Asset change content, where the first media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
  13. 根据权利要求12所述的方法,其特征在于,所述第二设备接收第一设备发送的第一查询请求之前,所述方法还包括:The method according to claim 12, wherein before the second device receives the first query request sent by the first device, the method further comprises:
    所述第二设备上的所述第一媒体资产发生变更,所述第二设备新增第一更改列表;The first media asset on the second device is changed, and the second device adds a first change list;
    所述方法还包括:The method also includes:
    所述第二设备向所述第一设备发送第三查询请求,所述第三查询请求用于查询所述第一设备上是否有媒体资产变更;The second device sends a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
    所述第二设备接收所述第一设备发送的第一反馈消息,所述第一反馈消息是所述第一设备在接收到所述第三查询请求,并判断所述第一设备上没有媒体资产变更后向所述第二设备发送的,所述第一反馈消息用于标识所述第一设备上没有发生媒体资产变更;The second device receives a first feedback message sent by the first device, where the first feedback message is that the first device receives the third query request and determines that there is no media on the first device Sent to the second device after the asset is changed, the first feedback message is used to identify that no media asset change has occurred on the first device;
    所述第二设备根据所述第一反馈消息和所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、所述第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的媒体资产和所述媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。The second device generates a first synchronization record according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, so The first device list is used to record the first data synchronization device.
  14. 根据权利要求13所述的方法,其特征在于,The method of claim 13, wherein:
    所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;The first synchronization node includes one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device, wherein the first synchronization The node ID is used to identify the first data synchronization;
    所述第一更改列表包括:第一更改列表ID和所述第二设备的所述媒体资产变更内容;The first change list includes: a first change list ID and the content of the media asset change of the second device;
    所述第一设备列表包括:第一设备列表ID和所述第一设备的设备ID。The first device list includes: a first device list ID and a device ID of the first device.
  15. 根据权利要求14所述的方法,其特征在于,所述第一同步变更内容包括所述第二设备的媒体资产变更内容,所述第一同步设备包括所述第一设备的设备ID;或者,The method according to claim 14, wherein the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes a device ID of the first device; or,
    所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,The first synchronization change content includes an index of a first change list, the first synchronization device includes an index of a first device list, and the index of the change list is used to find the first change list, the device The index of the list is used to look up the first device list; or,
    所述第一同步变更内容中包括所述第二设备的媒体资产变更内容的索引,所述第一同步设备中包括与第一设备相关的索引,所述第二设备的媒体资产变更内容的索引用于查找所述第二设备的媒体资产变更内容,所述与第一设备相关的索引用于查找与所述第一设备相关的信息。The first synchronization change content includes an index of the second device's media asset change content, the first synchronization device includes an index related to the first device, and the second device's media asset change content index and the index related to the first device is used to search for information related to the first device.
  16. 根据权利要求12至15中任一项所述的方法,其特征在于,所述第二设备根据所述第一查询请求,判断有第一媒体资产变更,包括:The method according to any one of claims 12 to 15, wherein the second device determines, according to the first query request, that there is a change in the first media asset, comprising:
    所述第二设备根据所述第一查询请求和第二设备上的同步记录,判断有第一媒体资产变更;或者,The second device determines that there is a first media asset change according to the first query request and the synchronization record on the second device; or,
    所述第二设备根据所述第一查询请求和第二设备上的更改列表,判断有第一媒体资产变更。The second device determines that the first media asset is changed according to the first query request and the change list on the second device.
  17. 根据权利要求12至16中任一项所述的方法,其特征在于,The method according to any one of claims 12 to 16, wherein,
    所述第一同步消息包括第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行哈希运算得到的。The first synchronization message includes a first hash value, and the first hash value is obtained by the second device performing a hash operation according to the changed content of the first media asset.
  18. 一种设备,所述设备为第一设备,其特征在于,包括:A device, the device is a first device, characterized in that it includes:
    收发单元,用于向第二设备发送第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;a transceiver unit, configured to send a first query request to the second device, where the first query request is used to query whether there is a media asset change on the second device;
    所述收发单元还用于接收第二设备发送的第一同步消息,所述第一同步消息是所述第二设备在接收到所述第一查询请求,并判断有第一媒体资产变更后向所述第一设备发送的,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作;The transceiver unit is further configured to receive a first synchronization message sent by the second device, where the first synchronization message is sent to the second device after receiving the first query request and judging that the first media asset has been changed. Sent by the first device, the first synchronization message carries the first media asset modification content of the second device, and the first media asset modification content includes the modified first media asset and the first media asset. Actions corresponding to media asset changes;
    处理单元,用于根据所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的第一媒体资产和所述第一媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。The processing unit is configured to generate a first synchronization record according to the first synchronization message, wherein the first synchronization record includes a first synchronization node, a first change list and a first device list, and the first synchronization node uses For recording the information of the first data synchronization, the first change list is used to record the first media asset changed in the first data synchronization and the action corresponding to the change of the first media asset, and the first device list A device for recording the first data synchronization.
  19. 根据权利要求18所述的第一设备,其特征在于,The first device of claim 18, wherein:
    所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;The first synchronization node includes one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device, wherein the first synchronization The node ID is used to identify the first data synchronization;
    所述第一更改列表包括:第一更改列表ID和所述第二设备的所述第一媒体资产变更内容;The first change list includes: a first change list ID and the first media asset change content of the second device;
    所述第一设备列表包括:第一设备列表ID和所述第二设备的设备ID。The first device list includes: a first device list ID and a device ID of the second device.
  20. 根据权利要求19所述的第一设备,其特征在于,所述第一同步变更内容包括第二设备的第一媒体资产变更内容,所述第一同步设备包括所述第二设备的设备ID;或者,The first device according to claim 19, wherein the first synchronization change content includes a first media asset change content of the second device, and the first synchronization device includes a device ID of the second device; or,
    所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,The first synchronization change content includes an index of a first change list, the first synchronization device includes an index of a first device list, and the index of the change list is used to find the first change list, the device The index of the list is used to look up the first device list; or,
    所述第一同步变更内容中包括所述第一媒体资产变更内容的索引,所述第一同步设备中包括与第二设备相关的索引,所述第一媒体资产变更内容的索引用于查找所述第一媒体资产变更内容,所述与第二设备相关的索引用于查找与所述第二设备相关的信息。The first synchronization change content includes an index of the first media asset change content, the first synchronization device includes an index related to the second device, and the index of the first media asset change content is used to find the index of the first media asset change content. The first media asset changes content, and the index related to the second device is used to search for information related to the second device.
  21. 根据权利要求18所述的第一设备,其特征在于,所述第一设备接收第二设备发送的第一同步消息之前,所述第一设备上的媒体资产发生变更,所述处理单元还用于:The first device according to claim 18, wherein before the first device receives the first synchronization message sent by the second device, the media asset on the first device is changed, and the processing unit further uses At:
    新增第二更改列表,所述第二更改列表包括第二更改列表ID和所述第一设备上的媒体资产变更内容。A second change list is added, and the second change list includes the second change list ID and the content of the media asset change on the first device.
  22. 根据权利要求21所述的第一设备,其特征在于,所述第一设备接收第二设备发送的第一同步消息后,所述处理单元还用于:The first device according to claim 21, wherein after the first device receives the first synchronization message sent by the second device, the processing unit is further configured to:
    所述第一设备根据所述第一同步消息,生成第二同步记录,所述第二同步记录包括第二同步节点、所述第二更改列表和第二设备列表;The first device generates a second synchronization record according to the first synchronization message, where the second synchronization record includes a second synchronization node, the second change list and a second device list;
    所述第二同步节点包含第二同步节点ID,第二同步时间戳、第二父同步节点标识、第二同步变更内容和第二同步设备中的一个或多个,所述第二同步节点ID用于标识第二数据同步;The second synchronization node includes a second synchronization node ID, one or more of a second synchronization time stamp, a second parent synchronization node identifier, a second synchronization change content, and a second synchronization device, and the second synchronization node ID for identifying the second data synchronization;
    在所述第二更改列表中,增加第二设备的媒体资产变更内容;In the second modification list, add the media asset modification content of the second device;
    在所述第二设备列表中增加所述第二设备的设备ID。The device ID of the second device is added to the second device list.
  23. 根据权利要求19至22中任一项所述的第一设备,其特征在于,The first device according to any one of claims 19 to 22, wherein,
    所述收发单元还用于:The transceiver unit is also used for:
    向所述第二设备发送第二查询请求,所述第二查询请求用于查询所述第二设备上是否有媒体资产变更;sending a second query request to the second device, where the second query request is used to query whether there is a media asset change on the second device;
    接收所述第二设备发送的第二同步消息,所述第二同步消息是所述第二设备接收到所述第二查询请求,并判断有第二媒体资产变更后向所述第一设备发送的,所述第二同步消息携带有所述第二设备的第二媒体资产变更内容,所述第二媒体资产变更内容包括发生变更的第二媒体资产和所述第二媒体资产变更对应的动作;Receive a second synchronization message sent by the second device, where the second synchronization message is sent to the first device after the second device receives the second query request and determines that the second media asset is changed The second synchronization message carries the second media asset change content of the second device, and the second media asset change content includes the changed second media asset and the action corresponding to the second media asset change ;
    所述处理单元还用于:根据所述第二同步消息,生成第三同步记录,所述第三同步记录包括第三同步节点、第三更改列表和第三设备列表,The processing unit is further configured to: generate a third synchronization record according to the second synchronization message, where the third synchronization record includes a third synchronization node, a third change list and a third device list,
    其中,所述第三同步节点中包括第三同步节点ID,第三同步时间戳、第三父同步节点标识、第三同步变更内容和第三同步设备中的一个或多个,其中,所述第三同步节点ID用于标识三数据同步;The third synchronization node includes one or more of a third synchronization node ID, a third synchronization timestamp, a third parent synchronization node identifier, a third synchronization change content, and a third synchronization device, wherein the The third synchronization node ID is used to identify three data synchronizations;
    第三更改列表包括第三更改列表ID,所述第二设备的第二媒体资产变更内内容;The third change list includes a third change list ID, and the second media asset of the second device changes the content;
    所述第三设备列表包括第三设备列表ID,和所述第二设备的设备ID;The third device list includes a third device list ID and a device ID of the second device;
    所述处理单元还用于:移除所述第一设备列表ID中的所述第二设备的设备ID。The processing unit is further configured to: remove the device ID of the second device in the first device list ID.
  24. 根据权利要求23所述的第一设备,其特征在于,所述第一设备列表中的设备ID为空,所述处理单元删除所述第一设备列表。The first device according to claim 23, wherein the device ID in the first device list is empty, and the processing unit deletes the first device list.
  25. 根据权利要求24所述的第一设备,其特征在于,当所述第一同步节点为根(Root)节点时,删除所述根节点和所述第一更改列表,与所述根节点的相邻同步节点成为新的根节点。The first device according to claim 24, wherein, when the first synchronization node is a root (Root) node, the root node and the first change list are deleted, which are the same as the root node. The neighbor sync node becomes the new root node.
  26. 根据权利要求23至25中任一项所述的第一设备,其特征在于,所述第三同步节点为顶(Top)节点,所述顶节点和所述根节点之间的节点为中间(middle)节点。The first device according to any one of claims 23 to 25, wherein the third synchronization node is a top (Top) node, and a node between the top node and the root node is an intermediate ( middle) node.
  27. 根据权利要求18至26中任一项所述的第一设备,其特征在于,当所述第一设备与所述第二设备的数据同步过程异常终止时,所述处理单元还用于:The first device according to any one of claims 18 to 26, wherein when a data synchronization process between the first device and the second device is terminated abnormally, the processing unit is further configured to:
    创建临时中间节点,所述临时中间节点中包含临时状态标识,所述临时中间节点用于保存未完成数据同步的同步数据。Create a temporary intermediate node, where the temporary intermediate node includes a temporary state identifier, and the temporary intermediate node is used to save synchronization data for which data synchronization has not been completed.
  28. 根据权利要求18至27中任一项所述的第一设备,其特征在于,The first device according to any one of claims 18 to 27, characterized in that,
    在所述第一数据同步时,所述收发单元还用于接收所述第二设备发送的第一哈希值,所述第一哈希值是所述第二设备根据所述第一媒体资产变更内容进行的哈希运算得到的,所述第一同步消息包括所述第一哈希值;When the first data is synchronized, the transceiver unit is further configured to receive a first hash value sent by the second device, where the first hash value is the second device according to the first media asset The first synchronization message includes the first hash value obtained from the hash operation performed on the changed content;
    所述处理单元还用于根据所述第一更改列表内容进行哈希计算,得到第二哈希值;The processing unit is further configured to perform hash calculation according to the content of the first change list to obtain a second hash value;
    当所述处理单元判断所述第一哈希值与所述第二哈希值相等时,所述处理单元确定所述本次数据同步成功。When the processing unit determines that the first hash value is equal to the second hash value, the processing unit determines that the current data synchronization is successful.
  29. 一种设备,所述设备为第二设备,其特征在于,包括:A device, the device is a second device, characterized in that it includes:
    收发单元,用于接收第一设备发送的第一查询请求,所述第一查询请求用于查询所述第二设备上是否有媒体资产变更;a transceiver unit, configured to receive a first query request sent by a first device, where the first query request is used to query whether there is a media asset change on the second device;
    处理单元,用于根据所述第一查询请求,确定有第一媒体资产变更,向所述第一设备发送第一同步消息,所述第一同步消息携带有所述第二设备的第一媒体资产变更内容,所 述第一媒体资产变更内容包括发生变更的第一媒体资产和所述第一媒体资产变更对应的动作。a processing unit, configured to determine, according to the first query request, that there is a first media asset change, and send a first synchronization message to the first device, where the first synchronization message carries the first media of the second device Asset change content, where the first media asset change content includes the changed first media asset and an action corresponding to the first media asset change.
  30. 根据权利要求29所述的第二设备,其特征在于,The second device of claim 29, wherein:
    所述第二设备上的所述第一媒体资产发生变更,所述处理单元还用于新增第一更改列表;The first media asset on the second device is changed, and the processing unit is further configured to add a first change list;
    所述收发单元还用于:The transceiver unit is also used for:
    向所述第一设备发送第三查询请求,所述第三查询请求用于查询所述第一设备上是否有媒体资产变更;sending a third query request to the first device, where the third query request is used to query whether there is a media asset change on the first device;
    接收所述第一设备发送的第一反馈消息,所述第一反馈消息是所述第一设备在接收到所述第三查询请求,并判断所述第一设备上没有媒体资产变更后向所述第二设备发送的,所述第一反馈消息用于标识所述第一设备上没有发生媒体资产变更;Receive a first feedback message sent by the first device, where the first feedback message is sent to the sent by the second device, the first feedback message is used to identify that no media asset change has occurred on the first device;
    所述处理单元还用于:The processing unit is also used to:
    根据所述第一反馈消息和所述第一同步消息,生成第一同步记录,其中,所述第一同步记录包括第一同步节点、所述第一更改列表和第一设备列表,所述第一同步节点用于记录第一数据同步的信息,所述第一更改列表用于记录所述第一数据同步中发生变更的媒体资产和所述媒体资产变更对应的动作,所述第一设备列表用于记录所述第一数据同步的设备。A first synchronization record is generated according to the first feedback message and the first synchronization message, wherein the first synchronization record includes a first synchronization node, the first change list and a first device list, the first synchronization record A synchronization node is used to record the information of the first data synchronization, the first change list is used to record the media assets changed in the first data synchronization and the actions corresponding to the changes of the media assets, the first device list A device for recording the first data synchronization.
  31. 根据权利要求30所述的第二设备,其特征在于,The second device of claim 30, wherein:
    所述第一同步节点包括:第一同步节点标识、第一同步时间戳、第一父同步节点标识、第一同步变更内容和第一同步设备中的一个或多个,其中所述第一同步节点ID用于标识所述第一数据同步;The first synchronization node includes one or more of a first synchronization node identifier, a first synchronization timestamp, a first parent synchronization node identifier, a first synchronization change content, and a first synchronization device, wherein the first synchronization The node ID is used to identify the first data synchronization;
    所述第一更改列表包括:第一更改列表ID和所述第二设备的所述媒体资产变更内容;The first change list includes: a first change list ID and the content of the media asset change of the second device;
    所述第一设备列表包括:第一设备列表ID和所述第一设备的设备ID。The first device list includes: a first device list ID and a device ID of the first device.
  32. 根据权利要求31所述的第二设备,其特征在于,所述第一同步变更内容包括第二设备的媒体资产变更内容,所述第一同步设备包括所述第一设备的设备ID;或者,The second device according to claim 31, wherein the first synchronization change content includes media asset change content of the second device, and the first synchronization device includes a device ID of the first device; or,
    所述第一同步变更内容中包括第一更改列表的索引,所述第一同步设备中包括第一设备列表的索引,所述更改列表的索引用于查找所述第一更改列表,所述设备列表的索引用于查找所述第一设备列表;或者,The first synchronization change content includes an index of a first change list, the first synchronization device includes an index of a first device list, and the index of the change list is used to find the first change list, the device The index of the list is used to look up the first device list; or,
    所述第一同步变更内容中包括所述第二设备的媒体资产变更内容的索引,所述第一同步设备中包括与第一设备相关的索引,所述第二设备的媒体资产变更内容的索引用于查找所述第一设备的媒体资产变更内容,所述与第一设备相关的索引用于查找与所述第一设备相关的信息。The first synchronization change content includes an index of the second device's media asset change content, the first synchronization device includes an index related to the first device, and the second device's media asset change content index The index related to the first device is used to search for the content of the media asset modification of the first device, and the index related to the first device is used to search the information related to the first device.
  33. 根据权利要求30至32中任一项所述的第二设备,其特征在于,所述处理单元具体用于:The second device according to any one of claims 30 to 32, wherein the processing unit is specifically configured to:
    根据所述第一查询请求和第二设备上的同步记录,判断有第一媒体资产变更;或者,According to the first query request and the synchronization record on the second device, it is determined that the first media asset has changed; or,
    根据所述第一查询请求和第二设备上的更改列表,判断有第一媒体资产变更。According to the first query request and the change list on the second device, it is determined that the first media asset is changed.
  34. 根据权利要求30至32中任一项所述的第二设备,其特征在于,The second device according to any one of claims 30 to 32, wherein,
    所述第一同步消息包括第一哈希值,所述第一哈希值是所述处理单元根据所述第一媒体资产变更内容进行哈希运算得到的。The first synchronization message includes a first hash value, and the first hash value is obtained by the processing unit performing a hash operation according to the content of the first media asset change.
  35. 一种数据同步的分布式系统,其特征在于,所述分布式系统包括如权利要求18至28中任一项所述的第一设备和如权利要求29至34中任一项所述的第二设备。A distributed system for data synchronization, characterized in that the distributed system includes the first device according to any one of claims 18 to 28 and the first device according to any one of claims 29 to 34 Second equipment.
  36. 一种通信装置,包括处理器,所述处理器与存储器相连,所述存储器用于存储计算机程序,所述处理器用于执行所述存储器中存储的计算机程序,以使得所述装置执行如权利要求1至11中任一项所述的方法,或者12至17中任一项所述的方法。A communication device comprising a processor connected to a memory for storing a computer program, the processor for executing the computer program stored in the memory to cause the device to perform as claimed in the claims The method of any one of 1 to 11, or the method of any one of 12 to 17.
  37. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,当所述计算机程序被运行时,实现如权利要求1至11中任一项所述的方法,或者12至17中任一项所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, when the computer program is executed, the method according to any one of claims 1 to 11 is implemented, or The method of any one of 12 to 17.
  38. 一种芯片,其特征在于,包括处理器和接口;A chip, characterized in that it includes a processor and an interface;
    所述处理器用于读取指令以执行权利要求1至11中任一项所述的方法,或者12至17中任一项所述的方法。The processor is adapted to read instructions to perform the method of any one of claims 1 to 11, or the method of any one of 12 to 17.
PCT/CN2021/108814 2020-07-31 2021-07-28 Data synchronization method and device for mobile distributed system WO2022022546A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010763598.5A CN114095511B (en) 2020-07-31 2020-07-31 Method and equipment for data synchronization of mobile distributed system
CN202010763598.5 2020-07-31

Publications (1)

Publication Number Publication Date
WO2022022546A1 true WO2022022546A1 (en) 2022-02-03

Family

ID=80037174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/108814 WO2022022546A1 (en) 2020-07-31 2021-07-28 Data synchronization method and device for mobile distributed system

Country Status (2)

Country Link
CN (1) CN114095511B (en)
WO (1) WO2022022546A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640687A (en) * 2022-03-15 2022-06-17 北京中交兴路信息科技有限公司 Software upgrading method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102460436A (en) * 2009-06-17 2012-05-16 微软公司 Synchronized distributed media assets
CN109299047A (en) * 2018-09-21 2019-02-01 深圳市九洲电器有限公司 Distributed system data sharing method and device, data sharing distributed system
KR20190133132A (en) * 2016-06-20 2019-12-02 한국전자통신연구원 Method and network entity for controlling media delivery
CN110535907A (en) * 2019-07-26 2019-12-03 济南浪潮数据技术有限公司 A kind of metadata synchronization method and system
CN110875955A (en) * 2018-08-31 2020-03-10 苹果公司 Device management in ad hoc presence networks

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100694161B1 (en) * 2006-02-10 2007-03-12 삼성전자주식회사 Method of managing distributed contents and apparatus therefor
CN103491055B (en) * 2012-06-12 2018-08-07 南京中兴软件有限责任公司 A kind of method of the synchronizing information between multiple client, client and server
CN103916423A (en) * 2012-12-31 2014-07-09 华为技术有限公司 Data synchronization method and device
CN104052768A (en) * 2013-03-13 2014-09-17 彭涛 Distributed multi-point synchronization system and synchronization method thereof
CN107104816A (en) * 2017-03-07 2017-08-29 阿里巴巴集团控股有限公司 A kind of information change monitoring method and device
US11126698B2 (en) * 2018-10-26 2021-09-21 Microsoft Technology Licensing, Llc Distributed ledger system that facilitates device management

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102460436A (en) * 2009-06-17 2012-05-16 微软公司 Synchronized distributed media assets
KR20190133132A (en) * 2016-06-20 2019-12-02 한국전자통신연구원 Method and network entity for controlling media delivery
CN110875955A (en) * 2018-08-31 2020-03-10 苹果公司 Device management in ad hoc presence networks
CN109299047A (en) * 2018-09-21 2019-02-01 深圳市九洲电器有限公司 Distributed system data sharing method and device, data sharing distributed system
CN110535907A (en) * 2019-07-26 2019-12-03 济南浪潮数据技术有限公司 A kind of metadata synchronization method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640687A (en) * 2022-03-15 2022-06-17 北京中交兴路信息科技有限公司 Software upgrading method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN114095511A (en) 2022-02-25
CN114095511B (en) 2023-03-10

Similar Documents

Publication Publication Date Title
US10893048B2 (en) Multi-blockchain network data processing
US20210350070A1 (en) Distributed Document Co-Authoring and Processing
EP3433764B1 (en) Attribute-based dependency identification for operation ordering
US7680835B2 (en) Online storage with metadata-based retrieval
KR102128139B1 (en) File management with placeholders
US20190087439A1 (en) Data replication from a cloud-based storage resource
US9870374B2 (en) Replicating data across data centers
US20140067772A1 (en) Methods, apparatuses and computer program products for achieving eventual consistency between a key value store and a text index
EP2854048B1 (en) Method of operating a mobile telecommunications device
US20140372369A1 (en) Managing Changes to Shared Electronic Documents Using Change History
US20220245143A1 (en) Data Synchronization Method and Device
CN104937904A (en) Copy offload for disparate offload providers
WO2022022546A1 (en) Data synchronization method and device for mobile distributed system
CN113656490A (en) Data synchronization method, device, terminal and storage medium
US11507541B2 (en) Method to model server-client sync conflicts using version trees
CN114928620B (en) User information synchronization method, apparatus, device, storage medium, and program product
US11144529B2 (en) Consistent data replication in an event-driven architecture
CN104753969A (en) Method and device for synchronizing clipboard content information
CN112486991B (en) Database report processing method and device and electronic equipment
US20230115149A1 (en) System, devices and/or processes for updating call graphs
US20230350902A1 (en) Tag management for distributed applications
CN117708072A (en) File copying method, terminal equipment and chip system
US20240028593A1 (en) In-memory graph query engine with persisted storage
US20210141771A1 (en) Method of managing files by mobile device and mobile device for implementing the same
CN114185977A (en) Commodity list access method and device, equipment, medium and product thereof

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21851436

Country of ref document: EP

Kind code of ref document: A1