Management methods, devices, and electronic equipment for policy object references in gateway devices

By building an independent reference management daemon and a two-dimensional B+ tree index structure in the gateway device, the problem of inconsistent management of policy object reference relationships in the existing technology is solved, and efficient operation and maintenance and reverse tracing capabilities are achieved.

CN123123166APending Publication Date: 2026-11-17BEIJING ANBOTONG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611311500.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

The existing gateway devices lack a globally unified management mechanism for policy object references, resulting in low operational efficiency, an inability to quickly query which policies are associated with and which policies are invoked by an object, and insufficient reverse tracing capabilities.

Method used

A reference management daemon is built that is independent of the business process. A two-dimensional B+ tree index structure is used to uniformly manage the reference relationship between the strategy and the object. The reference management daemon responds to binding, addressing and tracing requests to achieve centralized control and reverse tracing of reference relationships.

Benefits of technology

It achieves global unified management of policy object references, improves operational efficiency, provides native reverse tracing capabilities, and solves the management difficulties caused by scattered storage of reference relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123166A_ABST
    Figure CN123123166A_ABST
Patent Text Reader

Abstract

This invention relates to a method, apparatus, and electronic device for managing policy object references in a gateway device, belonging to the field of gateway configuration management technology. The method includes: constructing a reference management daemon process independent of business processes in the gateway device; in response to a reference binding request, registering the reference relationship between policy ID and object ID to the leaf node of the B+ tree index structure and recording a reverse reference list to complete unified registration and global control; in response to an object addressing request, locating the target leaf node based on a combination key and returning the object pointer to complete unified addressing management; and in response to a reverse tracing query request, locating the reference node based on the object identifier, reading the associated policy list, and outputting policy information to complete reverse tracing management. Using this invention enables centralized and unified management of policy object references in a gateway device, provides native reverse tracing capabilities, and improves gateway operation and maintenance efficiency and configuration security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of gateway configuration management technology, and in particular to a method, apparatus, and electronic device for managing policy object references in a gateway device. Background Technology

[0002] The policy object reference mechanism of current mainstream gateway devices (such as firewalls, internet access management systems, and security gateways) generally adopts a tightly coupled architecture where policies directly reference object memory pointers. Business policies directly address, call, and verify corresponding object resources through pointers. The policy instance and object instance are directly associated point-to-point, and the reference relationships are scattered and stored within each policy, without unified global management and lacking reverse tracing capabilities.

[0003] In this architecture, business objects are only referenced unidirectionally by policies through memory pointers, with no reverse reference records for the objects themselves. When querying which policies reference a particular object, it's necessary to traverse all policies one by one, resulting in extremely low efficiency. Furthermore, reference relationships are scattered throughout each policy, lacking a globally unified reference relationship management mechanism. As the number of policies or objects grows, operations personnel cannot grasp the full picture of reference relationships from a global view, and configuration changes and troubleshooting rely on manual verification of each item. With the continuous expansion of the gateway's business domain and the sustained growth in the size of policies and objects, these problems have become the core bottleneck restricting gateway operation and maintenance efficiency and configuration stability. Summary of the Invention

[0004] In view of this, it is necessary to provide a method, device and electronic device for managing policy object references in gateway devices, so as to solve the technical problems in the prior art where business objects are only referenced by policies in one direction without reverse reference records, there is no unified global reference relationship management, and there is no ability to quickly query which policies a single object is associated with and call without native tracing capabilities.

[0005] To address the aforementioned problems, in a first aspect, the present invention provides a method for managing policy object references in a gateway device, comprising: A reference management daemon process, independent of the business process, is built in the gateway device. The reference management daemon process contains a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. In response to a reference binding request initiated by a business process, the reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf node of the B+ tree index structure, and records the list of reverse references associated with the strategy ID in the leaf node, thereby completing the unified registration and global management of the reference relationship. In response to an object addressing request initiated by a business process, the reference management daemon locates the target leaf node based on the composite key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls. In response to a reverse tracing query request initiated by the operation and maintenance system, the reference management daemon locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships.

[0006] In one possible implementation, the two-dimensional B+ tree index structure includes a first dimension and a second-level dimension, where the first-level dimension is the object type dimension and the second-level dimension is a combination dimension of strategy type and object identifier. The construction process of the two-dimensional B+ tree index structure includes: Using object type as the first-level partitioning basis, each object type corresponds to an independent B+ tree, which physically isolates objects of different categories and completes the construction of the first-level dimension. In each B+ tree, a B+ tree index is constructed using the combination of strategy type and object identifier as the sort key to complete the construction of the second-level dimension. The strategy type is the high-order sorting field, and the object identifier is the low-order sorting field. All object nodes under the same strategy type are stored continuously in the leaf nodes of the B+ tree. Each leaf node stores reference node data including at least the object's unique ID, managed object pointer, atomic reference count, dynamic array list of association strategy IDs, and object lifecycle state. All leaf nodes are linked together by a doubly linked list.

[0007] In one possible implementation, the communication between the reference management daemon and the business process adopts a dual-path design, including a Unix domain socket path and a shared memory path. The Unix domain socket path is used to carry reference binding, unbinding, deletion, and tracing operations, and adopts a request-response mode; The shared memory path is used to carry high-frequency forward object addressing requests, mapping the core fields of hot reference nodes to the shared memory area for direct reading by business processes. The shared memory uses read-write locks for concurrency control. Write operations are uniformly executed by the reference management daemon process and synchronously update the shared memory. Inter-process communication carries a verification identifier to prevent unauthorized tampering with reference data.

[0008] In one possible implementation, the reference binding request includes a strategy ID, a strategy type, a target object ID, and an object type. The reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf nodes of the B+ tree index structure, and records a list of inverse references associated with the strategy ID in the leaf nodes, thus completing unified registration and global management of the reference relationship. This includes: The reference management daemon matches the first-level partition array according to the object type, locates the corresponding B+ tree, and retrieves the target leaf node in the B+ tree using the combination key of the strategy type and the object ID. If the target leaf node does not exist, a B+ tree insertion operation is performed to create a new leaf node, and the object pointer, reference count, and strategy list are initialized. After confirming the existence of the target leaf node, the current policy ID is appended to the inverse reference list of the leaf node, and an atomic increment operation is performed on the reference count; The reference management daemon returns the reference index key to the business process, thereby completing the unified registration and global control of reference relationships. The business process only stores the reference index key.

[0009] In one possible implementation, the method further includes: The business process accesses the shared memory area for address lookup; If a shared memory hit occurs and the node status is normal, the managed object pointer is read to complete the local addressing. If a shared memory miss occurs, the business process initiates a formal addressing request to the reference management daemon through a Unix domain socket. The reference management daemon locates the target leaf node based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls.

[0010] In one possible implementation, the reverse tracing query request includes the business object ID to be queried and the corresponding object type. The step of locating the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried by the reference management daemon, reading the list of association strategies stored in the reference node, and outputting the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships, includes: The reference management daemon locates the corresponding B+ tree based on the object identifier of the object to be queried using the first-level index, and locates the corresponding reference node in the B+ tree using the ID of the object to be queried as the key. The reference node is the leaf node of the B+ tree index structure. Read the list of associated strategies stored in the reference node, obtain the full policy IDs referencing the object to be queried, and output the policy information referencing the object to be queried, thus completing the reverse source management of the reference relationship.

[0011] In one possible implementation, the method further includes: In response to an object deletion command, the reference management daemon obtains a full list of business strategies for the referenced objects based on the reverse reference list. Send a dereference notification to each business process in the full business policy list and synchronously clear the corresponding reference index stored in the policy layer; After all association strategies are unbound, the reference count of the corresponding leaf node is cleared to zero, and the object's memory resources are safely released after verifying that the reference count is zero. At the same time, the B+ tree node deletion operation is performed to complete the full-link dereference before the object is deleted.

[0012] In one possible implementation, the method further includes: In response to a policy cancellation request, the current policy ID is removed from the inverse reference list of the corresponding leaf node through the reference management daemon, and an atomic decrement operation is performed on the reference count. When the reference count decreases to zero, the corresponding object node is marked as idle, and the object resource reclamation or destruction process is triggered according to the system scheduling policy.

[0013] Secondly, the present invention also provides a management device for policy object references in a gateway device, comprising: The index building module is used to build a reference management daemon process that is independent of the business process in the gateway device. The reference management daemon process contains a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. The reference registration module is used to respond to reference binding requests initiated by business processes. Through the reference management daemon, the reference relationship between strategy ID and object ID is registered to the leaf node of the B+ tree index structure, and the list of reverse references associated with the strategy ID is recorded in the leaf node, so as to complete the unified registration and global management of reference relationships. The object addressing module is used to respond to object addressing requests initiated by business processes. It locates the target leaf node through the reference management daemon based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls. The reverse tracing module is used to respond to reverse tracing query requests initiated by the operation and maintenance system. Through the reference management daemon process, it locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships.

[0014] Thirdly, the present invention also provides an electronic device, including a data receiver, a memory, and a processor, wherein the data receiver is used to receive requests sent by a business process or an operation and maintenance system; The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the management method of policy object references in the gateway device described in any of the above implementations.

[0015] The beneficial effects of this invention are as follows: The method for managing policy object references in gateway devices provided by this invention constructs a reference management daemon process independent of business processes. This daemon process centrally manages all reference relationships in an independent process, achieving unified global control over reference relationships and solving the problem of scattered storage of reference relationships within each policy, leading to an inability to manage them globally. By adopting a two-dimensional B+ tree index structure, with object type as the first-level partition and the combination key of policy type and object ID as the second-level sort, it combines partition isolation with ordered retrieval capabilities, achieving a stable query performance of O(log n). By embedding a backreference list in each leaf node, it enables a native reverse tracing capability for one-click querying of all associated policies from any business object, solving the problems of objects lacking backreference records and the inability to quickly query which policies are associated with an object, significantly improving operational efficiency. Therefore, it successfully solves the technical problems of existing technologies such as business objects lacking backreference records, lacking unified global reference relationship management, and lacking native tracing capabilities, achieving centralized and unified management and efficient operation and maintenance of policy object references in gateway devices. Attached Figure Description

[0016] Figure 1 A flowchart illustrating an embodiment of a method for managing policy object references in a gateway device provided by the present invention; Figure 2 for Figure 1 A flowchart of a method according to an embodiment of step S101; Figure 3 for Figure 1 A flowchart of a method according to an embodiment of step S102; Figure 4 This is a functional block diagram of the management device for policy object references in the gateway device provided by the present invention; Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0018] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0019] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0020] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0021] This invention provides a method, apparatus, and electronic device for managing policy object references in a gateway device, which will be described below.

[0022] Figure 1 This is a flowchart illustrating an embodiment of the method for managing policy object references in a gateway device provided by the present invention. The execution subject of the method for managing policy object references in a gateway device can be a computer, a portable smart device, or a cloud server, etc. The specific execution subject is the storage medium in the computer, but this embodiment does not limit it.

[0023] like Figure 1 As shown, the management methods for policy object references in the gateway device include: S101. Build a reference management daemon process in the gateway device that is independent of the business process.

[0024] It should be noted that this embodiment, based on the three-layer logical decoupling core mechanism of "strategy layer - reference management layer - business object layer", adopts an independent user-space daemon process deployment and uses a two-dimensional composite key B+ tree as the core index storage structure to achieve centralized management, bidirectional querying, secure destruction, and fault isolation of reference relationships. The reference management module is an independent process dedicated to maintaining reference data and communicates with the business process through a dual-pathway of "shared memory + Unix domain sockets". The index adopts a two-dimensional architecture of "object type first-level partition and strategy type + object ID composite key B+ tree", which has both partition isolation and ordered retrieval capabilities.

[0025] The system architecture in this embodiment comprises three layers: a strategy layer, a reference management layer, and a business object layer. The strategy layer contains various business strategy instances; it only stores reference index keys and does not hold pointers to the original objects. The reference management layer contains a reference management daemon (refmgrd), which is independently deployed as a daemon and is dedicated to storing, verifying, updating, and querying all reference relationships. The business object layer contains various business object resources (address groups, user groups, application characteristics, time periods, etc.). The reference management daemon and the business processes interact through a dual-path communication mechanism, including a Unix domain socket path and a shared memory path.

[0026] In some embodiments of the present invention, reference is made to... Figure 2 As shown, the construction process of a two-dimensional B+ tree index structure includes: S201. Using object type as the first-level partitioning basis, each object type corresponds to an independent B+ tree, physically isolating objects of different categories, thus completing the construction of the first-level dimension.

[0027] S202. In each B+ tree, a B+ tree index is constructed using the combination of strategy type and object identifier as the sorting key to complete the construction of the second-level dimension. The strategy type is the high-order sorting field, and the object identifier is the low-order sorting field. All object nodes under the same strategy type are stored continuously in the leaf nodes of the B+ tree.

