CN111245548A - Data synchronization method and device based on timestamp and computer equipment - Google Patents
Data synchronization method and device based on timestamp and computer equipment Download PDFInfo
- Publication number
- CN111245548A CN111245548A CN202010037879.2A CN202010037879A CN111245548A CN 111245548 A CN111245548 A CN 111245548A CN 202010037879 A CN202010037879 A CN 202010037879A CN 111245548 A CN111245548 A CN 111245548A
- Authority
- CN
- China
- Prior art keywords
- timestamp
- terminal
- target timestamp
- address book
- book data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 230000001360 synchronised effect Effects 0.000 claims abstract description 34
- 238000012545 processing Methods 0.000 claims abstract description 4
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012795 verification Methods 0.000 claims description 12
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
- H04J3/0658—Clock or time synchronisation among packet nodes
- H04J3/0661—Clock or time synchronisation among packet nodes using timestamps
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/45—Network directories; Name-to-address mapping
- H04L61/4552—Lookup mechanisms between a plurality of directories; Synchronisation of directories, e.g. metadirectories
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to data processing, and provides a data synchronization method and device based on a timestamp, a computer device and a storage medium. The method comprises the following steps: receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier; returning the first target timestamp to the terminal so that the terminal can acquire a local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp; receiving a data synchronization request sent by a terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp; and searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp. By adopting the method, the efficiency of data synchronization can be improved.
Description
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method and an apparatus for data synchronization based on timestamps, a computer device, and a storage medium.
Background
With the development of internet technology, in the client of the enterprise communication tool, information of each enterprise member, such as a name, an email address, a telephone number, and the like, needs to be displayed so that the enterprise member can conveniently query communication information, which requires the server to synchronize address book data to the client of each enterprise member. At present, data synchronization technology generally performs data synchronization according to a primary key corresponding to data, however, data synchronization performed through the primary key is inefficient.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device and a storage medium for data synchronization based on timestamps, which can improve the efficiency of data synchronization.
A method of timestamp-based data synchronization, the method comprising:
receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier;
returning the first target timestamp to the terminal so that the terminal can acquire a local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp;
receiving a data synchronization request sent by a terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp;
and searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp.
In one embodiment, before receiving the login request sent by the terminal, the method further includes:
receiving a primary login request sent by a terminal, wherein the primary login request carries user information;
when the user information passes the verification, acquiring equipment information in the user information according to the initial login request, generating an equipment identifier according to the equipment information, and returning the equipment identifier to the terminal;
receiving a full-scale synchronization request sent by a terminal, acquiring address book data according to the full-scale synchronization request, and returning the address book data to the terminal;
and acquiring an initial target timestamp in the address book data, and storing the equipment identifier and the initial target timestamp in a cache database.
In one embodiment, obtaining an initial target timestamp in address book data, and storing a device identifier and a first initial target timestamp in a cache database includes:
generating an initial hash value of address book data, and storing the equipment identifier, the initial hash value and a second target timestamp into a cache database;
finding a corresponding first target timestamp according to the device identifier, including:
and searching for the corresponding first target timestamp and the first hash value according to the equipment identifier.
In one embodiment, after finding the corresponding first target timestamp and first hash value according to the device identifier, the method further includes:
and returning the first target timestamp and the first hash value to the terminal so that the terminal can acquire the local target timestamp and the local hash value of the local address book data and compare the local target timestamp with the first target timestamp and the local hash value with the first hash value.
In one embodiment, the method further comprises:
receiving an address book data updating instruction sent by a management terminal, wherein the address book data updating instruction carries a management identifier, and when the management identifier passes verification, acquiring newly added address book data according to the address book data updating instruction to obtain updated address book data;
generating an update target timestamp corresponding to the updated address book data, and writing the update target timestamp into a cache database;
and determining an updated main key identifier from the newly added address book data, and writing the updated main key identifier into a preset synchronous index table.
An apparatus for timestamp-based data synchronization, the apparatus comprising:
the timestamp searching module is used for receiving a login request sent by the terminal, carrying an equipment identifier, and searching a corresponding first target timestamp according to the equipment identifier;
the timestamp returning module is used for returning the first target timestamp to the terminal so that the terminal can obtain a local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp;
the incremental timestamp determining module is used for receiving a data synchronization request sent by the terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and the incremental timestamp is determined according to the local target timestamp and the first target timestamp;
and the data synchronization module is used for searching the corresponding main key identification and the address list identification in a preset synchronization index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp.
In one embodiment, the apparatus further comprises, further comprising:
the request receiving module is used for receiving a primary login request sent by the terminal, wherein the primary login request carries user information;
the identification generation module is used for acquiring the equipment information in the user information according to the initial login request when the user information passes the verification, generating an equipment identification according to the equipment information and returning the equipment identification to the terminal;
the identification association module is used for receiving a full-scale synchronization request sent by the terminal, acquiring address book data according to the full-scale synchronization request and returning the address book data to the terminal;
and the storage module is used for acquiring the initial target time stamp in the address book data and storing the equipment identifier and the initial target time stamp into the cache database.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier;
returning the first target timestamp to the terminal so that the terminal can acquire a local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp;
receiving a data synchronization request sent by a terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp;
and searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier;
returning the first target timestamp to the terminal so that the terminal can acquire a local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp;
receiving a data synchronization request sent by a terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp;
and searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp.
According to the data synchronization method and device based on the timestamps, the computer equipment and the storage medium, the corresponding first target timestamp is searched according to the equipment identification, the first target timestamp is returned to the terminal, the terminal is enabled to compare the local target timestamp with the first target timestamp, when the comparison result is inconsistent, the terminal calls the interface to send a data synchronization request to the server, the server receives the synchronization request sent by the terminal, the incremental timestamp is determined according to the local target timestamp and the first target timestamp, and the incremental address book data which is corresponding to the terminal and needs to be synchronized is searched from the preset synchronization index table according to the incremental timestamp. And then, sequentially returning the corresponding address book data to the terminal according to the time sequence of the incremental timestamps. Whether the terminal needs data synchronization is determined by using the target timestamp, the number of times that the terminal calls the synchronous interface can be reduced to the greatest extent, corresponding address book data are sequentially returned to the terminal according to the time sequence of the timestamp, the speed of inquiring the address book data by the server is increased, and the efficiency of synchronizing the address book data is improved.
Drawings
FIG. 1 is a diagram of an application scenario of a timestamp-based data synchronization method in one embodiment;
FIG. 2 is a schematic flow diagram that illustrates a method for timestamp-based data synchronization in one embodiment;
FIG. 3 is a flow diagram illustrating full-scale synchronization in one embodiment;
FIG. 4 is a flow diagram illustrating an embodiment of updating address book data;
FIG. 5 is a schematic flow chart of time stamp based data synchronization in one embodiment;
FIG. 6 is a block diagram of an apparatus for timestamp based data synchronization in one embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data synchronization method based on the time stamp can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The server 104 receives a login request sent by the terminal 102, the login request carries an equipment identifier, and a corresponding first target timestamp is searched according to the equipment identifier; the server 104 returns the first target timestamp to the terminal, so that the terminal 102 acquires a local target timestamp of the local address book data and compares the local target timestamp with the first target timestamp; the server 104 receives a data synchronization request sent by the terminal 102 according to the comparison result, the data synchronization request carries a local target timestamp, and an increment timestamp is determined according to the local target timestamp and the first target timestamp; and searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a method for synchronizing data based on time stamp is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
s202, receiving a login request sent by the terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier.
The device identification is used for uniquely identifying the terminal device of the user, the first target timestamp is a maximum timestamp corresponding to the address book data to be synchronized, and the maximum timestamp is a timestamp generated according to the time of writing the last data in the address book data into the address book database. A time stamp is a complete, verifiable piece of data, usually a sequence of characters, that represents a piece of data that existed before a particular time, uniquely identifying the time of the moment.
Specifically, the server receives a login request sent by the terminal, analyzes the login request to obtain an equipment identifier, and searches the maximum timestamp of the address book data to be synchronized in the cache database according to the equipment identifier.
And S204, returning the first target timestamp to the terminal so that the terminal can acquire the local target timestamp of the local address book data and compare the local target timestamp with the first target timestamp.
The local target timestamp refers to a local maximum timestamp of address book data stored in the terminal, and the local maximum timestamp is a timestamp generated according to the time when the last address book data in the terminal local address book data is acquired.
Specifically, the server returns the first target timestamp to the terminal. And when the terminal receives the first target timestamp, acquiring a local target timestamp of the local address book data. And the terminal compares the local target timestamp with the first target timestamp, and when the local target timestamp is consistent with the first target timestamp, the local address book data is consistent with the address book data in the server, and synchronization is not needed. When the local target timestamp is inconsistent with the first target timestamp, it is indicated that the local address book data is inconsistent with the address book data in the server and needs to be synchronized. At this time, the terminal calls the server interface to receive the request for initiating data synchronization.
And S206, receiving a data synchronization request sent by the terminal according to the comparison result, wherein the data synchronization request carries a local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp.
The comparison result refers to an inconsistent result of the local target timestamp and the first target timestamp. The incremental timestamp refers to a timestamp corresponding to address book data which needs to be synchronized in the terminal in the server.
Specifically, the server receives a data synchronization request sent by the terminal according to the inconsistent result of the local target timestamp and the first target timestamp, and analyzes the data synchronization request to obtain the local target timestamp of the terminal. And calculating to obtain each increment timestamp by using the local target timestamp and the first target timestamp according to each corresponding timestamp in the server address book data.
And S208, searching corresponding main key identification and address list identification in a preset synchronous index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and returning the incremental address list data to the terminal in sequence according to the incremental timestamp.
The address book identification is used for identifying address book data, and each piece of address book data has a global unique identification, namely the address book identification. The primary key identification is used for identifying a primary key in the address book data corresponding to the address book identification. The preset synchronous index table is a data table used for recording updated address book identification and main key identification when the server updates the address book data, and the data table is preset.
Specifically, the server searches for corresponding main key identifiers and address list identifiers in a preset synchronous index table according to the incremental timestamps, acquires corresponding incremental address list data according to the main key identifiers and the address list identifiers, and returns the incremental address list data to the terminal in sequence according to the incremental timestamps.
In the data synchronization method, the corresponding first target timestamp is searched according to the equipment identifier, the first target timestamp is returned to the terminal, the terminal compares the local target timestamp with the first target timestamp, when the comparison result is inconsistent, the terminal calls the interface to send a data synchronization request to the server, the server receives the synchronization request sent by the terminal, the increment timestamp is determined according to the local target timestamp and the first target timestamp, and the increment address book data which corresponds to the terminal and needs to be synchronized is searched from the preset synchronization index table according to the increment timestamp. Then return the address book data that correspond to the terminal in proper order according to the time sequence of increment timestamp, can reduce the number of times that synchronous interface was called to the furthest terminal, and return the address book data that correspond to the time sequence of timestamp to the terminal in proper order, the inquiry of server is accelerated to address book data speed, thereby the efficiency of synchronous address book data has been promoted, and regard as synchronous sign through the timestamp, because the timestamp can increase progressively and the repetition rate is extremely low always, for synchronous based on the primary key sign, the complexity is lower, it is more reliable.
In one embodiment, as shown in fig. 3, before step S202, before receiving the login request sent by the terminal, the method further includes:
s302, receiving an initial login request sent by a terminal, wherein the initial login request carries user information.
The user information is used for indicating the identity of the user, and may include at least one of a user name, device information of user login, a user fingerprint, a user face, and a user mobile phone number.
Specifically, the server receives an initial login request sent by the terminal, and analyzes the initial login request to obtain user information in the initial login request.
S304, when the user information passes the verification, the equipment information in the user information is obtained according to the initial login request, the equipment identification is generated according to the equipment information, and the equipment identification is returned to the terminal.
Specifically, the server verifies the user information, the server can match the analyzed user information with the user information pre-stored by the server, and when the matching is successful, the verification is passed. For example, the server may collect the user fingerprint in advance and store the user fingerprint in the fingerprint database, when the user fingerprint in the user information is verified, match the user fingerprint in the fingerprint database, and when the matching is successful, the user fingerprint is verified to pass.
And when the user information passes the verification, the server acquires the equipment information in the user information according to the initial login request, generates an equipment identifier according to the equipment information, and returns the equipment identifier to the terminal. And when the user information fails to be verified, returning a prompt of the user information verification failure to the terminal.
And S306, receiving the full-quantity synchronization request sent by the terminal, acquiring the address book data according to the full-quantity synchronization request, and returning the address book data to the terminal.
Specifically, when the terminal receives the device identifier, the device identifier is stored in the cache, at this time, the user successfully logs in, the terminal requests the server for full synchronization, address book data is obtained according to the full synchronization request, and the obtained address book data is synchronized into the terminal. The terminal receives and stores the address book data sent by the server, and can display the address book data.
And S308, acquiring an initial target time stamp in the address book data, and storing the equipment identifier and the initial target time stamp in a cache database.
The initial target timestamp refers to a maximum timestamp corresponding to address book data to which a user is synchronized for the first time.
Specifically, when the server completes full-scale address book data synchronization, an initial target timestamp in the address book data is obtained, and the device identifier and the initial target timestamp are stored in a cache database.
In the embodiment, when the server logs in for the first time by the user, the full address book data is synchronized to the user terminal, and then the initial target timestamp and the equipment identifier of the synchronized address book data are stored, so that the user can conveniently synchronize new address book data subsequently, and the efficiency is improved.
In one embodiment, the step S308 of obtaining the initial target timestamp in the address book data, and storing the device identifier and the first initial target timestamp in the cache database includes the steps of:
and generating an initial hash value of the address book data, and storing the equipment identifier, the initial hash value and the second target timestamp into a cache database.
The initial hash value refers to a hash value of address book data initially synchronized by a user.
Specifically, the server generates an initial hash value of the address book data, and stores the device identifier, the initial hash value, and the second target timestamp in the cache database, so that the user can guarantee the integrity of the data according to the hash value when subsequently synchronizing the address book data.
Step S202, namely, finding the corresponding first target timestamp according to the device identifier, includes the steps of:
and searching for the corresponding first target timestamp and the first hash value according to the equipment identifier.
The first hash value refers to a hash value of address book data which is completed by a user synchronously.
Specifically, the server finds the corresponding first target timestamp and the corresponding first hash value in the cache database according to the device identifier. The server generates a hash value of the synchronized address book data each time the terminal completes synchronization of the address book data, and writes the device identifier and the hash value into the cache database, i.e. updates the hash value corresponding to the device identifier stored in the cache database. Then, when the user logs in, the latest first target timestamp and the latest first hash value can be obtained from the cache database.
In the above embodiment, the hash value of the address book data is generated, and the hash value is also stored in the database, so that the user can directly find the first target timestamp and the first hash value corresponding to the device identifier when logging in, which is convenient and fast.
In one embodiment, after finding the corresponding first target timestamp and first hash value according to the device identifier, the method further includes:
and returning the first target timestamp and the first hash value to the terminal so that the terminal can acquire the local target timestamp and the local hash value of the local address book data and compare the local target timestamp with the first target timestamp and the local hash value with the first hash value.
Specifically, the server sends a first target timestamp and a first hash value to the terminal, the terminal receives the first target timestamp and the first hash value, the local target timestamp and the local hash value are determined from local address book data, the first target timestamp and the local target timestamp are compared, the first hash value and the local hash value are compared, when at least one of the comparison results is inconsistent, namely when the first target timestamp and the local target timestamp are inconsistent, or when the first hash value and the local hash value are inconsistent, the terminal calls a server data synchronization interface to send a data synchronization request to the server, and the server receives the data synchronization request to perform data synchronization.
In the above embodiment, the first target timestamp and the local target timestamp are compared, the first hash value and the local hash value are compared, and data synchronization is performed according to the comparison result, so that the accuracy of data synchronization can be improved.
In one embodiment, as shown in fig. 4, the method for synchronizing data based on time stamp further comprises the steps of:
s402, receiving an address book data updating instruction sent by the management terminal, wherein the address book data updating instruction carries a management identifier, and when the management identifier is verified to pass, acquiring newly added address book data according to the address book data updating instruction to obtain updated address book data.
The management identification is used for uniquely identifying the management user.
Specifically, the server receives an address book data updating instruction sent by the management terminal, analyzes the address book updating instruction to obtain a management identifier, verifies whether the management identifier has authority, acquires newly added address book data from the management terminal according to the address book data updating instruction when the management identifier passes the verification, and writes the newly added address book data into the address book database to obtain updated address book data.
And S404, generating an update target time stamp corresponding to the updated address book data, and writing the update target time stamp into a cache database.
Wherein, the update target timestamp refers to the maximum timestamp corresponding to the updated address book data,
Specifically, the server generates an update target timestamp corresponding to the updated address book data, and updates the timestamp corresponding to each device identifier in the cache database to the update target timestamp.
In one embodiment, the server calculates a hash value of the updated address book data, and writes the hash value and the update target timestamp into the cache database in an associated manner.
S406, determining an updated main key identifier from the newly added address book data, and writing the updated main key identifier into a preset synchronous index table.
And updating the primary key identification to identify the primary key corresponding to the newly added address book data.
Specifically, the server obtains the primary key identifiers corresponding to the address book data in the newly added address book data from the newly added address book data to obtain the updated primary key identifiers, and writes the updated primary key identifiers into the preset synchronous index table.
In the above embodiment, the management terminal may update the address book data stored in the server to obtain updated address book data, obtain an update target timestamp according to the updated address book data, write the update target timestamp into the cache database, determine to update the primary key identifier according to the newly added address book data, write the update primary key identifier into the preset synchronous index table, update the address book data, and facilitate the use of the user.
In a specific embodiment, the data synchronization method based on the time stamp is applied to government affairs application APP (mobile phone software). As shown in fig. 5, a schematic diagram of a synchronization process of an address book in a government affairs application APP is shown. Specifically, a user mobile phone logs in a government affair service client according to the government affair service client, a service segment acquires an equipment identifier when the user logs in, searches a maximum timestamp according to the equipment identifier, returns the searched maximum timestamp to the client, and judges whether a difference exists between the maximum timestamp and a maximum timestamp stored in a local database or not after the client receives the maximum timestamp. And when the difference exists, the client calls an incremental updating address book data interface, and the server synchronizes to the incremental address book data. And updating the local address book data according to the incremental address book data. And after the server returns the incremental address book data, asynchronously caching and updating the maximum timestamp of the client address book data. When there is no difference, no processing is performed.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a timestamp-based data synchronization apparatus 600, including: a timestamp lookup module 602, a timestamp return module 604, an incremental timestamp determination module 606, and a data synchronization module 608, wherein:
the timestamp searching module 602 is configured to receive a login request sent by a terminal, where the login request carries an equipment identifier, and search for a corresponding first target timestamp according to the equipment identifier;
a timestamp returning module 604, configured to return the first target timestamp to the terminal, so that the terminal obtains a local target timestamp of the local address book data, and compares the local target timestamp with the first target timestamp;
an incremental timestamp determining module 606, configured to receive a data synchronization request sent by the terminal according to the comparison result, where the data synchronization request carries a local target timestamp, and determine an incremental timestamp according to the local target timestamp and the first target timestamp;
and the data synchronization module 608 is configured to search the corresponding primary key identifier and address list identifier in the preset synchronization index table according to the incremental timestamp, obtain corresponding incremental address list data according to the primary key identifier and the address list identifier, and sequentially return the incremental address list data to the terminal according to the incremental timestamp.
In one embodiment, the timestamp-based data synchronization apparatus 600 further includes:
the request receiving module is used for receiving a primary login request sent by the terminal, wherein the primary login request carries user information;
the identification generation module is used for acquiring the equipment information in the user information according to the initial login request when the user information passes the verification, generating an equipment identification according to the equipment information and returning the equipment identification to the terminal;
the system comprises a full synchronization module, a terminal and a data processing module, wherein the full synchronization module is used for receiving a full synchronization request sent by the terminal, acquiring address book data according to the full synchronization request and returning the address book data to the terminal;
and the storage module is used for acquiring the initial target time stamp in the address book data and storing the equipment identifier and the initial target time stamp into the cache database.
In one embodiment, the storage module is further configured to generate an initial hash value of the address book data, and store the device identifier, the initial hash value, and the second target timestamp in the cache database; the timestamp lookup module 602 is further configured to lookup the corresponding first target timestamp and the first hash value according to the device identifier.
In one embodiment, the timestamp returning module 604 is further configured to return the first target timestamp and the first hash value to the terminal, so that the terminal obtains the local target timestamp and the local hash value of the local address book data and compares the local target timestamp and the first target timestamp, the local hash value, and the first hash value.
In one embodiment, the timestamp-based data synchronization apparatus 600 further includes:
the updating module is used for receiving an address book data updating instruction sent by the management terminal, wherein the address book data updating instruction carries a management identifier, and when the management identifier passes verification, newly-added address book data are obtained according to the address book data updating instruction to obtain updated address book data;
the timestamp updating module is used for generating an updated target timestamp corresponding to the updated address book data and writing the updated target timestamp into the cache database;
and the identification writing module is used for determining the updated main key identification from the newly added address book data and writing the updated main key identification into the preset synchronous index table.
For specific limitations of the data synchronization apparatus based on the time stamp, reference may be made to the above limitations of the data synchronization method, which are not described herein again. The respective modules in the above-mentioned timestamp-based data synchronization apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing address book data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of time stamp based data synchronization.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of the timestamp based data synchronization method of any of the above embodiments when the processor executes the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the timestamp based data synchronization method according to any of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A method of timestamp-based data synchronization, the method comprising:
receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching for a corresponding first target timestamp according to the equipment identifier;
returning the first target timestamp to the terminal so that the terminal can acquire a local target timestamp of local address book data and compare the local target timestamp with the first target timestamp;
receiving a data synchronization request sent by the terminal according to a comparison result, wherein the data synchronization request carries the local target timestamp, and determining an increment timestamp according to the local target timestamp and the first target timestamp;
and searching corresponding main key identification and address list identification in a preset synchronous index table according to the increment timestamp, acquiring corresponding increment address list data according to the main key identification and the address list identification, and sequentially returning the increment address list data to the terminal according to the increment timestamp.
2. The method according to claim 1, further comprising, prior to receiving the login request sent by the terminal:
receiving a first login request sent by the terminal, wherein the first login request carries user information;
when the user information passes the verification, acquiring equipment information in the user information according to the initial login request, generating an equipment identifier according to the equipment information, and returning the equipment identifier to the terminal;
receiving a full-scale synchronization request sent by the terminal, acquiring address book data according to the full-scale synchronization request, and returning the address book data to the terminal;
and acquiring an initial target timestamp in the address book data, and storing the equipment identifier and the initial target timestamp in a cache database.
3. The method of claim 2, wherein storing the device identifier and the initial target timestamp in a cache database after the obtaining the initial target timestamp in the address book data comprises:
generating an initial hash value of the address book data, and storing the device identifier, the initial hash value and the second target timestamp in a cache database;
finding a corresponding first target timestamp according to the device identifier, including:
and searching a corresponding first target timestamp and a corresponding first hash value according to the equipment identifier.
4. The method of claim 3, further comprising, after said finding the corresponding first target timestamp and first hash value according to the device identification:
and returning the first target timestamp and the first hash value to the terminal, so that the terminal acquires a local target timestamp and a local hash value of local address book data, and compares the local target timestamp with the first target timestamp, and the local hash value with the first hash value.
5. The method of claim 1, further comprising:
receiving an address book data updating instruction sent by a management terminal, wherein the address book data updating instruction carries a management identifier, and when the management identifier is verified to pass, acquiring newly added address book data according to the address book data updating instruction to obtain updated address book data;
generating an update target timestamp corresponding to the updated address book data, and writing the update target timestamp into a cache database;
and determining an updated main key identifier from the newly added address book data, and writing the updated main key identifier into the preset synchronous index table.
6. An apparatus for time stamp based data synchronization, the apparatus comprising:
the time stamp searching module is used for receiving a login request sent by a terminal, wherein the login request carries an equipment identifier, and searching a corresponding first target time stamp according to the equipment identifier;
the timestamp returning module is used for returning the first target timestamp to the terminal so that the terminal can obtain a local target timestamp of local address book data and compare the local target timestamp with the first target timestamp;
an incremental timestamp determining module, configured to receive a data synchronization request sent by the terminal according to a comparison result, where the data synchronization request carries the local target timestamp, and determine an incremental timestamp according to the local target timestamp and the first target timestamp;
and the data synchronization module is used for searching corresponding main key identification and address list identification in a preset synchronization index table according to the incremental timestamp, acquiring corresponding incremental address list data according to the main key identification and the address list identification, and sequentially returning the incremental address list data to the terminal according to the incremental timestamp.
7. The apparatus of claim 6, further comprising:
the request receiving module is used for receiving a primary login request sent by the terminal, wherein the primary login request carries user information;
the identification generation module is used for acquiring the equipment information in the user information according to the initial login request when the user information passes the verification, generating an equipment identification according to the equipment information and returning the equipment identification to the terminal;
the system comprises a full synchronization module, a terminal and a data processing module, wherein the full synchronization module is used for receiving a full synchronization request sent by the terminal, acquiring address book data according to the full synchronization request and returning the address book data to the terminal;
and the storage module is used for acquiring an initial target timestamp in the address book data and storing the equipment identifier and the initial target timestamp in a cache database.
8. The apparatus of claim 7, wherein the storage module is further configured to generate an initial hash value of the address book data, and store the device identifier, the initial hash value, and the second target timestamp in a cache database;
the timestamp searching module is further configured to search for a corresponding first target timestamp and a corresponding first hash value according to the device identifier.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010037879.2A CN111245548B (en) | 2020-01-14 | 2020-01-14 | Data synchronization method and device based on time stamp and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010037879.2A CN111245548B (en) | 2020-01-14 | 2020-01-14 | Data synchronization method and device based on time stamp and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111245548A true CN111245548A (en) | 2020-06-05 |
CN111245548B CN111245548B (en) | 2024-08-20 |
Family
ID=70865054
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010037879.2A Active CN111245548B (en) | 2020-01-14 | 2020-01-14 | Data synchronization method and device based on time stamp and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111245548B (en) |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111680078A (en) * | 2020-06-19 | 2020-09-18 | 中国人民解放军国防科技大学 | Multi-screen data control method and system in aircraft flight simulation demonstration process |
CN112291207A (en) * | 2020-10-16 | 2021-01-29 | 武汉中科通达高新技术股份有限公司 | Method and device for acquiring front-end equipment catalog |
CN112434108A (en) * | 2020-11-10 | 2021-03-02 | 深圳市明源云科技有限公司 | Database synchronization method, device and equipment |
CN112486934A (en) * | 2020-08-21 | 2021-03-12 | 海信视像科技股份有限公司 | File synchronization method and display device |
CN112765275A (en) * | 2021-01-26 | 2021-05-07 | 成都佳发安泰教育科技股份有限公司 | Data synchronous exchange method, equipment and medium based on single time coordinate system |
CN113204574A (en) * | 2021-05-27 | 2021-08-03 | 北京深演智能科技股份有限公司 | Data processing method, data processing device, computer readable storage medium and processor |
CN113360509A (en) * | 2021-06-03 | 2021-09-07 | 广州小鹏智慧充电科技有限公司 | Collected music synchronization method and device |
CN113434509A (en) * | 2021-07-02 | 2021-09-24 | 挂号网(杭州)科技有限公司 | Updating method and device of incremental index, storage medium and electronic equipment |
CN113472469A (en) * | 2021-07-27 | 2021-10-01 | 厦门亿联网络技术股份有限公司 | Data synchronization method, device, equipment and storage medium |
CN113742426A (en) * | 2021-09-08 | 2021-12-03 | 深圳市云鼠科技开发有限公司 | Data synchronization method, device, equipment, server and storage medium |
CN113872994A (en) * | 2020-06-30 | 2021-12-31 | 腾讯科技(深圳)有限公司 | Organization architecture synchronization method, device, computer equipment and storage medium |
CN114157677A (en) * | 2021-12-14 | 2022-03-08 | 南京欧珀软件科技有限公司 | Data synchronization method and related product |
CN114567644A (en) * | 2022-02-21 | 2022-05-31 | 深圳希施玛数据科技有限公司 | Data synchronization method and device and electronic equipment |
CN115065642A (en) * | 2022-08-18 | 2022-09-16 | 深圳华锐分布式技术股份有限公司 | Code table request method, device, equipment and medium under bandwidth limitation |
CN116481560A (en) * | 2023-06-21 | 2023-07-25 | 天津所托瑞安汽车科技有限公司 | Vehicle driving mileage calculation method, device, terminal and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011205234A (en) * | 2010-03-24 | 2011-10-13 | Nec Corp | Time stamp giving system, time stamp giving method, time stamp giving program |
CN102510357A (en) * | 2011-09-26 | 2012-06-20 | 深圳中兴网信科技有限公司 | Synchronous method of enterprise organization structure address book and system thereof |
CN107040576A (en) * | 2016-12-08 | 2017-08-11 | 阿里巴巴集团控股有限公司 | Information-pushing method and device, communication system |
US20180241658A1 (en) * | 2015-10-22 | 2018-08-23 | Alibaba Group Holding Limited | Data transmission method and apparatus |
WO2018219178A1 (en) * | 2017-05-27 | 2018-12-06 | Oppo广东移动通信有限公司 | Data synchronization method and apparatus, server, and storage medium |
WO2019144761A1 (en) * | 2018-01-24 | 2019-08-01 | 中国银联股份有限公司 | Data synchronization method, distributed system and device |
-
2020
- 2020-01-14 CN CN202010037879.2A patent/CN111245548B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011205234A (en) * | 2010-03-24 | 2011-10-13 | Nec Corp | Time stamp giving system, time stamp giving method, time stamp giving program |
CN102510357A (en) * | 2011-09-26 | 2012-06-20 | 深圳中兴网信科技有限公司 | Synchronous method of enterprise organization structure address book and system thereof |
US20180241658A1 (en) * | 2015-10-22 | 2018-08-23 | Alibaba Group Holding Limited | Data transmission method and apparatus |
CN107040576A (en) * | 2016-12-08 | 2017-08-11 | 阿里巴巴集团控股有限公司 | Information-pushing method and device, communication system |
WO2018219178A1 (en) * | 2017-05-27 | 2018-12-06 | Oppo广东移动通信有限公司 | Data synchronization method and apparatus, server, and storage medium |
WO2019144761A1 (en) * | 2018-01-24 | 2019-08-01 | 中国银联股份有限公司 | Data synchronization method, distributed system and device |
Cited By (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111680078A (en) * | 2020-06-19 | 2020-09-18 | 中国人民解放军国防科技大学 | Multi-screen data control method and system in aircraft flight simulation demonstration process |
CN111680078B (en) * | 2020-06-19 | 2023-11-14 | 中国人民解放军国防科技大学 | Multi-screen data control method and system in flight simulation demonstration process of aircraft |
CN113872994A (en) * | 2020-06-30 | 2021-12-31 | 腾讯科技(深圳)有限公司 | Organization architecture synchronization method, device, computer equipment and storage medium |
CN112486934A (en) * | 2020-08-21 | 2021-03-12 | 海信视像科技股份有限公司 | File synchronization method and display device |
CN112291207A (en) * | 2020-10-16 | 2021-01-29 | 武汉中科通达高新技术股份有限公司 | Method and device for acquiring front-end equipment catalog |
CN112291207B (en) * | 2020-10-16 | 2022-11-25 | 武汉中科通达高新技术股份有限公司 | Method and device for acquiring front-end equipment catalog |
CN112434108A (en) * | 2020-11-10 | 2021-03-02 | 深圳市明源云科技有限公司 | Database synchronization method, device and equipment |
CN112765275A (en) * | 2021-01-26 | 2021-05-07 | 成都佳发安泰教育科技股份有限公司 | Data synchronous exchange method, equipment and medium based on single time coordinate system |
CN113204574A (en) * | 2021-05-27 | 2021-08-03 | 北京深演智能科技股份有限公司 | Data processing method, data processing device, computer readable storage medium and processor |
CN113204574B (en) * | 2021-05-27 | 2024-01-26 | 北京深演智能科技股份有限公司 | Data processing method, device, computer readable storage medium and processor |
CN113360509A (en) * | 2021-06-03 | 2021-09-07 | 广州小鹏智慧充电科技有限公司 | Collected music synchronization method and device |
CN113434509A (en) * | 2021-07-02 | 2021-09-24 | 挂号网(杭州)科技有限公司 | Updating method and device of incremental index, storage medium and electronic equipment |
CN113472469A (en) * | 2021-07-27 | 2021-10-01 | 厦门亿联网络技术股份有限公司 | Data synchronization method, device, equipment and storage medium |
CN113472469B (en) * | 2021-07-27 | 2023-12-05 | 厦门亿联网络技术股份有限公司 | Data synchronization method, device, equipment and storage medium |
CN113742426A (en) * | 2021-09-08 | 2021-12-03 | 深圳市云鼠科技开发有限公司 | Data synchronization method, device, equipment, server and storage medium |
CN114157677A (en) * | 2021-12-14 | 2022-03-08 | 南京欧珀软件科技有限公司 | Data synchronization method and related product |
CN114157677B (en) * | 2021-12-14 | 2023-11-28 | 南京欧珀软件科技有限公司 | Data synchronization method and related product |
CN114567644A (en) * | 2022-02-21 | 2022-05-31 | 深圳希施玛数据科技有限公司 | Data synchronization method and device and electronic equipment |
CN114567644B (en) * | 2022-02-21 | 2023-10-20 | 深圳希施玛数据科技有限公司 | Data synchronization method and device and electronic equipment |
CN115065642A (en) * | 2022-08-18 | 2022-09-16 | 深圳华锐分布式技术股份有限公司 | Code table request method, device, equipment and medium under bandwidth limitation |
CN116481560B (en) * | 2023-06-21 | 2023-10-03 | 天津所托瑞安汽车科技有限公司 | Vehicle driving mileage calculation method, device, terminal and storage medium |
CN116481560A (en) * | 2023-06-21 | 2023-07-25 | 天津所托瑞安汽车科技有限公司 | Vehicle driving mileage calculation method, device, terminal and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111245548B (en) | 2024-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111245548B (en) | Data synchronization method and device based on time stamp and computer equipment | |
CN110866198B (en) | Static resource caching method, system, device, computer equipment and storage medium | |
CN110750506A (en) | Data object identification generation method and device, computer equipment and storage medium | |
CN109586948A (en) | Update method, apparatus, computer equipment and the storage medium of system configuration data | |
CN110489421B (en) | Data storage method, apparatus, computer readable storage medium and computer device | |
CN111767297B (en) | Big data processing method, device, equipment and medium | |
CN111563365B (en) | Method and device for processing modification information of test standard worksheet and computer equipment | |
CN112000903B (en) | Data query method and device, computer equipment and storage medium | |
CN109101232B (en) | Method, device, computer equipment and storage medium for product development | |
CN110908778A (en) | Task deployment method, system and storage medium | |
WO2021169305A1 (en) | Voiceprint data processing method and apparatus, computer device, and storage medium | |
CN110795171B (en) | Service data processing method, device, computer equipment and storage medium | |
CN110659938A (en) | Method and device for determining promotion channel, computer equipment and storage medium | |
CN108512948B (en) | Address book updating method and device, computer equipment and storage medium | |
CN110737719A (en) | Data synchronization method, device, equipment and computer readable storage medium | |
CN110851477B (en) | Stream data processing method, stream data processing device, computer equipment and storage medium | |
CN109462661B (en) | Data synchronization method and device, computer equipment and storage medium | |
CN111209061A (en) | Method and device for filling in user information, computer equipment and storage medium | |
CN110597782B (en) | Database dynamic switching method and device, computer equipment and storage medium | |
CN112783866B (en) | Data reading method, device, computer equipment and storage medium | |
CN108389124B (en) | Data processing method, data processing device, computer equipment and storage medium | |
CN111427950B (en) | Data transmitting and receiving method, and corresponding device, equipment and storage medium | |
CN109542872B (en) | Data reading method and device, computer equipment and storage medium | |
CN113742681B (en) | Account management method and device, computer equipment and storage medium | |
CN114138785A (en) | Data retrieval method, device, equipment and storage medium suitable for large data volume |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |