Data synchronization method and security gateway device

By adopting a paging request mechanism in the security gateway device, the Internet behavior data of the LDAP server is obtained by batches, the problem of inefficient synchronization caused by large amounts of data is solved, and more efficient data synchronization is achieved.

CN119520539APending Publication Date: 2025-02-25WUHAN SIPU TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411450816.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Due to the excessive number of users and the huge amount of Internet behavior data, the search speed of security gateway devices is slow when performing full searches, resulting in inefficient synchronization of Internet behavior data.

Method used

By generating a first search request, a request is sent to the server to obtain the first paging result, including the target user data and the search flag bit. When the search flag bit is the first flag, a search request is sent again to obtain the second paging result until the flag bit becomes the second flag, the data is synchronized to the local database.

Benefits of technology

Obtain target user data in batches through paging, avoiding inefficiency caused by requesting all data at one time, and improving the efficiency of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520539A_ABST
    Figure CN119520539A_ABST
Patent Text Reader

Abstract

The invention provides a data synchronization method and security gateway equipment, and the method comprises the steps: transmitting a first search request to a server, and obtaining a first paging result fed back by the server in response to the first search request; and when the search flag bit of the first paging result is a first flag, sending the first search request to the server again according to the first flag to obtain a second paging result. And when the search flag bit is the second flag, synchronizing the target user data to the local database. According to the method, when the target user data is requested from the server, the target user data is acquired in batches in a paging manner, and when the residual target user data exists, the target user data is requested from the server again, so that the problem of low data request efficiency caused by requesting all the target user data at one time is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer security technology, and in particular to a data synchronization method and a security gateway device. Background Art

[0002] LDAP servers can obtain user online behavior data and store it in the LDAP server's directory. LDAP (Lightweight Directory Access Protocol) is a network protocol used to access and operate directory services. LDAP allows client applications to access and retrieve directory information in a standardized manner.

[0003] To facilitate the management of user online behavior data, security gateways can use the LDAP protocol to search for pre-defined online behavior data from an LDAP server. However, due to the large number of users, the amount of online behavior data generated by each user is also enormous. This large amount of online behavior data can slow down the security gateway's search speed when performing a full search, resulting in inefficient online behavior data synchronization. Summary of the Invention

[0004] In order to solve the problem of low efficiency caused by excessive data when a security gateway device synchronizes user's online behavior data, the present application provides a data synchronization method, the method comprising:

[0005] generating a first search request, where the first search request is used to request target user data;

[0006] Sending the first search request to the server to obtain first paged results fed back by the server, where the first paged results include target user data and a search flag, where the search flag is a first flag or a second flag, where the first flag is used to indicate that the server has not sent all target user data, and the second flag is used to indicate that the server has sent all target user data;

[0007] When the search flag is the first flag, the first search request is sent to the server again according to the first flag to obtain a second page result fed back by the server, where the second page result includes other target user data in addition to the target user data in the first page result;

[0008] When the search flag is the second flag, the target user data is synchronized to the local database

[0009] In some embodiments, the step of sending the first search request to the server again, the method further comprises:

[0010] In the process of obtaining the second page result fed back by the server, synchronizing the target user data in the first page result to the local database;

[0011] After synchronization of the target user data in the first page result is completed, the target user data in the second page result is synchronized to the local database.

[0012] In some embodiments, the step of generating the first search request includes:

[0013] Setting a first search rule and a paging data quantity, wherein the first search rule is a search rule for the target user data, and the paging data quantity is used to indicate the quantity of the target user data included in the paging results;

[0014] The first search request is generated according to the first search rule and the amount of paging data.

[0015] In some embodiments, the step of synchronizing the target user data to the local database includes:

[0016] creating a first data group and a second data group in the local database according to a preset condition;

[0017] Detecting a data type of the target user data, where the data type includes individual user data and non-individual user data;

[0018] If the target user data is individual user data, synchronizing the target user data to the first data group;

[0019] If the target user data is non-individual user data, the target user data is synchronized to the second data group.

[0020] In some embodiments, after the step of sending the first search request to the server, the method further includes:

[0021] Setting a limit on the number of times the first search request is sent;