[0028] It should be noted that the described two-dimensional B+ tree index structure includes a first-level dimension and a second-level dimension. The first-level dimension uses the object type enumeration OBJ_TYPE as the partitioning basis and employs a static array to implement the first-level index. The array length covers all business object categories, including address groups, user groups, application characteristics, and time periods. Each array member corresponds to an independent B+ tree, achieving physical isolation between different object categories. In the second-level dimension, a B+ tree is constructed within each object type partition, using [POLICY_TYPE (policy type enumeration) + object unique ID] as the combined sorting key. The policy type is the high-order sorting field, and the object ID is the low-order sorting field. All object nodes under the same policy type are stored contiguously in the leaf nodes of the B+ tree.

[0029] In the B+ tree node structure, non-leaf nodes only store the composite key index value and child node pointers, without storing complete reference data. This is used for fast routing and location, reducing memory usage. The B+ tree order is set to 128 to ensure that the tree height does not exceed 3 levels even with hundreds of thousands of objects, resulting in short query paths and stable performance. Leaf nodes store complete reference node data, with core fields including: unique object ID, managed object pointer obj_ptr, atomic reference count ref_count, dynamic array list of association policy IDs policy_list, and object lifecycle status status. All leaf nodes are linked together by a doubly linked list, supporting forward and reverse range traversal.

[0030] It should be noted that the core operations and performance optimization mechanisms of B+ trees are as follows: Insertion and deletion self-balancing: When inserting a new reference node, the corresponding leaf node is located by pressing the combination key. When the node data volume reaches the order threshold, node splitting is triggered. When the data volume after deleting a node is lower than the threshold, node merging is triggered. The self-balancing characteristic of B+ tree is maintained throughout the process, ensuring that the query performance is stable at O ​​(logn).

[0031] Dual-mode query mechanism: For exact queries, the B+ tree is located through the first-level partition array, and then the target leaf node is routed layer by layer from the root node through the combination key; for range queries, after locating the leaf node corresponding to the starting key, the doubly linked list can be traversed sequentially without repeatedly backtracking the parent node, resulting in excellent efficiency for batch operations.

[0032] Hotspot caching mechanism: Frequently accessed reference node data is cached in shared memory and updated asynchronously by the refmgrd process. When the business process makes a forward query, it first accesses the shared memory. If a match is found, it returns directly. If a match is not found, a full query is then initiated to refmgrd via the socket.

[0033] Persistence support: The continuous storage feature of B+ leaf nodes is naturally adapted to disk persistence. Periodically, snapshots of reference relationships are written to disk, and the index can be directly loaded and rebuilt when the device restarts without the need for full rebinding, which greatly improves fault recovery efficiency.

[0034] In some embodiments, the communication between the reference management daemon and the business process adopts a dual-path design, including a Unix domain socket path and a shared memory path. The Unix domain socket path is used to carry reference binding, unbinding, deletion, and tracing operations, and adopts a request-response mode. The shared memory path is used to carry high-frequency forward object addressing requests, mapping the core fields of hot reference nodes to the shared memory area for direct reading by the business process. The shared memory uses read-write locks for concurrency control. Write operations are uniformly executed by the reference management daemon and synchronously update the shared memory. Inter-process communication carries a verification identifier to prevent unauthorized tampering with reference data.

[0035] S102. In response to the reference binding request initiated by the business process, the reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf node of the B+ tree index structure, and records the list of reverse references associated with the strategy ID in the leaf node, thereby completing the unified registration and global management of the reference relationship.

[0036] It should be noted that in this embodiment, the registration of the reference relationship between the policy and the object is completed, and the forward index and reverse reference records are written synchronously to ensure that the reference data is globally unique and trustworthy. After the policy layer in the business process creates the business policy and configures the target business object ID, it sends a reference binding request to the refmgrd process through the Unix domain socket. The request carries four core parameters: policy ID, policy type, target object ID, and object type.

[0037] In some embodiments of the present invention, reference is made to... Figure 3 As shown, step S102 includes: S301. The reference management daemon matches the first-level partition array according to the object type, locates the corresponding B+ tree, and retrieves the target leaf node in the B+ tree using the combination key of the strategy type and the object ID.

[0038] S302. If the target leaf node does not exist, perform a B+ tree insertion operation to create a new leaf node and initialize the object pointer, reference count, and strategy list.

[0039] S303. After confirming the existence of the target leaf node, the current strategy ID is appended to the inverse reference list of the leaf node, and an atomic increment operation is performed on the reference count.

[0040] S304. The reference management daemon returns the reference index key to the business process to complete the unified registration and global control of the reference relationship. The business process only stores the reference index key.

