A method, device, electronic device and storage medium for processing resource data

Through the message triggering mechanism and the combination of initialization queue and run queue, hash array and two-way linked list are used to process resource data, which solves the problem of resource data synchronization timeliness and concurrency in the cloud operating system, reduces system consumption and maintenance costs, and achieves Efficient resource data synchronization.

CN114168359BActive Publication Date: 2024-10-29JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111249201.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2024-10-29
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

It is difficult to achieve timeliness, concurrency and idempotent synchronization of resource data in cloud operating systems with existing technology, and commonly used solutions increase system consumption and maintenance work, making it difficult to meet the needs of a multi-level resource management platform.

Method used

It uses a message trigger mechanism and a combination of initialization queue and run queue to process resource data by pushing messages in real time, and uses hash arrays and two-way linked lists to store and synchronize resource data, avoiding full synchronization and reducing dependence on external middleware.

Benefits of technology

It achieves targeted data synchronization of changing resources, reduces resource consumption and maintenance costs, ensures data timeliness and idempotence, and reduces system modification costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168359B_ABST
    Figure CN114168359B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, electronic device and storage medium for processing resource data. The method includes: receiving a real-time push message sent by a first host device, the real-time push message carrying resource data generated by the first host device when performing an operation task; obtaining first resource data in the resource data that meets a preset storage requirement; querying the storage result corresponding to the first resource data from an initialization queue; storing the first resource data in an initialization queue according to a storage operation corresponding to the storage result, and the initialization queue is used to transfer the stored first resource data to a running queue, so that the running queue performs a synchronization task based on the first resource data. The present application avoids unnecessary resource consumption caused by blind full synchronization through a message trigger mechanism. The initialization queue is used to perform data storage and the running queue is used to perform data synchronization, without the need to reference external middleware, which reduces the maintenance of the middleware and reduces the cost of modifying existing equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a method, device, electronic device and storage medium for processing resource data. Background Art

[0002] With the continuous development of cloud operating systems (cloud OS), a multi-layered resource management platform system has emerged to meet more diversified resource management scenarios. Although each system manages resources in a more detailed manner based on different users, the content of the managed resources must be consistent. Therefore, it is necessary to use synchronization mechanisms between systems at all levels to achieve resource data consistency. For example, when a downstream system edits a virtual machine operation, its upstream system needs to quickly obtain the behavior and modify the corresponding virtual machine information. This requires synchronization to meet requirements such as timeliness, concurrency, sequentiality, and idempotence.

[0003] The commonly used implementation schemes are: 1. Scheduled full-scale pull synchronization, that is, the downstream system provides an information query interface (Http) for upstream calls that need synchronization. Although this scheme is simple to implement, the upstream cannot perceive in real time when the resources have changed, and can only call the interface to query the full amount of resources at a scheduled time, which will undoubtedly cause high consumption of upstream and downstream system resources; 2. Use message middleware such as MQ to push update data, and the downstream sends the changed resource information asynchronously to MQ, and the upstream only needs to subscribe to the message in MQ. This scheme can better synchronize only the changed resource information, while ensuring the timeliness and concurrency of the data, but its own principle determines that it cannot guarantee that there will be no loss or duplication, so it is still necessary for both parties of the synchronization system to handle it through business data agreements (such as unique id, etc.). In addition, for cloud OS with more stringent resource requirements, any cross-system middleware will increase additional system consumption and unnecessary maintenance work, and the cost of transformation of existing systems is relatively high. Therefore, for cloud OS, the above two schemes are difficult to meet the synchronization requirements of its various system platforms. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a method, device, electronic device and storage medium for processing resource data.

[0005] According to one aspect of an embodiment of the present application, a method for processing resource data is provided, including:

[0006] Receiving a real-time push message sent by a first host device, wherein the real-time push message carries resource data generated by the first host device when performing an operation task;

[0007] Acquire first resource data from the resource data that meets preset storage requirements;

[0008] Querying the storage result corresponding to the first resource data from the initialization queue;

[0009] The first resource data is stored in an initialization queue according to a storage operation corresponding to the storage result, wherein the initialization queue is used to transfer the stored first resource data to a running queue so that the running queue performs a synchronization task based on the first resource data.

[0010] Further, the obtaining of first resource data from the resource data that meets a preset storage requirement includes:

[0011] Obtaining a preset storage format of resource data in the initialization queue;

[0012] Determining the preset storage requirement according to the preset storage format;

[0013] The resource data that meets the preset storage requirement among the resource data is determined as the first resource data, wherein the first resource data includes: resource type, operation type, resource representation, and operation timestamp.

[0014] Further, storing the first resource data into an initialization queue according to a storage operation corresponding to the storage result includes:

[0015] In a case where the storage result indicates that there is no resource data of the same resource type as the first resource data in the initialization queue, generating a target hash value corresponding to the first resource data;

[0016] The target hash value is written into a hash array in the initialization queue, and the first resource data is written into a doubly linked list in the initialization queue, wherein each hash value in the hash array corresponds to at least one entry in the doubly linked list.

[0017] Further, storing the first resource data into an initialization queue according to a storage operation corresponding to the storage result includes:

[0018] In a case where the storage result indicates that resource data of the same resource type as the first resource data exists in the initialization queue, querying a target hash value corresponding to the first resource data from a hash array of the initialization queue;

[0019] The target table entry corresponding to the target hash value is queried from the bidirectional linked list of the initialization queue, and the header of the target table entry is updated using the operation timestamp.

[0020] Furthermore, the method further comprises:

[0021] receiving a target synchronization task sent by a second host device, wherein the target synchronization task is used to synchronize resource data in the initialization queue to the second host device;

[0022] Acquire second resource data satisfying the target synchronization task from the initialization queue;

[0023] The second resource data is transferred from the initialization queue to the running queue, and the second resource data is synchronized to the second host device through the running queue.

[0024] Furthermore, the method further comprises:

[0025] Monitoring a current synchronization task list, wherein the synchronization task list includes at least one synchronization task that is currently synchronizing resources;

[0026] Acquire the third resource data corresponding to each synchronization task in the synchronization task list from the initialization queue;

[0027] Acquire fourth resource data in the running queue;

[0028] Comparing the third resource data with the fourth resource data to obtain a comparison result;

[0029] In a case where the comparison result indicates that the third resource data is different from the fourth resource data, determining fifth resource data missing from the fourth resource data;

[0030] The fifth resource data is extracted from the third resource data, and the fifth resource data is transferred from the initialization queue to the running queue.

[0031] Furthermore, the method further comprises:

[0032] Periodically testing the initialization queue according to preset indicators to obtain a test result;

[0033] When the detection result indicates that the preset indicator meets the preset condition, obtaining a target table entry from the end of the bidirectional linked list in the initialization queue;

[0034] The resource data corresponding to the target entry is deleted from the bidirectional linked list and transferred to the running queue to execute the resource synchronization task.

[0035] According to another aspect of an embodiment of the present application, a device for processing resource data is also provided, including:

[0036] A receiving module, configured to receive a real-time push message sent by a first host device, wherein the real-time push message carries resource data generated by the first host device when performing an operation task;

[0037] An acquisition module, used for acquiring first resource data that meets a preset storage requirement from the resource data;

[0038] A query module, used to query the storage result corresponding to the first resource data from an initialization queue, wherein the initialization queue is used to execute a synchronization task of resource data;

[0039] A storage module is used to store the first resource data into an initialization queue according to a storage operation corresponding to the storage result.

[0040] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0041] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0042] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0043] Compared with the prior art, the above technical solution provided by the embodiment of the present application has the following advantages: the embodiment of the present application adopts a message trigger mechanism to perform targeted data synchronization processing on the changed resources, avoiding unnecessary resource consumption caused by blind full synchronization. The initialization queue is used to perform data storage, and the running queue is used to perform data synchronization. There is no need to refer to external middleware, which reduces the maintenance of the middleware and reduces the transformation cost of existing equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0046] Figure 1 A flowchart of a method for processing resource data provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of the structure of the initialization queue provided in an embodiment of the present application;

[0048] Figure 3 A flowchart of a method for processing resource data provided by another embodiment of the present application;

[0049] Figure 4 A flowchart of a method for processing resource data provided by another embodiment of the present application;

[0050] Figure 5 A flowchart of a method for processing resource data provided by another embodiment of the present application;

[0051] Figure 6 A block diagram of a resource data processing device provided in an embodiment of the present application;

[0052] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0054] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0055] The embodiments of the present application provide a method, device, electronic device and storage medium for processing resource data. The method provided by the embodiments of the present invention can be applied to any required electronic device, for example, it can be an electronic device such as a server or a terminal, which is not specifically limited here. For the convenience of description, it is referred to as an electronic device in the following.

[0056] According to one aspect of the embodiments of the present application, a method embodiment of a method for processing resource data is provided. Figure 1 A flowchart of a method for processing resource data provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0057] Step S11: receiving a real-time push message sent by a first host device, wherein the real-time push message carries resource data generated by the first host device when executing an operation task.

[0058] The processing method provided in the embodiment of the present application is applied to a message processing device, and the first host device may be a host device located upstream of the message processing device. The real-time push message may be a Web Socket message sent by the first host device, and the Web Socket message carries resource data generated by the first host device when performing an operation task. The resource data includes: resource type, operation type, resource ID, operation timestamp, source address, destination address, etc.

[0059] It should be noted that the message processing device and the first host device use a long link to communicate. The message processing device can use the heartbeat packet to periodically monitor the communication status of the long link and perform corresponding operations according to different communication statuses. For example: the message processing device determines that the long link is in a normal state, and only needs to send a PING command to prevent the upstream host device from being suspended. If the long link is in an abnormal state, the message processing device needs to reconnect.

[0060] Step S12: acquiring first resource data from the resource data that meets a preset storage requirement.

[0061] In the embodiment of the present application, step S12, obtaining first resource data in the resource data that meets the preset storage requirement, includes the following steps A1-A3:

[0062] Step A1, obtaining a preset storage format of resource data in an initialization queue.

[0063] In an embodiment of the present application, the storage device includes an initialization queue and an operation queue, wherein the initialization queue is used to store resource data sent by a device located upstream of the message processing device, and the resource data stored in the operation queue is resource data synchronized with a device located downstream of the message processing device.

[0064] In an embodiment of the present application, before storing resource data in the initialization queue, the storage device needs to determine a preset storage format of the initialization queue. The preset storage format may be a storage format of a hash array and a bidirectional linked list.

[0065] Step A2: determining a preset storage requirement according to a preset storage format.

[0066] In the embodiment of the present application, different storage formats correspond to different storage requirements. Taking a hash array and a bidirectional linked list as an example, the corresponding storage requirements may be related parameters of the resource data.

[0067] Step A3: Determine resource data in the resource data that meets the preset storage requirement as first resource data, wherein the first resource data includes: resource type, operation type, resource representation, and operation timestamp.

[0068] In an embodiment of the present application, resource data is filtered, and data belonging to relevant parameters of the resource data is determined as first resource data, and the first resource data includes: resource type, operation type, resource representation, and operation timestamp.

[0069] In an embodiment of the present application, after obtaining the first resource data, the message processing device also needs to convert the first resource data into a data format that can be read by the initialization queue, such as a Key-value (key-value pair) data format, where the Key is the resource type, operation type, resource identifier, and the value is the operation timestamp.

[0070] Step S13: query the storage result corresponding to the first resource data from the initialization queue.

[0071] In an embodiment of the present application, a query is made from the initialization queue according to the resource type whether the first resource type already exists in the initialization queue.

[0072] Step S14, storing the first resource data in an initialization queue according to a storage operation corresponding to the storage result, wherein the initialization queue is used to transfer the stored first resource data to the running queue so that the running queue performs a synchronization task based on the first resource data.

[0073] In the embodiment of the present application, storing the first resource data into the initialization queue according to the storage operation corresponding to the storage result includes the following steps B1-B2:

[0074] Step B1: when the storage result indicates that there is no resource data of the same resource type as the first resource data in the initialization queue, generate a target hash value corresponding to the first resource data.

[0075] Step B2: write the target hash value into the hash array in the initialization queue, and write the first resource data into the doubly linked list in the initialization queue, wherein each hash value in the hash array corresponds to at least one entry in the doubly linked list.

[0076] In the embodiment of the present application, storing the first resource data into the initialization queue according to the storage operation corresponding to the storage result includes the following steps C1-C2:

[0077] Step C1, when the storage result indicates that resource data of the same resource type as the first resource data exists in the initialization queue, querying the target hash value corresponding to the first resource data from the hash array of the initialization queue;

[0078] Step C2, query the target table entry corresponding to the target hash value from the bidirectional linked list of the initialization queue, and use the operation timestamp to update the header of the target table entry.

[0079] It should be noted that the embodiment of the present application uses a data structure of a hash array and a bidirectional linked list (refer to Figure 2 ), for the data newly added to the initialization queue, if the data already exists in the initialization queue, there is no need to insert the data again. Just update the timestamp of the table entry where the data is located and move it to the head of the doubly linked list. If the data does not exist in the initialization queue, put it into the hash array and insert it into the tail of the doubly linked list. In this way, the characteristics of the hash array and the doubly linked list can solve the idempotence and ensure the order of the message.