[0022] When the number of times the first search request is sent is greater than or equal to the limit number, adding a limit mark to the first search request to obtain a first limit request;

[0023] Sending the first restriction request to the server to obtain a paging termination result fed back by the server;

[0024] The target user data of the terminated paging results and the target user data acquired before the terminated paging results are synchronized to the local database respectively.

[0025] In some embodiments, after the step of sending the first search request to the server, the method further includes:

[0026] Recording the search duration of the server;

[0027] When the search duration is greater than or equal to a preset duration threshold, if the first paging result is not received, a timeout request is generated;

[0028] A timeout request is sent to the server to obtain a timeout search result fed back by the server, where the timeout search result is a search result generated by the server in response to the timeout request and based on the target user data currently being searched.

[0029] In some embodiments, the first search request is sent to a server, and the method further includes:

[0030] Sending a connection request to the server to establish a communication channel between the security gateway device and the server;

[0031] Through the communication channel, communicating and binding with the server according to the user name and the password information corresponding to the user name;

[0032] After the server is communicatively bound, the first search request is sent to the server.

[0033] In some embodiments, after the step of synchronizing the target user data to the local database, the method further includes:

[0034] Delete the first page results and the second page results;

[0035] After deleting the first page result and the second page result, the binding state between the security gateway device and the server is released.

[0036] In some embodiments, if the first page result does not include the target user data, the method further includes:

[0037] Prompt information is generated according to the first search rule, where the prompt information is used to indicate that the target user data is not synchronized to the local database.

[0038] In a second aspect, the present application provides a security gateway device, wherein the security gateway device includes a data synchronization module, and the data synchronization module is configured to:

[0039] generating a first search request, where the first search request is used to request target user data;

[0040] Sending the first search request to the server to obtain first paged results fed back by the server, where the first paged results include target user data and a search flag, where the search flag is a first flag or a second flag, where the first flag is used to indicate that the server has not requested all target user data, and the second flag is used to indicate that the server has requested all target user data;

[0041] When the search flag is the first flag, the first search request is sent to the server again according to the first flag to obtain a second page result fed back by the server, where the second page result includes other target user data in addition to the target user data in the first page result;

[0042] When the search flag is the second flag, the target user data is synchronized to the local database.

[0043] It can be seen from the above technical solution that the present application provides a data synchronization method and a security gateway device, which obtains a first paged result fed back by the server in response to the first search request by sending a first search request to the server. When the search flag of the first paged result is the first flag, the first search request is sent to the server again according to the first flag to obtain the second paged result. When the search flag is the second flag, the target user data is synchronized to the local database. When requesting target user data from the server, the present application obtains target user data in batches by paging, and when there is remaining target user data, requests the target user data from the server again, thereby solving the problem of low data request efficiency caused by requesting all target user data at one time. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0045] Figure 1 A flowchart of a data synchronization method provided in some embodiments of the present application;

[0046] Figure 2 This is a flowchart of generating different flags according to the amount of paging data in some embodiments of the present application;

[0047] Figure 3 A flowchart of generating a second page result in some embodiments of the present application;

[0048] Figure 4 This is a flowchart of synchronizing data in batches in some embodiments of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose and implementation of this application clearer, the exemplary implementation of this application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of this application. Obviously, the described exemplary embodiments are only part of the embodiments of this application, not all of the embodiments.

[0050] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.

[0051] In this specification and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or precedence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.

[0052] The terms "comprise," "include," and "have," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0053] LDAP servers can provide user management, permission control, group policy, and other services in various fields for individual users, enterprises, and organizations. For example, an LDAP server can obtain the online behavior data of each user in the organization's network domain and implement online behavior management for the organization's users based on the monitored online behavior data.

[0054] During online behavior management, the LDAP server can obtain user online behavior data and store it in the LDAP server database. To facilitate the classification of different data types, the server database is equipped with multiple storage directories. Different types of online behavior data are stored in corresponding storage directories based on different user information. The LDAP protocol (Lightweight Directory Access Protocol) is a network protocol for accessing and operating directory services. The LDAP protocol allows client applications to access and retrieve directory information in a standardized manner.

[0055] In order to improve network security, users' online behavior data can be monitored through security gateway devices. To this end, the security gateway device can request online behavior data from the LDAP server through the LDAP protocol, and promptly clear the security risk data in the online behavior data, thereby improving the security of users' use of the network.