[0041] It should be noted that the reference binding request includes the policy ID, policy type, target object ID, and object type. After receiving the request, the refmgrd process first matches the first-level partition array by object type to locate the corresponding B+ tree; then, using [policy type + object ID] as the key, it retrieves the target leaf node in the B+ tree. If the target node does not exist, a B+ tree insertion operation is performed: a new leaf node is created, a managed object memory pointer is entered, the reference count is initialized to 0, the status is marked as [normal], and an empty policy list (policy_list) is initialized; if node splitting is triggered during the insertion process, self-balancing adjustment is performed synchronously. After the node is confirmed to exist, the current policy ID is appended to the end of the policy_list of that node, completing the writing of the reverse reference relationship; at the same time, an atomic increment operation is performed on the reference count (ref_count) to ensure accurate statistics in concurrent scenarios. The refmgrd process synchronously updates the corresponding node data in shared memory (if it is a hot node), and then returns a binding success identifier and reference index key to the business process. The strategy layer only retains reference index keys and does not persist object native pointers. The sole data source for all reference relationships is concentrated in the B+ tree of the refmgrd process.

[0042] S103. In response to an object addressing request initiated by a business process, the reference management daemon locates the target leaf node based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls.

[0043] In this embodiment, the business process accesses the shared memory area for address lookup. If the shared memory is hit and the node status is normal, the managed object pointer is read to complete the local address lookup. If the shared memory is not hit, the business process initiates a formal address lookup request to the reference management daemon through a Unix domain socket. The reference management daemon locates the target leaf node based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified address management of object resource calls.

[0044] Specifically, in this embodiment, to ensure the normal invocation of object resources by business strategies, addressing is performed entirely through independent processes and shared memory forwarding, maintaining the decoupled architecture between strategies and objects while ensuring forwarding performance. When a business strategy needs to invoke target object resources during execution, the strategy layer prioritizes carrying the reference index key to access the shared memory area for address lookup. If the shared memory is hit and the node status is [normal], the managed object pointer is read directly to complete local addressing with zero inter-process communication overhead. If the shared memory is not hit, a formal addressing request is initiated to the refmgrd process via a Unix domain socket, carrying the strategy ID, strategy type, object ID, and object type. The refmgrd process quickly locates the leaf nodes of the B+ tree using the first-level partition and the combination key. After verifying the node status and reference count, it returns the object pointer and core node information to the business process, while asynchronously updating the shared memory cache. The strategy layer completes resource invocation through temporary pointer objects, releases the temporary pointers after the invocation, and never persists the object pointers. All addressing relies on the unified management of the refmgrd process.

[0045] S104. In response to the reverse tracing query request initiated by the operation and maintenance system, the reference management daemon locates the corresponding reference node in the two-dimensional B+ tree index structure according to the object identifier of the object to be queried, reads the association strategy list stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of the reference relationship.

[0046] In this embodiment, based on the ordered indexing capability of B+ trees, one-click tracing of a single object and batch tracing of multiple objects are achieved without traversing the entire strategy pool. The reverse tracing query request includes the business object ID to be queried and the corresponding object type.

[0047] In some embodiments, the step of locating the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried by the reference management daemon, reading the association strategy list stored in the reference node, and outputting the strategy information referencing the object to be queried, thereby completing the reverse tracing management of reference relationships, includes: The reference management daemon locates the corresponding B+ tree based on the object identifier of the object to be queried using the first-level index, and locates the corresponding reference node in the B+ tree using the ID of the object to be queried as the key. The reference node is the leaf node of the B+ tree index structure. Read the list of associated strategies stored in the reference node, obtain the full policy IDs referencing the object to be queried, and output the policy information referencing the object to be queried, thus completing the reverse source management of the reference relationship.

[0048] Specifically, the operations and maintenance system or management process sends a reverse tracing query request to the refmgrd process via a Unix domain socket, carrying the business object ID to be queried and its corresponding object type. For batch range queries, the start and end values ​​of the object ID can be included. The refmgrd process locates the corresponding B+ tree using the first-level index OBJ_TYPE and leverages the prefix characteristics of the B+ tree composite key to sequentially match the target object nodes under each policy type, without requiring a full tree scan. After accurately matching the leaf nodes of each partition, it directly reads the policy_list field built into the node to obtain all policy IDs referencing the object under the corresponding policy type, while also reading auxiliary information such as reference counts and status. For batch range queries, it sequentially traverses the doubly linked list of leaf nodes to read the reference data of all objects within the range at once. It summarizes the associated policy information of the object (or object range) under all policy type partitions and outputs a complete tracing result including all policy IDs, corresponding policy types, and total reference counts.