[0080] The embodiment of the present application adopts a message trigger mechanism to perform targeted data synchronization processing on the changed resources, avoiding unnecessary resource consumption caused by blind full synchronization. The initialization queue is used to perform data storage, and the running queue is used to perform data synchronization. There is no need to reference external middleware, which reduces the maintenance of the middleware and reduces the transformation cost of existing equipment.

[0081] Figure 3 A flowchart of a method for processing resource data provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the method also includes:

[0082] Step S21: receiving a target synchronization task sent by a second host device, wherein the target synchronization task is used to synchronize resource data in an initialization queue to the second host device.

[0083] In an embodiment of the present application, the second host device is a device located downstream of the message processing device. The second host device and the message processing device communicate using a long link. When the second host device updates resources, the second host device sends a target synchronization task to the message processing device. The target synchronization task carries resource data required by the second host device.

[0084] Step S22: Acquire second resource data satisfying the target synchronization task from the initialization queue.

[0085] In an embodiment of the present application, after receiving the target synchronization task, the message processing device will obtain the second resource data that satisfies the target synchronization task from the initialization queue. Specifically, the message processing device can extract the resource identifier from the target synchronization task, and then obtain the resource type, operation type, and operation timestamp associated with the resource identifier from the initialization queue according to the resource identifier as the second resource data.

[0086] Step S23: transferring the second resource data from the initialization queue to the running queue, and synchronizing the second resource data to the second host device through the running queue.

[0087] In the embodiment of the present application, after determining the second resource data, the message processing device transfers the second resource data from the initialization queue to the running queue, so that the running queue synchronizes the second resource data to the second host device, and the second resource data in the initialization queue is deleted. In addition, during the execution of the target synchronization task, the running queue of the message processing device will request the source host device corresponding to the second resource data (i.e., the upstream host device of the message processing device), obtain the full amount of data corresponding to the second resource data from the source host device, and synchronize the full amount of data to the second host device.

[0088] It should be noted that since the initialization queue stores resource data of the same resource type in the same table entry in the bidirectional linked list, when the initialization queue transfers data to the running queue, it can only ensure that only one synchronization task of the same resource type is running at the same time, ensuring the orderliness of data synchronization.

[0089] Figure 4 A flowchart of a method for processing resource data provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the method also includes:

[0090] Step S31 : monitoring a current synchronization task list, wherein the synchronization task list includes at least one synchronization task that is currently synchronizing resources.

[0091] Step S32: Acquire the third resource data corresponding to each synchronization task in the synchronization task list from the initialization queue.

[0092] Step S33, obtaining the fourth resource data in the running queue.

[0093] Step S34, comparing the third resource data and the fourth resource data to obtain a comparison result.

[0094] Step S35: when the comparison result indicates that the third resource data is different from the fourth resource data, determine the fifth resource data missing from the fourth resource data.

[0095] Step S36, extracting the fifth resource data from the third resource data, and transferring the fifth resource data from the initialization queue to the running queue.

[0096] It should be noted that the embodiment of the present application sets a thread for monitoring the initialization queue and the synchronization task list, and its main function is to read the data stored in the queue from the tail to the head of the initialization queue in sequence, and obtain the third resource data that satisfies the synchronization task in the synchronization task list, and then compare the third resource data with the fourth resource data in the runtime queue. If the third resource data is the same as the fourth resource data, it is determined that the running queue already has the data to perform the synchronization task, and no processing is performed at this time. If the third resource is not exactly the same as the fourth resource data, there is no such data in the running queue to perform the synchronization task. At this time, the missing fifth resource data in the fourth resource data is determined, and the data is transferred from the initialization queue to the runtime queue. In addition, after obtaining the fifth resource data, the running queue also needs to schedule the resource data that is performing the synchronization task. If the resource data currently performing the synchronization task has resource data of the same type as the fifth resource data, the fifth resource data is stored, and after waiting for the resource data of the same type to complete the synchronization task, the fifth resource data is executed The synchronization task is executed, and the same type of resources are sequentially guaranteed to be executed serially, avoiding the resource competition problem caused by parallelism.

[0097] Figure 5 A flowchart of a method for processing resource data provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the method also includes:

[0098] Step S41, periodically detect the initialization queue according to the preset index to obtain the detection result.

[0099] Step S42, when the detection result is used to indicate that the preset indicator meets the preset condition, the target table entry is obtained from the end of the bidirectional linked list in the initialization queue.