[0056] However, as the number of users continues to increase, the amount of online behavior data generated by users is also very large. This large amount of online behavior data will cause the security gateway device to search online behavior data slowly when performing a full search, resulting in inefficient online behavior data synchronization.

[0057] In order to solve the problem of inefficiency caused by excessive data when a security gateway device synchronizes user online behavior data, some embodiments of the present application provide a data synchronization method applied to the security gateway device, that is, the security gateway device can execute the data synchronization method. Figure 1 Flowchart of the data synchronization method provided in some embodiments of the present application. Figure 1 , the method comprising:

[0058] S100: Generate a first search request.

[0059] LDAP servers can communicate with multiple user devices. When users interact with these devices, user data is generated. Depending on the interaction options, user data can include various types. For example, for network interactions, user data can include online behavior data; for information registration interactions, user data can include user information data; and for communication interactions, user data can also include user communication information. In this application, only online behavior data is used as an example of user data. It should be understood that in actual applications, different types of data can also be used as user data.

[0060] To facilitate network security management of user data, the security gateway device may generate a first search request. The first search request is used to request target user data from the server. The target user data is user data that meets the first search criteria. Because the amount of user data is very large, to improve management efficiency, the network security management may set the first search criteria to narrow the scope of user data for network security management.

[0061] Based on the above scenario, the security gateway device can also set a first search rule, which is a search rule for target user data. For example, the security gateway device wants to detect user data with an IP address of City A. Therefore, the first search rule can be set to "IP address: City A" and a first search request can be generated according to the first search rule.

[0062] In some embodiments, due to the large number of users, in order to improve the search efficiency and data synchronization efficiency, the security gateway device can also use the first search request to enable the server to search the target user data in pages, that is, return the paged results in sequence through the server, and the paged results include a preset number of target user data, so as to improve the search efficiency by searching and returning the target user data in multiple batches. To this end, the security gateway device can set the number of paged data and generate the first search request based on the first search rule and the number of paged data. The number of paged data is used to indicate the number of target user data included in the paged results.

[0063] S200: Sending the first search request to the server to obtain a first paged result fed back by the server.

[0064] After generating the first search request, the security gateway device may send the first search request to the server. The server may respond to the first search request by searching the server database for the target user data and generating a first paginated result based on the target user data. The first paginated result is the first paginated result sent by the server to the security gateway device, and includes the target user data and a search flag.

[0065] The server can generate a first paging result based on the number of paging data in the first search request. For example, when the number of paging data is 100, the server can respond to the first search request and, during the search process, fill the paging result based on the target user data obtained from the search, and use 100 as the paging data amount, that is, for every 100 target user data found, a paging result is generated. When the search is started, when the number of target user data in the paging result is equal to the number of paging data, the server can generate a first paging result based on the current paging result and send the first paging result to the security gateway device.

[0066] After receiving the first paged result, the security gateway device can determine whether all the target user data has been requested from the server database based on the search flag. The search flag can be a first flag or a second flag, where the first flag indicates that the server has not sent all the target user data, and the second flag indicates that the server has requested all the target user data.

[0067] The search flag is generated by the server based on the target user data and the number of paged data in the server database. Figure 2As shown, when the server responds to the first search request, if the number of target user data is greater than the number of paging data, it means that when the server generates the first paging result, there is still remaining target user data in the server database. In order to improve the synchronization efficiency of the target user data, the server needs to first feedback the target user data in the first paging result to the security gateway device. However, since there is still remaining target user data in the server database. For example, when the number of paging data is 20, the server obtains 50 target user data according to the first search request, then the server can generate the first paging result according to 20 of the target user data, and there are 30 target user data left.

[0068] It should be noted that during the server's search process, the target user data is searched sequentially. Therefore, when searching for the last 20 pieces of target user data, the server can continue searching based on the first search request. If new target user data is found, it indicates that there is remaining target user data. The server generates a first flag in the first page result and sends the first page result to the security gateway device first, so that the security gateway device can first perform processing such as caching, synchronization, and backup on the target user data in the first page result. The security gateway device sends a search request to the server again based on the first flag of the search flag to request the remaining target user data.