[0049] In some embodiments, the method further includes an object deletion security control process, including: In response to an object deletion command, the reference management daemon obtains a full list of business strategies for the referenced objects based on the reverse reference list. Send a dereference notification to each business process in the full business policy list and synchronously clear the corresponding reference index stored in the policy layer; After all association strategies are unbound, the reference count of the corresponding leaf node is cleared to zero, and the object's memory resources are safely released after verifying that the reference count is zero. At the same time, the B+ tree node deletion operation is performed to complete the full-link dereference before the object is deleted.

[0050] It should be noted that this embodiment achieves risk-free object destruction based on source tracing capabilities, eliminating dangling pointers and memory leaks at the source, with the entire process uniformly scheduled by an independent process. The system initiates a business object deletion command, carrying the unique ID and object type of the object to be deleted, and sends it to the refmgrd process via a Unix domain socket. The refmgrd process locates the B+ tree through the first-level partition, traverses all policy type leaf nodes corresponding to the object ID, summarizes all policy_lists, and obtains a list of all business policies referencing the object. The refmgrd process sends dereference notifications to all business processes to which policies in the list belong in batches, and synchronously clears the corresponding reference indexes stored in the policy layer, achieving synchronous unbinding of the entire link reference relationship. After all associated policies are unbound, the reference count of the corresponding leaf node is cleared to zero, and the status is marked as [pending destruction]. After the refmgrd process verifies that the reference count is zero and the status is valid, it notifies the object management process to safely release the object's memory resources; then it performs a B+ tree node deletion operation, removes the corresponding leaf node, triggers node merging if necessary to maintain tree balance, and simultaneously clears cached data in shared memory, completing the risk-free full-link deletion of the object.

[0051] In some embodiments, the method further includes a policy deregistration lifecycle management process, including: In response to a policy cancellation request, the current policy ID is removed from the inverse reference list of the corresponding leaf node through the reference management daemon, and an atomic decrement operation is performed on the reference count. When the reference count decreases to zero, the corresponding object node is marked as idle, and the object resource reclamation or destruction process is triggered according to the system scheduling policy.

[0052] It should be noted that this step synchronously updates the backreference data when the policy lifecycle changes, ensuring the real-time accuracy of the traceability data, and dynamically manages the object lifecycle through reference counting. When a policy is deleted or its configuration changes require the object reference to be released, the policy layer within the business process submits a deregistration request to the refmgrd process via a Unix domain socket, carrying the policy ID, policy type, and the ID and type information of the associated object. The refmgrd process locates the first-level partition based on the object type, locates the leaf node of the B+ tree using the [policy type + object ID] combination key, removes the current policy ID from the node's policy_list, and synchronously updates the backreference list. An atomic decrement operation is performed on the reference count ref_count; when the reference count decreases to 0, the state of the object node is marked as [idle], indicating that no policy currently references the object. The node state in shared memory is synchronously updated; for object nodes marked as [idle], the refmgrd process can trigger the object resource reclamation or destruction process according to the system scheduling policy, realizing automated and efficient resource scheduling.

[0053] This invention implements a reference management daemon process independent of business processes within the gateway device. This daemon process includes a two-dimensional B+ tree index structure for unified management of reference relationships between policies and objects. In response to reference binding requests, it registers the reference relationship between policy IDs and object IDs to the leaf nodes of the B+ tree index structure and records a list of backreferences, completing unified registration and global control. In response to object addressing requests, it locates the target leaf node based on a combination key and returns the object pointer, completing unified addressing management. In response to reverse tracing query requests, it locates the reference node based on the object identifier, reads the associated policy list, and outputs the policy information, completing reverse tracing management. This invention enables centralized and unified management of policy object references within the gateway device, provides native reverse tracing capabilities, and improves gateway operation and maintenance efficiency and configuration security.

[0054] Based on the same idea as the policy object reference management method in the gateway device in the above embodiments, this application also provides a policy object reference management device 400 in a gateway device, which can be used to execute the above-described method. For example... Figure 4 As shown, the policy object reference management device 400 in the gateway device specifically includes an index building module 401, a reference registration module 402, an object addressing module 403, and a reverse tracing module 404. In some embodiments, the above modules can be programmable software instructions stored in memory and executable by a processor. It is understood that in other embodiments, the above modules can also be program instructions or firmware embedded in the processor.