[0100] Step S43, deleting the resource data corresponding to the target entry from the bidirectional linked list, and transferring it to the running queue to execute the resource synchronization task.

[0101] In an embodiment of the present application, the initialization queue is periodically checked according to preset indicators, with the purpose of ensuring that there is enough space in the initialization queue to store new push messages, wherein the preset indicators include the total number of messages and the timestamp stored in the initialization queue. Specifically, if the total number of messages in the current cycle is greater than the set threshold, or the timestamp of the end message of the doubly linked list in the current cycle is less than the start time of the current cycle minus the set threshold, the data at the end of the doubly linked list is forcibly deleted and synchronous business processing is performed. This avoids the situation where a large number of push messages influx in a short period of time causes excessive memory resource usage.

[0102] Figure 6 This is a block diagram of a resource data processing device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 6 As shown, the device comprises:

[0103] The receiving module 61 is used to receive a real-time push message sent by the first host device, wherein the real-time push message carries resource data generated by the first host device when executing an operation task.

[0104] The acquisition module 62 is used to acquire first resource data from the resource data that meets the preset storage requirement.

[0105] The query module 63 is used to query the storage result corresponding to the first resource data from the initialization queue.

[0106] The storage module 64 is used to store the first resource data into the initialization queue according to the storage operation corresponding to the storage result, wherein the initialization queue is used to transfer the stored first resource data to the running queue so that the running queue performs the synchronization task based on the first resource data.

[0107] In an embodiment of the present application, an acquisition module 62 is used to obtain a preset storage format of resource data in an initialization queue; determine a preset storage requirement based on the preset storage format; and determine the resource data in the resource data that meets the preset storage requirement as first resource data, wherein the first resource data includes: resource type, operation type, resource representation, and operation timestamp.

[0108] In an embodiment of the present application, the storage module 64 is used to generate a target hash value corresponding to the first resource data when the storage result indicates that there is no resource data of the same resource type as the first resource data in the initialization queue; write the target hash value into a hash array in the initialization queue, and write the first resource data into a doubly linked list in the initialization queue, wherein each hash value in the hash array corresponds to at least one table entry in the doubly linked list.

[0109] In an embodiment of the present application, the storage module 64 is used to query the target hash value corresponding to the first resource data from the hash array of the initialization queue when the storage result is used to indicate that there is resource data of the same resource type as the first resource data in the initialization queue; query the target table entry corresponding to the target hash value from the bidirectional linked list of the initialization queue, and use the operation timestamp to update the header of the target table entry.

[0110] In an embodiment of the present application, the processing device also includes: a resource synchronization module, which is used to receive a target synchronization task sent by the second host device, wherein the target synchronization task is used to synchronize the resource data in the initialization queue to the second host device; obtain the second resource data that meets the target synchronization task from the initialization queue; transfer the second resource data from the initialization queue to the running queue, and synchronize the second resource data to the second host device through the running queue.

[0111] In an embodiment of the present application, the processing device also includes a monitoring module for monitoring a current synchronization task list, wherein the synchronization task list includes at least one synchronization task that is performing resource synchronization; obtaining third resource data corresponding to each synchronization task in the synchronization task list from an initialization queue; obtaining fourth resource data in a running queue; comparing the third resource data and the fourth resource data to obtain a comparison result; when the comparison result indicates that the third resource data is different from the fourth resource data, determining the missing fifth resource data in the fourth resource data; extracting the fifth resource data from the third resource data, and transferring the fifth resource data from the initialization queue to the running queue.

[0112] In an embodiment of the present application, the processing device also includes a detection module, which is used to periodically detect the initialization queue according to preset indicators to obtain detection results; when the detection results are used to indicate that the preset indicators meet the preset conditions, the target table item is obtained from the end of the bidirectional linked list in the initialization queue; the resource data corresponding to the target table item is deleted from the bidirectional linked list and transferred to the running queue to execute the resource synchronization task.

[0113] The present application also provides an electronic device, such as Figure 7 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .

[0114] Memory 1503, used for storing computer programs;

[0115] The processor 1501 is used to implement the steps of the above embodiment when executing the computer program stored in the memory 1503.

[0116] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0117] The communication interface is used for communication between the above terminal and other devices.

[0118] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0119] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0120] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes the resource data processing method described in any one of the above embodiments.

[0121] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the resource data processing method described in any one of the above embodiments.

[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk), etc.

[0123] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