[0069] Continue to see Figure 2 If the number of target user data is equal to the number of paging data, it means that the target user data in the server database can just generate the first paging result. At this time, there is no remaining target user data in the server database. The server can generate a second flag in the search flag position of the first paging result to prompt the security gateway device that there is no remaining target user data in the server database.

[0070] If the number of target user data is less than the number of paginated data, the target user data cannot completely fill the first paginated result. The server can generate the first paginated result based on the current target user data and generate a second flag in the search flag of the first paginated result. For example, when the number of paginated data is 20, that is, the first paginated result can store 20 target user data, at this time, the server obtains 10 target user data according to the first search request, indicating that the server database does not have enough target user data to reach 20. At this time, the server can directly generate the first paginated result based on these 10 target user data.

[0071] In some embodiments, to determine the termination of the search for target user data, the security gateway device may further record the server's search duration. When the search duration is greater than or equal to a preset duration threshold, if the security gateway device does not receive the first paged result, a timeout request may be generated. The timeout request is used to prompt the server that the request for target user data has timed out. The security gateway device sends the timeout request to the server. The server responds to the timeout request, terminates the search for target user data, generates a timeout search result based on the target user data currently searched, and sends the timeout search result to the security gateway device.

[0072] In some embodiments, the security gateway device can also replace the step of recording the server's search duration by setting a search duration threshold for the server. The security gateway device can send a search duration request to the server, and the search duration request is used to set a search duration threshold for the server to search for target user data. When the server's search duration is greater than or equal to the search duration threshold, and no new target user data is found, the search for the target user data is stopped, and the first paged result is generated based on the target user data obtained from the current search, thereby omitting the security gateway device's time monitoring process for the server, reducing device power consumption, and improving the device operation efficiency of the security gateway device.

[0073] S300: When the search flag is the first flag, the first search request is sent to the server again according to the first flag to obtain a second page result fed back by the server.

[0074] When the search flag is the first flag, it indicates that there is remaining target user data in the server database. The security gateway device can send the first search request to the server again according to the first flag to request the remaining target user data from the server.

[0075] The server may respond to the first search request again and generate a second paged result based on the target user results. The second paged result is a paged result generated after the first paged result and includes other target user data other than the target user data in the first paged result. The second paged result has the same number of paged data as the first paged result.

[0076] After the server generates the second page result, if there is still target user data remaining, it can generate the first flag again in the second page result, so that the security gateway device can send the first search request to the server again according to the first flag until all the target user data in the server database is requested. To this end, according to the number of target user data, multiple second page results can be included after the first page result. For example, Figure 3As shown, when the number of paging data is 20, the server obtains 50 target user data according to the first search request, and the server can generate a first paging result based on 20 of the target user data. When the server receives the first search request again, it will generate a second paging result based on 20 of the remaining 30 target user data. At this time, there are still 10 target user data left, and the server will generate a first flag in the search flag bit of the second paging result, so that the security gateway device can send the first search request again to request another second paging result generated based on the last 10 target user data.

[0077] S400: When the search flag is the second flag, synchronize the target user data to the local database.

[0078] When the search flag is the second flag, it indicates that the target user data in the server database has been completely requested, and the security gateway device can synchronize the target user data to cache all the target user data in the local database of the security gateway device.

[0079] After obtaining all the page results, the security gateway device can synchronize the target user data in each page result to the local database. In order to improve the efficiency of data synchronization, such as Figure 4 As shown, after receiving the first paged result fed back by the server, the security gateway device can also send the first search request to the server again, so as to synchronize the target user data in the first paged result to the local database in the process of obtaining the second paged result fed back by the server, thereby performing the first data synchronization. In this way, when the server generates the second paged result based on the remaining target user data in response to the re-sent first search request, the target user data in the first paged result can be synchronized at the same time, thereby saving time waiting for the remaining target user data and improving data synchronization efficiency.

[0080] After the target user data in the first page of results is synchronized, Figure 4 As shown, the security gateway device can synchronize the target user data of the second page result to the local database to perform a second data synchronization. If there are multiple second page results, then according to the synchronization method in the above embodiment, when sending a first search request to the server to obtain another second page result fed back by the server, the target user data of the second page result currently fed back by the server can be synchronized.