[0055] The index building module 401 is used to build a reference management daemon process independent of the business process in the gateway device. The reference management daemon process includes a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. The reference registration module 402 is used to respond to the reference binding request initiated by the business process, register the reference relationship between the strategy ID and the object ID to the leaf node of the B+ tree index structure through the reference management daemon, and record the list of reverse references associated with the strategy ID in the leaf node, so as to complete the unified registration and global management of the reference relationship. The object addressing module 403 is used to respond to the object addressing request initiated by the business process, locate the target leaf node through the reference management daemon based on the combination key of the B+ tree index structure, and return the corresponding object pointer to complete the unified addressing management of object resource calls; The reverse tracing module 404 is used to respond to the reverse tracing query request initiated by the operation and maintenance system. Through the reference management daemon process, it locates the corresponding reference node in the two-dimensional B+ tree index structure according to the object identifier of the object to be queried, reads the association strategy list stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of the reference relationship.

[0056] Please refer to Figure 5 , Figure 5 This is a schematic diagram of an embodiment of the electronic device of this application. In this embodiment of the invention, the electronic device 500 includes a processor 501, a memory 502, a display 503, and a data receiver 504. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0057] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 502 or process data, such as the management method of policy object references in the gateway device of the present invention.

[0058] In some embodiments, display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 503 is used to display information from electronic device 500 and to display visual user applications. Components 501-503 of electronic device 500 communicate with each other via a system bus.

[0059] Data receiver 503 is used to receive requests sent by business processes or operation and maintenance systems, including reference binding requests, object addressing requests, reverse tracing query requests, object deletion instructions, policy deregistration requests, etc. Components 501-504 of electronic device 500 communicate with each other via the system bus.

[0060] In one embodiment, when processor 501 executes the management program referenced by the policy object in the gateway device in memory 502, the following steps may be implemented: A reference management daemon process, independent of the business process, is built in the gateway device. The reference management daemon process contains a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. In response to a reference binding request initiated by a business process, the reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf node of the B+ tree index structure, and records the list of reverse references associated with the strategy ID in the leaf node, thereby completing the unified registration and global management of the reference relationship. In response to an object addressing request initiated by a business process, the reference management daemon locates the target leaf node based on the composite key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls. In response to a reverse tracing query request initiated by the operation and maintenance system, the reference management daemon locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships.

[0061] It should be understood that when the processor 501 executes the management program referenced by the policy object in the gateway device in the memory 502, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.

[0062] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 500 mentioned. Electronic device 500 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 500 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0063] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0064] The above provides a detailed description of the management method, apparatus, and electronic device for policy object references in the gateway device provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method of managing a reference to a policy object in a gateway device, characterized by, include: A reference management daemon process, independent of the business process, is built in the gateway device. The reference management daemon process contains a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. In response to a reference binding request initiated by a business process, the reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf node of the B+ tree index structure, and records the list of reverse references associated with the strategy ID in the leaf node, thereby completing the unified registration and global management of the reference relationship. In response to an object addressing request initiated by a business process, the reference management daemon locates the target leaf node based on the composite key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls. In response to a reverse tracing query request initiated by the operation and maintenance system, the reference management daemon locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships.

2. The method for managing policy object references in a gateway device according to claim 1, characterized in that, The two-dimensional B+ tree index structure includes a first dimension and a second-level dimension. The first-level dimension is the object type dimension, and the second-level dimension is the combination dimension of strategy type and object identifier. The construction process of the two-dimensional B+ tree index structure includes: Using object type as the first-level partitioning basis, each object type corresponds to an independent B+ tree, which physically isolates objects of different categories and completes the construction of the first-level dimension. In each B+ tree, a B+ tree index is constructed using the combination of strategy type and object identifier as the sort key to complete the construction of the second-level dimension. The strategy type is the high-order sorting field, and the object identifier is the low-order sorting field. All object nodes under the same strategy type are stored continuously in the leaf nodes of the B+ tree. Each leaf node stores reference node data including at least the object's unique ID, managed object pointer, atomic reference count, dynamic array list of association strategy IDs, and object lifecycle state. All leaf nodes are linked together by a doubly linked list.

3. The method for managing policy object references in a gateway device according to claim 1, characterized in that, The communication between the reference management daemon and the business process adopts a dual-path design, including a Unix domain socket path and a shared memory path; The Unix domain socket path is used to carry reference binding, unbinding, deletion, and tracing operations, and adopts a request-response mode; The shared memory path is used to carry high-frequency forward object addressing requests, mapping the core fields of hot reference nodes to the shared memory area for direct reading by business processes. The shared memory uses read-write locks for concurrency control. Write operations are uniformly executed by the reference management daemon process and synchronously update the shared memory. Inter-process communication carries a verification identifier to prevent unauthorized tampering with reference data.