[0124] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A method for processing resource data, characterized in that: include: Receiving a real-time push message sent by a first host device, wherein the real-time push message carries resource data generated by the first host device when performing an operation task; Acquire first resource data from the resource data that meets preset storage requirements; Querying the storage result corresponding to the first resource data from the initialization queue; storing the first resource data in an initialization queue according to a storage operation corresponding to the storage result, wherein the initialization queue is used to transfer the stored first resource data to a running queue so that the running queue performs a synchronization task based on the first resource data; The obtaining of the first resource data in the resource data that meets the preset storage requirement includes: obtaining a preset storage format of the resource data in the initialization queue; determining the preset storage requirement according to the preset storage format; determining the resource data in the resource data that meets the preset storage requirement as the first resource data, wherein the first resource data includes: resource type, operation type, resource representation, and operation timestamp; The method also includes: periodically detecting the initialization queue according to preset indicators to obtain detection results; when the detection results are used to indicate that the preset indicators meet preset conditions, obtaining a target table item from the end of the bidirectional linked list in the initialization queue; deleting resource data corresponding to the target table item from the bidirectional linked list and transferring it to the running queue to execute a resource synchronization task.

2. The method according to claim 1, characterized in that: The storing the first resource data into the initialization queue according to the storage operation corresponding to the storage result includes: In a case where the storage result indicates that there is no resource data of the same resource type as the first resource data in the initialization queue, generating a target hash value corresponding to the first resource data; The target hash value is written into a hash array in the initialization queue, and the first resource data is written into a doubly linked list in the initialization queue, wherein each hash value in the hash array corresponds to at least one entry in the doubly linked list.

3. The method according to claim 1, characterized in that The storing the first resource data into the initialization queue according to the storage operation corresponding to the storage result includes: In a case where the storage result indicates that resource data of the same resource type as the first resource data exists in the initialization queue, querying a target hash value corresponding to the first resource data from a hash array of the initialization queue; The target table entry corresponding to the target hash value is queried from the bidirectional linked list of the initialization queue, and the header of the target table entry is updated using the operation timestamp.

4. The method according to claim 1, characterized in that: The method further comprises: receiving a target synchronization task sent by a second host device, wherein the target synchronization task is used to synchronize resource data in the initialization queue to the second host device; Acquire second resource data satisfying the target synchronization task from the initialization queue; The second resource data is transferred from the initialization queue to the running queue, and the second resource data is synchronized to the second host device through the running queue.

5. The method according to claim 4, characterized in that The method further comprises: Monitoring a current synchronization task list, wherein the synchronization task list includes at least one synchronization task that is currently synchronizing resources; Acquire the third resource data corresponding to each synchronization task in the synchronization task list from the initialization queue; Acquire fourth resource data in the running queue; Comparing the third resource data with the fourth resource data to obtain a comparison result; In a case where the comparison result indicates that the third resource data is different from the fourth resource data, determining fifth resource data missing from the fourth resource data; The fifth resource data is extracted from the third resource data, and the fifth resource data is transferred from the initialization queue to the running queue.

6. A resource data processing device, characterized in that: include: A receiving module, configured to receive a real-time push message sent by a first host device, wherein the real-time push message carries resource data generated by the first host device when performing an operation task; An acquisition module, used for acquiring first resource data that meets a preset storage requirement from the resource data; A query module, used for querying the storage result corresponding to the first resource data from the initialization queue; a storage module, configured to store the first resource data in an initialization queue according to a storage operation corresponding to the storage result, wherein the initialization queue is configured to transfer the stored first resource data to a running queue so that the running queue performs a synchronization task based on the first resource data; An acquisition module is used to acquire a preset storage format of resource data in the initialization queue; determine a preset storage requirement according to the preset storage format; and determine resource data in the resource data that meets the preset storage requirement as first resource data, wherein the first resource data includes: resource type, operation type, resource representation, and operation timestamp; The processing device also includes a detection module, which is used to periodically detect the initialization queue according to preset indicators to obtain detection results; when the detection results are used to indicate that the preset indicators meet the preset conditions, the target table item is obtained from the end of the bidirectional linked list in the initialization queue; the resource data corresponding to the target table item is deleted from the bidirectional linked list and transferred to the running queue to execute the resource synchronization task.

7. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 5 when executed.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the method steps of any one of claims 1 to 5 by running a program stored in a memory.

Citation Information

Patent Citations

  • Data synchronization method, device and equipment and storage medium

    CN112527899A

  • Resource adjustment method and device, electronic equipment and readable storage medium

    CN112559173A