[0081] In some embodiments, sending the first search request multiple times in a short period of time is easily judged as abnormal request behavior. Therefore, the security gateway device can also set a limit on the number of times the first search request is sent, so that after the limit, the first search request can be sent again at a preset time interval, or the first search request can be stopped. The security gateway device can record the number of times the first search request is sent when sending the first search request. When the number of times the first search request is sent is greater than or equal to the limit, a restriction mark is added to the first search request to obtain a first restriction request, and the first restriction request is sent to the server. The first restriction request is used to instruct the server to terminate the request for the target user data after the paging result of the current round of requests, even if the server also includes the remaining target user data, due to the limit on the number of search requests, the request for these remaining target user data will no longer be executed. The server can generate a termination paging result based on the target user data in response to the first restriction request, and send the termination paging result feedback to the security gateway device.

[0082] To restrict the security gateway device from continuing to send the first search request, the server can directly generate a second flag in the search flag bit when generating the terminated paging result, that is, the search flag bit of the terminated paging result is the second flag. Based on the second flag, the security gateway device can synchronize the target user data of the terminated paging result and the target user data obtained before the terminated paging result to the local database respectively.

[0083] In some embodiments, the server may also determine the first flag or the second flag based on a flag value, where the flag value is a preset value of the search flag. For example, the flag value may be a cookie value. When the server receives the first search request and starts to search for the target user data, the cookie value may be an empty value to indicate that the target user data has not been found. When the server searches for the target user data, the cookie value may be updated to a non-empty value. At this time, the server may generate a first flag based on the non-empty value to indicate that there is remaining target user data outside the current paged results. When the server responds to one of the first search requests and the cookie value is updated to an empty value, the server may generate a second flag to indicate that the request for all target user data has been completed.

[0084] In some embodiments, when the security gateway device synchronizes target user data, it may also synchronize target classified data by category. Therefore, the security gateway device may create a first data group and a second data group in a local database based on preset conditions. The preset conditions correspond to the data type of the target user data. After receiving the target user data, the security gateway device may detect the data type of the target user data. The data type includes individual user data and non-individual user data.

[0085] If the target user data is individual user data, the target user data is synchronized to the first data group. The target user data can be represented by a user result pointer. The security gateway device can search the directory function of the target user data returned by the server by calling ldap_search_st() and requesting the target user data under the corresponding directory path. Upon successful execution of this function, a user result pointer res_entry is also returned. The target user data synchronization process is completed by looping through the res_entry pointer, extracting the user_entry, and storing the user_entry in the first data group.

[0086] If the target user data is not individual user data, the target user data is synchronized to the second data group. The security gateway device can obtain the current path of the target user data by calling ldap_get_dn(ld,entry). Usually, the current path is a string with the same hierarchy on the same domain server.

[0087] For example, the current path can be: dn=OU=ou502,OU=1024_OU,OU=NGFW,DC=ngfw,DC=com. The domain hierarchical organizational structure corresponding to the current path is / ngfw.com / NGFW / 1024_OU / ou502. The security gateway device needs to parse the dn and assemble the dn according to the hierarchy. After the assembly is completed, the path of the target user data can be stored in the second data group, and the target user data has been synchronized to the second data group.

[0088] In another embodiment, the non-individual user data may further include path information related to the first search rule and may be stored based on the path information related to the first search rule. For example, when the first search rule is to search for user data of "school A", the path information corresponding to "student E attending school A" is school A / grade B / class C / group D / student E, etc. The security gateway device may store the target user data corresponding to student E based on this path information.

[0089] In some embodiments, before sending the first search request to the server, the security gateway device needs to establish a communication connection with the server. To this end, the security gateway device can send a connection request to the server to establish a communication channel between the security gateway device and the server. The communication channel can be used for data exchange between the security gateway device and the server. For example, the server can send user data to the security gateway device through the communication channel, and the security gateway device can also upload corresponding interaction data to the server.

[0090] To improve data transmission security, the security gateway device must pass server authentication. To do this, the security gateway device can establish a communication binding with the server via a communication channel based on the username and password associated with the username. The username is the username of the security gateway device. After passing the server's authentication, the security gateway device completes the communication binding with the server. After the communication binding is complete, the server can send the binding information to the gateway security device, which can then send the first search request to the server based on the binding information.