4. The method of claim 1, wherein the gateway device management method is characterized by: The reference binding request includes a strategy ID, a strategy type, a target object ID, and an object type. The reference management daemon registers the reference relationship between the strategy ID and the object ID to the leaf nodes of the B+ tree index structure, and records a list of inverse references associated with the strategy ID in the leaf nodes, thus completing unified registration and global management of the reference relationship. This includes: The reference management daemon matches the first-level partition array according to the object type, locates the corresponding B+ tree, and retrieves the target leaf node in the B+ tree using the combination key of the strategy type and the object ID. If the target leaf node does not exist, a B+ tree insertion operation is performed to create a new leaf node, and the object pointer, reference count, and strategy list are initialized. After confirming the existence of the target leaf node, the current policy ID is appended to the inverse reference list of the leaf node, and an atomic increment operation is performed on the reference count; The reference management daemon returns the reference index key to the business process, thereby completing the unified registration and global control of reference relationships. The business process only stores the reference index key.

5. The method of claim 1, wherein the gateway device management method is characterized by: The method further includes: The business process accesses the shared memory area for address lookup; If a shared memory hit occurs and the node status is normal, the managed object pointer is read to complete the local addressing. If a shared memory miss occurs, the business process initiates a formal addressing request to the reference management daemon through a Unix domain socket. The reference management daemon locates the target leaf node based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls.

6. The method of claim 1, wherein the gateway device management method is characterized by: The reverse tracing query request includes the business object ID to be queried and the corresponding object type. The reference management daemon locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships. This includes: The reference management daemon locates the corresponding B+ tree based on the object identifier of the object to be queried using the first-level index, and locates the corresponding reference node in the B+ tree using the ID of the object to be queried as the key. The reference node is the leaf node of the B+ tree index structure. Read the list of associated strategies stored in the reference node, obtain the full policy IDs referencing the object to be queried, and output the policy information referencing the object to be queried, thus completing the reverse source management of the reference relationship.

7. The method of claim 1, wherein the gateway device management method is characterized by: The method further includes: In response to an object deletion command, the reference management daemon obtains a full list of business strategies for the referenced objects based on the reverse reference list. Send a dereference notification to each business process in the full business policy list and synchronously clear the corresponding reference index stored in the policy layer; After all association strategies are unbound, the reference count of the corresponding leaf node is cleared to zero, and the object's memory resources are safely released after verifying that the reference count is zero. At the same time, the B+ tree node deletion operation is performed to complete the full-link dereference before the object is deleted.

8. The method of claim 1, wherein the gateway device manages references to policy objects in the device. The method further includes: In response to a policy cancellation request, the current policy ID is removed from the inverse reference list of the corresponding leaf node through the reference management daemon, and an atomic decrement operation is performed on the reference count. When the reference count decreases to zero, the corresponding object node is marked as idle, and the object resource reclamation or destruction process is triggered according to the system scheduling policy.

9. A management device for policy object references in a gateway device, characterized in that, include: The index building module is used to build a reference management daemon process that is independent of the business process in the gateway device. The reference management daemon process contains a two-dimensional B+ tree index structure for unified management of the reference relationship between policies and objects. The reference registration module is used to respond to reference binding requests initiated by business processes. Through the reference management daemon, the reference relationship between strategy ID and object ID is registered to the leaf node of the B+ tree index structure, and the list of reverse references associated with the strategy ID is recorded in the leaf node, so as to complete the unified registration and global management of reference relationships. The object addressing module is used to respond to object addressing requests initiated by business processes. It locates the target leaf node through the reference management daemon based on the combination key of the B+ tree index structure and returns the corresponding object pointer, thus completing the unified addressing management of object resource calls. The reverse tracing module is used to respond to reverse tracing query requests initiated by the operation and maintenance system. Through the reference management daemon process, it locates the corresponding reference node in the two-dimensional B+ tree index structure based on the object identifier of the object to be queried, reads the list of association strategies stored in the reference node, and outputs the strategy information referencing the object to be queried, thus completing the reverse tracing management of reference relationships.

10. An electronic device, comprising: It includes a data receiver, a memory, and a processor, wherein the data receiver is used to receive requests sent by business processes or operation and maintenance systems; The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the management method for policy object references in the gateway device according to any one of claims 1 to 8.