[0091] In some embodiments, after the security gateway device completes synchronization of the target user data in each paged result fed back by the server, the security gateway device may delete the first paged result and the second paged result to increase the storage space of the security gateway device and avoid the risk of data leakage. After deleting the first paged result and the second paged result, if the security gateway device has no other data request tasks, the security gateway device may unbind the security gateway device from the server.

[0092] In some embodiments, if the server does not request the target user data according to the first search rule of the first search request, it means that the target user data does not exist in the server database. The server can generate a first paged result that does not contain the target user data based on the blank data information. When the security gateway device receives the first paged result, it can generate a prompt message based on the first search rule, and the prompt message is used to indicate that the target user data has not been synchronized to the local database. The security tester can replace the first search rule based on the prompt message to generate another search request.

[0093] In some embodiments, the server can create a page_control based on the first search request. The page_control is a control page. The server can generate paging results based on the control page and the target user data obtained by the search. After the server generates the page_control, it uses the page_control as the control parameter for the paging search and calls the ldap_search_ext_s function to search for the target user data to be synchronized based on the control parameter.

[0094] The ldap_search_ext_s function can be: LDAP*ld, const char*base, int scope, constchar*filter, LDAPControl**serverctrls, LDAPControl**clientctrls, struct l_timeval*timeout, struct l_timeval*sizelimit, LDAPMessage**res.

[0095] Wherein, ld: a pointer to the server. In this embodiment, the server can be an LDAP server, so ld can represent an LDAP connection. base: the base DN (Distinguished Name) of the search, indicating the starting point of the search for the target user data. scope: the search scope, which can be LDAP_SCOPE_BASE (search only the base object), LDAP_SCOPE_ONELEVEL (search only direct child objects), or LDAP_SCOPE_SUBTREE (search the base object and all its child data). filter: a search filter, used to filter user data according to the first search rule to obtain the target user data. serverctrls: a pointer to the server control array, used to instruct the server to search for the target user data. clientctrls: a pointer to the client control array. These controls can be used to influence the behavior of the server, for example, to modify the parameters of the paged search to change the server's search strategy. timeout: a pointer to the l_timeval structure, which defines the timeout of the search operation. If the value of timeout is null, it means that the search for the target user data has timed out. sizelimit: a pointer to the l_timeval structure, which defines the number of search requests to be sent. res: a pointer to the LDAPMessage structure, used to receive the target user data obtained by the search. After the function is successfully executed, the res pointer will contain the target user data returned by the server. The synchronization result of the target user data can be obtained by parsing the res pointer.

[0096] Some embodiments of the present application further provide a security gateway device, the security gateway device including a data synchronization module, the data synchronization module being configured to execute a data synchronization method disclosed in the above embodiment, including:

[0097] S100: Generate a first search request.

[0098] The first search request is used to request target user data.

[0099] S200: Sending the first search request to the server to obtain a first paged result fed back by the server.

[0100] The first paging result includes target user data and a search flag, the search flag is a first flag or a second flag, the first flag is used to indicate that the server has not requested all target user data, and the second flag is used to indicate that the server has requested all target user data.

[0101] S300: When the search flag is the first flag, according to the first flag, the first search request is sent to the server again to obtain a second page result fed back by the server.

[0102] The second page result includes other target user data other than the target user data in the first page result.

[0103] S400: When the search flag is the second flag, synchronize the target user data to the local database.

[0104] It can be seen from the above technical solution that the present application provides a data synchronization method and a security gateway device, which obtains a first paged result fed back by the server in response to the first search request by sending a first search request to the server. When the search flag of the first paged result is the first flag, the first search request is sent to the server again according to the first flag to obtain the second paged result. When the search flag is the second flag, the target user data is synchronized to the local database. When requesting target user data from the server, the present application obtains target user data in batches by paging, and when there is remaining target user data, requests the target user data from the server again, thereby solving the problem of low data request efficiency caused by requesting all target user data at one time.

[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

[0106] For ease of explanation, the above description has been presented in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations are possible. The above embodiments have been selected and described to better explain the present disclosure, thereby enabling those skilled in the art to better utilize the embodiments.

Claims

1. A data synchronization method, characterized in that: Applicable to security gateway devices, including: generating a first search request, wherein the first search request is used to request target user data; Sending the first search request to the server to obtain a first paged result fed back by the server, wherein the first paged result includes target user data and a search flag, wherein the search flag is a first flag or a second flag, wherein the first flag is used to indicate that the server has not sent all the target user data, and the second flag is used to indicate that the server has sent all the target user data; When the search flag is the first flag, according to the first flag, the first search request is sent to the server again to obtain a second page result fed back by the server, wherein the second page result includes other target user data other than the target user data in the first page result; When the search flag is the second flag, the target user data is synchronized to the local database.

2. The data synchronization method according to claim 1, characterized in that: The method further comprises the step of sending the first search request to the server again: In the process of obtaining the second page result fed back by the server, synchronizing the target user data in the first page result to the local database; After synchronization of the target user data in the first page result is completed, the target user data in the second page result is synchronized to the local database.

3. The data synchronization method according to claim 1, characterized in that: The step of generating a first search request comprises: Setting a first search rule and a paging data quantity, wherein the first search rule is a search rule for the target user data, and the paging data quantity is used to indicate the quantity of the target user data included in the paging result; The first search request is generated according to the first search rule and the amount of paging data.

4. The data synchronization method according to claim 1, characterized in that: The step of synchronizing the target user data to the local database includes: creating a first data set and a second data set in the local database; Detecting a data type of the target user data, where the data type includes individual user data and non-individual user data; If the target user data is individual user data, synchronizing the target user data to the first data group; If the target user data is non-individual user data, the target user data is synchronized to the second data group.

5. The data synchronization method according to claim 1, characterized in that: After the step of sending the first search request to the server, the method further includes: Setting a limit on the number of times the first search request is sent; When the number of times the first search request is sent is greater than or equal to the limit number, adding a limit mark to the first search request to obtain a first limit request; Sending the first restriction request to the server to obtain a paging termination result fed back by the server; The target user data of the terminated paging results and the target user data acquired before the terminated paging results are synchronized to the local database respectively.

6. The data synchronization method according to claim 1, characterized in that: After the step of sending the first search request to the server, the method further includes: Recording the search duration of the server; When the search duration is greater than or equal to a preset duration threshold, if the first paging result is not received, a timeout request is generated; A timeout request is sent to the server to obtain a timeout search result fed back by the server, wherein the timeout search result is a search result generated by the server in response to the timeout request according to the target user data currently being searched.

7. The data synchronization method according to claim 1, characterized in that: Sending the first search request to a server, the method further comprising: Sending a connection request to a server to establish a communication channel between the security gateway device and the server; Through the communication channel, communicating and binding with the server according to the user name and the password information corresponding to the user name; After the server is bound by communication, the first search request is sent to the server.

8. The data synchronization method according to claim 7, characterized in that: After the step of synchronizing the target user data to the local database, the method further includes: Delete the first page results and the second page results; After deleting the first page result and the second page result, the binding state between the security gateway device and the server is released.

9. The data synchronization method according to claim 3, characterized in that: If the first page result does not include the target user data, the method further includes: Prompt information is generated according to the first search rule, where the prompt information is used to indicate that the target user data is not synchronized to the local database.

10. A security gateway device, characterized in that: The security gateway device includes a data synchronization module, and the data synchronization module is configured to: generating a first search request, wherein the first search request is used to request target user data; Sending the first search request to the server to obtain a first paged result fed back by the server, wherein the first paged result includes target user data and a search flag, wherein the search flag is a first flag or a second flag, wherein the first flag is used to indicate that the server has not requested all target user data, and the second flag is used to indicate that the server has requested all target user data; When the search flag is the first flag, according to the first flag, the first search request is sent to the server again to obtain a second page result fed back by the server, wherein the second page result includes other target user data other than the target user data in the first page result; When the search flag is the second flag, the target user data is synchronized to the local database.

Citation Information

Patent Citations

  • Paging query method, system and device

    CN110765158A

  • Server paging processing method and device, computer equipment and storage medium

    CN118606580A

  • Selective fetching of search results

    US20130173655A1