Archiving methods, apparatus and electronic equipment
By constructing a directed acyclic graph and generating a hash value of the current state, the problems of data tamper-proofing and query efficiency in engineering parameter update archiving are solved, realizing a data archiving method with high security and high performance.
Patent Information
- Application Number
- CN202611112003.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies struggle to achieve secure, tamper-proof, and efficient data retrieval in engineering projects, especially when updating and archiving engineering parameters. Existing systems cannot effectively identify unauthorized overwriting and lack cryptographic verification mechanisms, resulting in insufficient data security and query response performance.
By constructing an abstract syntax tree and folding it into a directed acyclic graph, normalized strings and current state hash values are generated. One-way hashing is performed using timestamps and random salt values to generate graph update instructions, which are then archived in the graph database. Optimistic concurrency control and atomic pointer swapping mechanisms are used to ensure data consistency and tamper-proofing.
It achieves robust anti-tampering verification and end-to-end auditing for engineering parameter archiving, improving data security and query response performance, and reducing memory usage and query addressing latency.
Smart Images

Figure CN123115471A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of engineering digitization and data storage technology, specifically to archiving methods, apparatus, and electronic devices. Background Technology
[0002] With the digital transformation of the engineering and infrastructure industry, business approvals and design parameter archiving are gradually shifting from traditional document management to structured data management. Engineering projects contain a large number of interdependent calculation parameters, and existing systems often use graph database technology for relational storage.
[0003] Existing technologies for tracing historical versions of parameters often employ relational join queries or traversing graph nodes step by step, resulting in significant addressing latency. Furthermore, conventional methods of recording historical versions struggle to establish a complete cryptographic verification mechanism at the physical storage level. If underlying data files are overwritten without authorization, the system often cannot promptly identify the violation through effective verification logic, failing to meet the data security and tamper-proof requirements of engineering archives. Summary of the Invention
[0004] This invention provides an archiving method to solve the problem of preventing tampering when updating and archiving engineering parameters.
[0005] In a first aspect, the present invention provides an archiving method, the method comprising: Construct an abstract syntax tree based on the engineering parameter update instructions, and calculate the target parameter value of the engineering parameter update instructions; The abstract syntax tree is folded down to a directed acyclic graph (DAG), and the DAG is serialized to obtain a normalized string. Extract the preceding hash value of the engineering parameter update instruction, concatenate the normalized string, the preceding hash value, the timestamp, and the random salt value, and perform a one-way hash operation to generate the current state hash value. Encapsulate the current state hash value into a graph update instruction, wherein the random salt value is obtained by pre-setting. Write the target parameter value, timestamp, random salt value, and current state hash value into the target parameter master node as indicated by the graph update command for archiving.
[0006] In one alternative implementation, serializing the directed acyclic graph to output a normalized string includes: A bottom-up hierarchical reduction strategy is adopted to perform post-order traversal of the directed acyclic graph, and a memoized cache dictionary is built during the traversal process; When traversing a directed acyclic graph, check if the node identifier of the traversed node matches the memoized cache dictionary. If it matches, directly extract the generated substring. If it does not match, extract the current node attribute, recursively concatenate to generate a substring, and store the substring in the memoized cache dictionary with the node identifier as the key. The substrings of each node in the directed acyclic graph are concatenated layer by layer until the root node is reached. The concatenated string at the root node is the normalized string.
[0007] In one optional implementation, the normalized string, the predecessor hash value, the timestamp, and the random salt value are concatenated and a one-way hash operation is performed to generate the current state hash value, including: Extract the binary stream of the preceding hash value, normalized string, timestamp and random salt value, and concatenate the binary stream of the preceding hash value, normalized string, timestamp and random salt value in a preset order to construct the original message; A secure hash algorithm is used to perform a hash calculation on the original message to obtain the current state hash value.
[0008] In one optional implementation, the target parameter value, timestamp, random salt value, and current state hash value are written to the target parameter master node indicated by the graph update instruction for archiving, including: Locate the target parameter master node corresponding to the current input parameter set in the graph database indicated by the graph update command. Instantiate the historical lock entity node in the target parameter master node. Write the target parameter value, timestamp, random salt value and current state hash value into the historical lock entity node for archiving. The current input parameter set is obtained by parsing the engineering parameter update command.
[0009] In one optional implementation, after archiving the target parameter value, timestamp, random salt value, and current state hash value by writing them into the target parameter master node indicated by the graph update instruction, the method further includes: The version number of the master node for the target parameter is verified based on an optimistic concurrency control mechanism. Construct a data tracing path based on the directed dependency edges between historically locked entity nodes; Update the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node.
[0010] In one optional implementation, the version number verification of the target parameter master node is performed based on an optimistic concurrency control mechanism, including: Extract the expected version number carried during the archiving process, and compare and exchange the verification with the latest version number currently recorded in the target parameter master node; If the verification is consistent, the write operation is performed and the latest version number on the target parameter master node is incremented synchronously. If the verification is inconsistent, a preset adaptive retry mechanism is triggered. The waiting time is set through an exponential backoff algorithm. After the waiting period ends, the latest node status is retrieved again to calculate the expected version number and perform verification. This continues until the number of retries exceeds the preset retry threshold, at which point a concurrency conflict exception is thrown to the upper layer.
[0011] In one optional implementation, a data tracing path is constructed based on the directed dependency edge relationships between historically locked entity nodes, including: Perform loop detection between historically locked entity nodes; If a closed loop is detected, the construction of the data tracing path is terminated. If no closed loop is detected, a directed dependency edge indicating the data flow direction is created between the historically locked entity nodes based on the computational dependency relationship between them. Multiple historically locked entity nodes are then joined together to form a data tracing path through the directed dependency edge.
[0012] In one alternative implementation, updating the endpoint reference of the native shortcut edge on the target parameter master node to the most recently archived historical locked entity node includes: Extract the shortcut pointer of the target parameter master node, perform an atomic pointer swap on the shortcut pointer, and set the endpoint of the original shortcut edge to the address of the latest archived data. When a query request for the latest value of the parameter corresponding to the target parameter master node is received, the latest archived data of the current parameter is addressed along the reset native shortcut edge.
[0013] Secondly, this application provides an archiving apparatus for performing the archiving method described in the first aspect, comprising: The target parameter value calculation module is used to construct an abstract syntax tree based on the engineering parameter update instruction and calculate the target parameter value of the engineering parameter update instruction. The normalized string processing module is used to fold the abstract syntax tree into a directed acyclic graph (DAG), and then perform serialization processing on the DAG to obtain a normalized string. The current state hash value concatenation module extracts the preceding hash value of the engineering parameter update instruction, concatenates the normalized string, the preceding hash value, the timestamp, and the random salt value, and performs a one-way hash operation to generate the current state hash value. The current state hash value is then encapsulated into a graph update instruction, where the random salt value is obtained through a pre-set method. The archiving module writes the target parameter value, timestamp, random salt value, and current state hash value into the target parameter master node as indicated by the graph update command for archiving.
[0014] Thirdly, this application provides an electronic device, comprising: The memory and the processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the archiving method described in the first aspect by executing the computer instructions.
[0015] The present invention has at least the following beneficial effects: This invention provides an archiving method, apparatus, and electronic device that generates a current state hash value using a predecessor hash value, a normalized string, a timestamp, and a random salt value. By writing the target parameter value, timestamp, salt value, and state hash to a designated master node, a cryptographic fingerprint chain with preceding and following connections is formed, thereby providing a strong basis for tamper-proof verification and end-to-end auditing, significantly improving the security, consistency, and query response performance of data archiving in engineering approval scenarios.
[0016] This invention reduces the initial tree-like abstract syntax tree to a directed acyclic graph by folding it down. It reuses physical memory nodes using an operand stack and a joint hash key, and introduces a memoized cache dictionary during the serialization stage. This avoids the additional computation and storage overhead caused by the looping and unrolling of repeated common subexpressions. This mechanism effectively controls the system's memory usage when processing multi-level nested engineering formula calculations, preventing system anomalies due to excessive memory expansion.
[0017] This invention constructs a complete data verification closed loop by incorporating timestamps and random salt values into the concatenated concatenation operation of state hash values, and persisting the random salt value as a basic attribute during the physical disk write of the graph database. This method ensures the cryptographic reproducibility of node historical version state verification, enabling the system to identify any modifications to the underlying stored engineering data by recalculating the hash value, thereby improving the tamper-proof capability of archived engineering data.
[0018] After the transaction is persisted to disk, this invention calls an atomic pointer swap instruction to synchronously update the native shortcut edge on the parameter master node to the physical address of the latest historical locked entity node. This mechanism enables the system to skip conventional relational table joins and long-link graph traversals when processing the latest state query request, and directly locate the physical storage location of the target data with constant time complexity, reducing query addressing latency in related data scenarios. Attached Figure Description
[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the archiving method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structural framework of the archiving device according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structural framework of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0023] The archiving method of this invention can be executed by a terminal device, which may be a smartphone, tablet computer, laptop computer, handheld computer, desktop computer, game console, smart TV, smart wearable device, etc.
[0024] With the digital transformation of the engineering and infrastructure industry, business approvals and design parameter archiving are gradually shifting from traditional document management to structured data management. Engineering projects contain a large number of interdependent calculation parameters, and existing systems often use graph database technology for relational storage.
[0025] When processing logical calculations of parameters, existing systems typically parse them based on abstract syntax trees (ASTs). However, engineering calculation formulas often contain multiple levels of nested common sub-expressions. Traditional ASTs incur additional memory overhead when expanding these repetitive branches, which can easily lead to excessive system memory consumption when processing complex formulas.
[0026] In collaborative project approval processes, it is common for multiple professionals to concurrently modify the same parameter node. Existing storage mechanisms often rely on pessimistic locking to ensure concurrent consistency. This mechanism locks the target record during data updates, causing other concurrent requests to become blocked and limiting the overall write throughput of the system.
[0027] Furthermore, compliance review of engineering infrastructure data requires tamper-proof archiving and high-frequency traceability of historical parameter changes. Current technologies for tracing historical parameter versions often employ relational join queries or traversing graph nodes step-by-step, resulting in significant addressing latency. Simultaneously, conventional historical version recording methods struggle to establish a complete cryptographic verification mechanism at the physical storage level. If underlying data files are overwritten without authorization, the system often cannot promptly identify the violation through effective verification logic, failing to meet the data security and tamper-proof requirements of engineering archives.
[0028] To at least solve one of the above problems, this embodiment provides an archiving method, such as... Figure 1 As shown, the method includes: Step S101: Construct an abstract syntax tree based on the engineering parameter update instruction, and calculate the target parameter value of the engineering parameter update instruction; Specifically, before constructing the abstract syntax tree based on the engineering parameter update instructions and calculating the target parameter values of the engineering parameter update instructions, the archiving system performs three preprocessing stages: The first preprocessing stage involves receiving the project approval flow data corresponding to the current node, extracting project parameters from the data, deserializing these parameters according to a pre-defined global data dictionary to generate the current input parameter set, constructing the parameter master node corresponding to the input parameters, and establishing the basic anchor point structure for parameter status tracking. In this stage, the deserialization process of the project parameters according to the pre-defined global data dictionary mainly involves extracting the raw data and converting it into a standard format. This step is typically used to convert unstructured or semi-structured messages transmitted by the front-end system into memory key-value pair objects that can be directly scheduled for mathematical operations. In this embodiment, this is achieved through the following method: The system receives message data and invokes the parsing component to extract text fields from the message data. It further separates the parameter key name text, parameter value text, and additional unit text from the message, forming the original parameter tuple set. The specific software coding implementation for extracting discrete character segments from document text using regular expressions or Document Object Model tools can be accomplished by conventional string matching algorithms, which are well-known techniques in the field and will not be elaborated upon here. As a preferred implementation, if only parameter value text is extracted from a specific message field without extracting unit text, the parsing component will automatically assign a preset default unit null value identifier to that parameter to ensure the integrity of the internal data structure of the original parameter tuple set and avoid logical interruptions in subsequent parsing processes.
[0029] The global data dictionary, persistently maintained in its internal storage, is loaded into the runtime memory. The global data dictionary typically exhibits the characteristics of a hash table, internally recording standard parameter definitions within the scope of the engineering infrastructure business. Each standard parameter definition includes a globally unique identifier, a mandatory data type declaration, and a basic unit of measurement. The parameter key name text in the extracted raw parameter tuple set is matched against the key space of the global data dictionary to locate the corresponding standard parameter definition. Understandably, if the parameter key name text does not match in the global data dictionary, the abnormal parameter tuple is usually discarded, thus filtering out invalid and redundant data passed from the front end.
[0030] For parameter tuples successfully matched in the global data dictionary, a numerical type cast and unit normalization calculation are performed to generate standardized in-memory computation objects. Generally speaking, engineers from different disciplines or different front-end software often use different units of measurement to input data; for example, millimeters may be used when inputting structural dimensions, while the underlying formula library requires meters as the standard input. Failure to perform unit alignment at this stage will lead to incorrect output results in subsequent evaluations. Based on this principle, the j-th extracted original parameter tuple is defined as... ,in Represents the text of the original parameter key name. Represents the original parameter numerical text. Represents the original unit text.
[0031] Based on the global data dictionary Provided mapping functions Obtain the corresponding globally unique identifier. Dimensional conversion coefficient :
[0032] In the above formula, Specifically, it refers to a lookup set containing all valid engineering parameter key names and their corresponding base units. Mapping function. The specific implementation logic is as follows: the system uses To retrieve the base unit for this parameter from the index query, the base unit is then compared with the original unit text. The corresponding proportional multiple is output as the dimension conversion coefficient based on the internally preset physical dimension conversion table. Generally speaking, The range of values for is positive real numbers, if If the default unit is a null value identifier, then The default value is 1.0.
[0033] After obtaining the above parameters, the original parameter values are texted. Convert to floating-point or integer machine values and use the dimension conversion factor. Perform multiplication to obtain standard parameter values that eliminate dimensional differences. :
[0034] In the formula, Cast() represents the string to numeric type conversion function at the underlying programming language level.
[0035] A globally unique identifier that has completed all calculations Compared with standard parameter values Binding, organizing the current set of input parameters into a deterministic memory structure. This set represents a set of mapping relations in discrete mathematics:
[0036] In the formula, Represents the total number of valid engineering parameters retained after dictionary matching and validation filtering. Current input parameter set. After generation, it is cached in the working memory and used as the exact input boundary conditions for subsequent state tracing and abstract syntax tree evaluation.
[0037] After generating the current set of input parameters, parameter master nodes corresponding to the input parameters are constructed, establishing the basic anchor point structure for parameter state tracking. Since engineering infrastructure projects generally have long collaboration cycles, various parameters typically undergo multiple cross-disciplinary verifications and numerical corrections during this process. To maintain the continuity of the parameter evolution sequence in the graph structure, the system needs to separate the fixed addressing entry points from dynamically changing business values by constructing static basic anchor points. The specific construction process of this basic anchor point structure is as follows: Extract the current set of input parameters All globally unique identifiers within At this stage, the empty set detection logic will be executed beforehand. If the current input parameter set is determined... If the input is empty, it indicates that no valid parameters have been input for the current approval node. The corresponding graph database interaction process will be terminated directly, and memory resources for the current stage will be released. (In the input parameter set...) When it is in a non-empty state, the globally unique identifier will be identified. It is encapsulated as graph data query and creation commands. It obtains available connections in the internal network environment, initiates a session establishment request to the graph database, and opens a database write transaction. The specific implementation mechanisms for the graph database's internal connection pool resource allocation and network socket communication can be configured using conventional data persistence layer frameworks by those skilled in the art; these are well-known technologies in the field and will not be elaborated upon here. The graph database takes each globally unique identifier received as an example. It utilizes its built-in graph manipulation engine to perform structure retrieval operations, determining whether the parameter master node corresponding to the identifier already exists in the underlying topological storage space. From the perspective of the underlying graph model architecture, the parameter master node is physically defined as an isolated vertex entity object in the graph database. Let the set of vertices composed of parameter master nodes be defined as... For specific identifiers Its corresponding parameter master node The data structure characteristics can be represented by the following set of attributes:
[0038] In the above formula, The graph structure classification label representing this vertex is primarily used in database engines to distinguish between the base master node and subsequently generated dynamically computed nodes when performing breadth-of-sight or depth-of-sight graphs. This classification label is typically set to a specific English string constant. It serves as a globally unique identifier passed to this node and is explicitly configured as a non-repeatable primary key constraint within the graph database. The server system time segment representing the first instantiation of this node in the system, such as a long integer numerical representation. As a preferred approach, the parameter master node... The attribute dictionary does not directly store the specific engineering value of the parameter. The actual technical principle is that the engineering value is constantly updated and overwritten as different approval nodes perform V-stepping actions. If the value is directly bound to the basic master node, each update will overwrite the original data, leading to a break in the historical anti-tampering link. Therefore, the system configures it as a static node without a specific business value, only retaining the underlying routing association pointing to the latest graph data for subsequent V-stepping processes. Based on the search results from the graph manipulation engine, the graph database executes idempotent conditional creation instructions through its built-in transaction controller. If the search results indicate that a matching identifier already exists in the graph database... For vertex entity objects, the graph database retains the original node data, directly returns a cooperative status code indicating that the node is ready, and skips the allocation instruction. If the search results indicate that no node was found, the final database divides the vertex data area of the underlying solid-state storage medium into storage blocks and writes the parameter master node according to the structure of the aforementioned attribute set. The graph database's attribute data. If an abnormal failure such as storage medium space overflow or connection timeout is detected during physical writes, the graph database's transaction controller will perform a log rollback operation to maintain the structural integrity of the graph data model. Based on the aforementioned idempotent verification and atomic operation mechanism, it is generally possible to ensure that a single engineering parameter maintains a physically unique underlying anchor point when it flows across multiple heterogeneous systems. The parameter master node generated through the above steps provides a deterministic entry foundation for graph data archiving and retrieval across business stages in the overall data model.
[0039] In the second preprocessing stage, before triggering the computation logic, the hash value output by the pre-approval node is extracted. This hash value is then used as a query index to send a data retrieval request to the graph database. The graph database traverses along specific shortcut edges based on the parameter master node, obtaining and returning the parameter lock status dataset fixed in the historical business process. In this stage, the hash value output by the pre-approval node is extracted as a pre-environment identifier before triggering the computation logic. When processing multi-level engineering approval workflow data, traditional methods using depth-first traversal of the graph structure to trace the historical status of parameters often consume significant computational resources. To address this issue, this system utilizes the index-free adjacency feature of the underlying data structure to achieve nearest neighbor prefetching of status data. In this embodiment, this native shortcut edge pointer addressing logic is implemented using the following method: Extract the current set of input parameters Each globally unique identifier contained 9. Globally unique identifiers The extracted hash values of the pre-approval nodes are encapsulated into batch retrieval instructions. Upon receiving the instructions, the underlying graph traversal engine is activated, and the query focus is directly set to the parameter master node that has been constructed in the previous steps. .
[0040] Graph databases leverage the index-free adjacency feature of their underlying storage engine to perform direct addressing at the physical memory level. From a technical implementation perspective, in the underlying solid-state storage blocks of a graph database, the parameter master node not only stores its own attribute dictionary but also maintains a list of physical memory addresses for associated edges. This list includes a special type of declared directed relation edge, namely, a native shortcut edge. The executor of the graph database reads parameters from the master node. Internally recorded native shortcut edge The memory pointer offset directly traverses the intermediate regular business flow graph nodes to locate the target entity node, which is the historically locked entity node of the most recently frozen record. The addressing function corresponding to the above process is expressed as:
[0041] In the above formula, The underlying engine of the representation graph database executes direct physical memory addressing functions based on memory pointer offsets. Because this operation avoids the computational process of traditional relational databases that rely on global B+ tree indexes for queries, it can typically reduce the number of node traversals during state tracing.
[0042] Considering the actual execution of engineering infrastructure workflows, some parameters may be being entered for the first time at the current approval node, and their historical calculation trajectory has not yet been generated in the graph. To address this boundary scenario, the system has configured addressing probe verification logic within the graph operation engine. If the parameter master node... The list of associated edges does not contain native shortcut edges. The physical pointer returns a specific null value identifier. Upon receiving the null value identifier, the system determines that the corresponding parameter is in its initial instantiation state. Without needing to participate in subsequent historical state cross-validation, it directly marks the parameter as state-safe and jumps to the addressing operation of the current parameter, thereby ensuring the integrity of the system's processing logic.
[0043] For successfully addressing and hitting the edge of the native shortcut The parameter object is the entity storage block pointed to by the target address loaded by the graph database. Based on this, the graph database retrieves data from the locked entity nodes. Extracting historical project values from the attribute space and its bound historical parameter identifier It should be noted that the subscript... This represents the parameter sequence number that has been calculated and legally locked in the historical process. The graph database packages the extracted data sets, and after receiving the above data, constructs and instantiates the historical lock state dataset in its working memory. As a preferred approach, this dataset is defined as a set of time-mapping relations as follows:
[0044] In the formula, The characterization system is based on the total number of historical locking parameters successfully extracted from the current batch inspection instructions. The transient data obtained based on pointer-level addressing is provided as a historical state reference standard for determining the legality of the current input data.
[0045] After physical memory-level addressing and location are completed based on native shortcut edges, data extraction and verification rules are executed to convert the physical node attributes stored in the underlying graph database into a historical lock state dataset that can be used for computation in memory. In this embodiment, this process is specifically implemented through the following steps S205 to S207.
[0046] After a graph database identifies a historically locked entity node, it initiates the underlying data reading interface to obtain the node's attributes. The graph database extracts the original attribute data block, stored in binary format, from the node's physical attribute page group. Considering that engineering infrastructure parameters often involve floating-point scalars such as spatial coordinates or material stresses, the original attribute data block is typically subjected to compact serialization encoding within the graph database to save storage space. The graph database encapsulates the read original attribute data block and the node-bound status check code into a data response message and transmits it via the internal data bus. For the network transmission and message encapsulation format of binary data blocks within the distributed system, those skilled in the art can use conventional transmission control protocols or remote procedure call frameworks, which are well-known technologies in the field and will not be elaborated upon here.
[0047] Upon receiving the data response message, a data integrity and context consistency verification is performed. In actual operation, engineering approval systems often face multi-branch concurrent processing. Directly extracting data from nodes pointed to by shortcut edges carries a certain probability of causing dirty reads due to context corruption. Therefore, the status check code in the message is extracted and compared with the hash value of the preceding node in the current task environment. As a preferred approach, this environment verification logic relies on a pre-defined verification function. The corresponding determination mechanism can be expressed as:
[0048] In the above formula, The hash value representing the data transmitted by the pre-approval node is usually a fixed-length hexadecimal string that represents the current legal business flow context. The status check code is extracted from the historical locked entity node. This check code is an anti-tampering tag generated when the historical node is written to disk. This is the output Boolean-type validation result variable. Validation function. The specific implementation logic is configured to perform a complete equality match between two hash strings. When the comparison logic determines that the character sequences of the two strings are completely identical, If the value is set to true, it indicates that the node obtained through addressing does indeed belong to the currently compliant historical lake source link. If the output is false, a link exception warning will be thrown and the current node reading process will be interrupted, thereby maintaining the independence of the business branch.
[0049] After successful environment verification, the internal deserialization component is invoked to decode and parse the original attribute data block. Historical parameter identifiers are then accurately extracted from the decoded data dictionary. and corresponding historical engineering values To meet the requirements of subsequent mathematical calculations, the extracted historical engineering values were processed according to the system's preset memory structure specifications. Perform format conversion. Specifically, based on the data type declared for this parameter in the global data dictionary, convert the deserialized value into a standard 64-bit double-precision floating-point number or a 32-bit integer. If a data length overflow or machine code format incompatibility is detected during the conversion process, the system will trigger an internal formatting exception mechanism to suspend the current task.
[0050] The data entities that have undergone the above formatting process are centrally written to the protected memory area, thereby instantiating and generating a precise historical lock state dataset. The system further configures read-only access permissions for the memory pages containing the dataset at the operating system level. This hardware-level memory management mechanism typically prevents data from being overwritten without authorization during subsequent abstract syntax tree (AST) solving. Through the execution of the above extraction rules, the system provides a relatively safe and stable historical reference benchmark for the subsequent parameter state cross-validation.
[0051] The third preprocessing stage involves extracting the common parameter portion from the current input parameter set and the parameter lock state dataset. For specific parameter objects within this common parameter portion, cross-validation for state consistency is performed. If the validation logic indicates a numerical conflict, an interrupt command is issued to stop the current computation allocation and topology conflict information with an exception flag is thrown to the upper-level logic. If the validation logic indicates a consistent state, the system allows the data flow to proceed to subsequent computation stages. After instantiating the current input parameter set and historical lock state dataset in memory during the second preprocessing stage, the system typically performs reverse parameter consistency validation in runtime. The approval process for engineering infrastructure projects involves multi-level departmental collaboration, and downstream nodes sometimes overwrite or change key parameters that have already been approved and locked upstream. To maintain the consistency of global topology data, the system verifies the legality of the current data by comparing historical anchor points. In this embodiment, the process of extracting the common parameter portion and performing cross-validation for state consistency is specifically implemented through the following method: Based on set theory principles, the common parameter components of the current input parameter set and the parameter-locked state dataset are extracted. Specifically, the current input parameter set is extracted separately. All globally unique identifiers in the set constitute the current key set. and extracting historical lockout state datasets All the historical parameter identifiers in the set constitute the history key set. Perform an intersection operation on the two independent sets mentioned above to generate a set of common parameter identifiers. :
[0052] After generating the intersection, the system will execute the standard set null value detection logic. If the set of common parameter identifiers is determined... An empty set indicates that all engineering parameters entered at the front end are entirely new business variables and do not overlap with historical frozen data. In this case, a release command with a consistent status is issued directly, skipping subsequent comparison steps, thereby saving the system's underlying computational overhead and avoiding invalid loop operations.
[0053] Faced with a non-empty set of public parameter identifiers This requires preparing computational environment variables for the verification logic. Considering that engineering parameters encompass both continuous variables such as dimensions and discrete text such as material specifications, the system needs to distribute different verification rules based on data type to avoid type calculation errors. As a preferred approach, the data type declaration associated with the current parameter is retrieved from the global data dictionary. For parameters marked as floating-point numbers, the system determines the tolerance threshold required for numerical comparison. Engineering calculation environments contain a large number of double-precision floating-point numbers generated through dimensional conversion. Directly using the equality sign for numerical determination often results in false alarms due to truncation errors at the computer's underlying level. Typically, for standard dimensional or coordinate data, this tolerance threshold... The value range is set to to A positive real number between these values, used to absorb truncation errors generated during underlying machine code computation.
[0054] For the set of public parameter identifiers The specific parameter objects within the set are subjected to cross-validation for state consistency. The set is then read sequentially using an iterator. Each target identifier in For each target identifier From the current set of input parameters respectively Search for the corresponding current standard parameter value in the middle. and from the historical locked state dataset Search for corresponding historical project values in the middle. .
[0055] Based on this, the system's built-in consistency verification function is called. Then, branch validation is performed based on the previously determined data type. When the current parameter is identified as a floating-point number, the absolute difference between the two is calculated and compared with the tolerance threshold. The underlying calculation formula for conditional comparison is as follows:
[0056]
[0057] In the above formula, It represents the numerical offset of the same service parameter between the current input state and the historical locked state; Characterization for a single target identifier The output is a Boolean comparison result.
[0058] Conversely, if the current parameter is identified as character or enumeration data, the absolute difference calculation is skipped, and the underlying string matching function is directly called to compare whether the two are completely identical. If they match, then the corresponding... Output a true value if the condition is true, otherwise output a false value.
[0059] Summarize the comparison results of all iterated objects and output a global verification indicator. If iterating through the set of common parameter identifiers... During the process, any target identifier Corresponding comparison results If the output is false, whether due to an absolute difference in values exceeding the preset tolerance threshold 'e' or a mismatch in character text, the verification logic indicates a numerical conflict. Such conflicts typically signify a discrepancy between the current data state at the approval stage and previously retained tamper-proof records. Conversely, if the output is true, the verification results for all common parameter objects will be immediately true, and the overall verification logic evaluation indicates a consistent state. This verification result is then passed to the control bus as a prerequisite for determining whether the data stream can proceed to the subsequent abstract syntax tree compilation and evaluation stages.
[0060] In cases where numerical conflicts exist in the comprehensive evaluation indicators during cross-validation, the system typically needs to terminate the current business process and clean up invalid input states. Since the computational logic of engineering infrastructure projects often involves complex dependencies, simply returning error messages at the application layer without intervening in underlying computing resources may lead to some parallel threads misreading residual abnormal data. To maintain data consistency in the system's memory space and prevent abnormal states from propagating downstream, the system is configured with a targeted exception handling mechanism. The process of capturing conflict exceptions and blocking them at the memory level is implemented through the following steps: Upon detecting a false global verification indicator, an internal exception capture listener is triggered to construct a conflict parameter detail. Previous comparison results are iterated through, and all comparison results are processed. Extract the parameter object whose output is false. Extract the corresponding target identifier. Current standard parameter values and historical engineering data These three sets of data are then encapsulated into exception information objects with tuple structures. As a preferred approach, all generated exception information objects are aggregated and instantiated in memory to construct a conflict exception set. Its mathematical expression is:
[0061] In the above formula, the condition declaration False, acting as a data filtering predicate, ensures that the set contains only parameter entries where actual state deviations have occurred. This set provides precise data structure support for error rendering in the front-end system and audit logs in the back-end.
[0062] For the generated set of conflict exceptions The system invokes internal logging and communication components to report exceptions. It then deserializes the collection, converting it into a standard data exchange format message and appending a session identifier for the current business operation and a server system timestamp. Subsequently, this message is returned to the front-end business system for operators to verify and correct. Considering that actual business systems often include automated approval flows initiated through application programming interfaces (APIs), if the current operation is in an asynchronous session environment without a front-end interface, the message will be routed to the system's built-in message middleware or event bus, triggering an asynchronous exception callback for back-end maintenance personnel. Simultaneously, the message is synchronously written to the underlying persistent audit log area, preserving a historical snapshot for subsequent process compliance reviews. The specific coding implementation for converting the object stream to the data exchange format and appending data to the file can be accomplished by those skilled in the art using conventional serialization libraries and logging frameworks; these are well-known technologies in the field and will not be elaborated upon here.
[0063] While reporting abnormal data, a memory blocking response is executed to prevent the abnormal data from propagating downwards. Considering the memory reuse characteristics of high-concurrency environments, a suspension command is sent to the internal thread manager to terminate all computing threads currently bound to this business session, preventing them from entering the subsequent abstract syntax tree compilation and evaluation stages. Based on this, the current set of input parameters residing in the working memory is... And perform a reference null operation on the related temporary computed variables.
[0064] To prevent concurrent read risks caused by delays in the operating system's automatic garbage collection mechanism, as a preferred approach, the underlying system's memory erasure function is invoked before releasing the relevant memory handles to overwrite the physical memory blocks occupied by the aforementioned sets and variables with all zero values. Specifically, the context handles allocated to these memory objects are revoked, marking them as unreachable in the memory management view of the operating system or application-level virtual machine. Through this comprehensive blocking operation, the system can generally prevent unverified illegal parameters from residing in the system's runtime environment, thereby reducing the risk of cascading computation errors caused by parameter tampering. Since the current operation has been interrupted in memory and no disk write instructions have been generated, the graph database maintains the original topology of the parameter master node and historically locked entity nodes, ensuring the stability of the underlying graph state.
[0065] After cross-validation results indicate that the parameter states are consistent, the system guides the valid parameter data into the business calculation and specification verification phase. In the engineering field, business specifications and verification logic are typically persistently stored in a rule base as text-formatted expressions. When performing complex cross-attribute verification, directly parsing and executing these text-formatted expressions consumes significant system resources and may lead to runtime syntax errors. To improve computational efficiency and maintain structural stability during the execution phase, the system introduces an abstract syntax tree mechanism from compiler principles, transforming the flat rule text into a computer-traversable tree-like data structure. Compared to the original text, the abstract syntax tree removes control characters with no business meaning, such as spaces, and explicitly defines the priority of various operators through the tree's hierarchy depth, thereby helping to reduce the time complexity of subsequent recursive evaluation phases.
[0066] The compilation process of the abstract syntax tree is as follows: Based on the current set of input parameters The business category tags carried in the code initiate a specification query request to the underlying rule database to extract the corresponding engineering specification expression text. As a preferred approach, a preliminary null value check is performed after the extraction operation is complete. If no canonical expression is found during the search, it indicates that the current parameter set does not involve specific engineering constraints, and the system will directly return a canonical clearance status, thus avoiding initiating subsequent compilation processes that have no practical significance. A retry mechanism is configured to address potential connection timeouts or network fluctuations during database queries. If data is not retrieved after exceeding the retry threshold, the current approval task is suspended, and a service unavailability warning is issued to the upper layer.
[0067] Facing non-empty engineering specification expression text The built-in lexical analyzer is invoked to scan the character stream. Based on a preset set of regular expressions, the lexical analyzer segments the continuous character sequence into a sequence of lexical units with independent semantics. These lexical units typically cover business parameter identifiers, arithmetic operators, logical relational operators, and constant literals. The generated sequence of lexical units can be represented as a set:
[0068] In the formula, The representation generated in the order of text reading Each independent lexical unit; The total number of generated lexical units is a positive integer. During the scanning and segmentation process, to prevent illegal characters caused by input errors from triggering a program infinite loop, the lexical analyzer is configured with an unknown lexical interception mechanism. If an illegal segment appears in the character stream that fails to match any preset regular expression, the system will immediately block the scanning process and record the cursor position of the conflicting character. For specific lexical analysis implementations such as text segmentation based on finite state machines and whitespace removal, those skilled in the art can use conventional compiler front-end technologies, which are well-known in the field and will not be elaborated upon here.
[0069] Lexical unit sequence based on lexical analysis output The parser is then started to construct the abstract syntax tree. Based on the context-free grammar defining the engineering rules, the parser uses recursive descent or shift reduction parsing algorithms to organize the linear sequence of lexical units into a hierarchical tree structure reflecting the priority of operations. The resulting abstract syntax tree model is abstracted as a graph structure model, whose mathematical definition is as follows:
[0070] In the formula, Represents the set of nodes in the syntax tree; This represents the set of directed edges that define the hierarchical derivation relationships between nodes. In the abstract syntax tree... In the tree structure, leaf nodes are mapped to specific business parameter identifiers or constant literals, while non-leaf nodes are mapped to specific arithmetic or logical operators. If structural syntax errors such as mismatched parentheses or missing operators are detected during the construction of the tree structure, the parser will trigger a compilation exception event, intercepting illegal rules from entering the computation state.
[0071] After the topological structure of the syntax tree is constructed, for this abstract syntax tree... Semantic analysis and data binding are performed. To avoid runtime crashes due to type incompatibility, static type inference is executed before data binding. The system verifies the data type compatibility between non-leaf nodes (operators) and their subordinate leaf nodes (operands) based on the parameter attributes recorded in the global data dictionary. For example, it blocks illegal syntax tree structures that attempt to perform subtraction between plain text strings and floating-point numbers.
[0072] After the type derivation verification passes, in order to provide the environment completeness required for standardized computation, all leaf nodes are traversed to extract the business parameter identifiers and compare them with the current set of input parameters. Perform mapping verification. If the system identifies an unknown parameter variable declared in the abstract syntax tree that is not provided in the input set, it will throw a parameter missing exception and suspend the computation thread. If the mapping verification passes, the corresponding current standard parameter value from the input set is injected into the memory space of the relevant leaf node. This processing mechanism, which binds topological logic to actual business data, provides a structured state foundation for subsequent depth-based syntax tree evaluation in working memory.
[0073] After compiling and binding the abstract syntax tree, the system enters the rule evaluation and business state solidification stage. To verify whether the engineering parameters meet specific specifications and to provide structured data support for subsequent tracing operations, the system traverses and calculates the syntax tree, simultaneously capturing the calculation process to generate a directed acyclic graph trajectory.
[0074] Abstract Syntax Tree after Data Binding The post-order traversal algorithm is used to evaluate nodes. From a computational perspective, the characteristics of post-order traversal ensure that before any parent node (operator node) is evaluated, all its dependent child nodes (operand nodes) have been pre-calculated and have determined values. Specifically, the tree structure is traversed from bottom to top and from left to right. As a preferred approach, an operand stack is maintained in memory. When a leaf node is reached, it is encapsulated as a context object containing the parameter value and the node's memory address and pushed onto the stack; when a non-leaf node is reached, the corresponding number of operand objects are popped from the top of the stack, the calculation is performed, and a new context object containing the new node's memory address and the calculation result is pushed back onto the stack. Its underlying recursive evaluation function can be abstracted as follows:
[0075] In the formula, This represents the non-leaf node currently being processed; This represents the specific operator execution function associated with this node; to Representation Nodes Each of the child nodes; The output value of the node; This parameter represents the number of child nodes, and its value is determined by the number of nodes in the current operator; it is typically a positive integer of 1 or 2. During arithmetic calculations, the system has an internal low-level exception handling mechanism. If a hardware-level calculation exception occurs, such as division by zero or a floating-point number exceeding its representation range, the traversal will be interrupted, and a calculation termination signal will be thrown to the upper layer to prevent illegal special value types from being pushed onto the stack.
[0076] Step S102: Fold the abstract syntax tree down to a directed acyclic graph, and serialize the directed acyclic graph to obtain a normalized string; Specifically, the abstract syntax tree (AST) data structure is processed according to the post-order traversal algorithm to generate computation results. Simultaneously, the node dependencies during the computation process are recorded. The parameter nodes, operator nodes, and output nodes involved in the computation are transformed into a directed acyclic graph (DAG) structure, generating an execution trajectory subgraph structure representing the computation process. The node identifiers and edge attributes within the execution trajectory subgraph structure are then reordered lexicographically to generate standardized byte stream data. The process of folding the AST into a DAG specifically includes: During the post-order traversal evaluation, computational steps are synchronously captured to construct a computational trajectory in the form of a directed acyclic graph. Considering that different engineering specifications may share parameter variables or common sub-expressions, using a tree structure to record everything can sometimes lead to excessive storage consumption and redundant traversal during subsequent tracing. Therefore, when generating the computational trajectory, a deduplication and folding mechanism is performed using a memory hash table. Specifically, for leaf nodes, the system uses their business identifier as the hash key; for intermediate computational nodes, the system concatenates their operator type with the memory pointer addresses of their child nodes to generate a combined hash key. When a newly calculated node hash key already exists in the hash table, the system directly reuses the existing node reference without allocating additional memory space. After the above merging process, the tree-like execution path is folded and mapped into a simplified directed acyclic graph structure, denoted as […]. The mathematical definition of this graph structure is as follows:
[0077] In the above formula, It represents the unique set of entity nodes participating in the computation, including the parameter nodes of the initial input and the intermediate computation result nodes; This represents the set of directed edges that define the data dependencies between nodes. This directed acyclic graph structure records the specific data flow from the original input parameters to the final specification result.
[0078] Step S103: Extract the preceding hash value of the engineering parameter update instruction, concatenate the normalized string, the preceding hash value, the timestamp, and the random salt value, and perform a one-way hash operation to generate the current state hash value. Encapsulate the current state hash value into a graph update instruction, wherein the random salt value is obtained by pre-setting. Specifically, a secure hash function is called to process the concatenated data of standardized byte stream data and hash values of pre-approval nodes, and to calculate and generate a globally unique hash value that represents the current business operation status, which is represented as the current status hash value.
[0079] Step S104: Write the target parameter value, timestamp, random salt value and current state hash value into the target parameter master node as indicated by the graph update instruction for archiving.
[0080] Specifically, after obtaining the target parameter value and the current state hash value, the target parameter value, the current state hash value, the timestamp, and the random salt value are written into the graph to update the master node specified by zero, thus completing the data archiving.
[0081] This invention, through constructing an abstract syntax tree and dynamically calculating target parameter values, can accurately parse multidimensional dependencies in complex engineering rules, ensuring the real-time performance and reliability of parameter evaluation. Folding the abstract syntax tree down to a directed acyclic graph and serializing it into a normalized string not only eliminates redundant calculation paths but also provides a unified, standardized representation of parameter change logic, facilitating subsequent comparison and transmission. Generating a current state hash value using the predecessor hash value, normalized string, timestamp, and random salt provides robust anti-tampering verification and end-to-end auditing. Writing the target parameter value, timestamp, salt value, and state hash to a designated master node, combined with the index-free adjacency storage feature of graph databases, enables efficient persistence and rapid backtracking of parameter versions, significantly improving the security, consistency, and query response performance of data archiving in engineering approval scenarios.
[0082] In one embodiment, step S102, serializing the directed acyclic graph to output a normalized string, includes: A bottom-up hierarchical reduction strategy is adopted to perform post-order traversal of the directed acyclic graph, and a memoized cache dictionary is built during the traversal process; Specifically, the built-in graph traversal engine is activated, traversing the directed acyclic graph trajectory. Starting from the underlying leaf nodes, the system extracts and converts node attributes. In cross-platform or distributed computing environments, the same floating-point value is often converted into a character sequence with different trailing zeros or different scientific notation representations due to differences in the formatting of the underlying programming language. To unify the numerical representation, branching processing is performed based on preset mandatory encoding rules and the node's data type declaration. For numeric parameters, the system uniformly converts them into hexadecimal strings based on the IEEE 754 standard; for text or enumeration parameters, the system directly extracts their standard UTF-8 encoded strings. Simultaneously, the system extracts the node's business identifier and data type label, and combines these elements according to a fixed syntax format of "type label_business identifier_processed value" to form the node's basic attribute data block.
[0083] When traversing a directed acyclic graph, check if the node identifier of the traversed node matches the memoized cache dictionary. If it matches, directly extract the generated substring. If it does not match, extract the current node attribute, recursively concatenate to generate a substring, and store the substring in the memoized cache dictionary with the node identifier as the key. Specifically, after obtaining the basic attribute data blocks of the underlying nodes, a bottom-up hierarchical reduction strategy is used to process non-leaf nodes. Abstract syntax trees typically contain commutative operators such as addition, multiplication, or logical AND. When the left and right storage positions of these operands are swapped in the graph structure, they represent the same computational process in business logic and should generate consistent serialization results. To achieve topological isomorphism consistency, the normalized substrings generated by all child nodes of the current non-leaf node are extracted, and the commutative property of the current node's operators is read. Since directed acyclic graphs can have multiple parent nodes sharing the same child node, a memoization dictionary is introduced in this recursive process to avoid exponential expansion during string concatenation. When the normalized string of a node is generated for the first time, the system stores it in the cache dictionary with the node identifier as the key. When other parent nodes traverse this node again, they directly retrieve the generated substring from the dictionary.
[0084] The substrings of each node in the directed acyclic graph are concatenated layer by layer until the root node is reached. The concatenated string at the root node is the normalized string.
[0085] Specifically, when the operator of the current node satisfies the commutative law, the normalized substrings of its child nodes are sorted lexicographically. As a preferred method, this lexicographical sorting mechanism performs an ascending byte-by-byte comparison based on the Unicode scalar values of the characters. The underlying mathematical description of its sorting logic can be expressed as:
[0086] In the above formula, to The normalized substring representing each directly dependent child node that has been flattened; A lexicographical ascending sort function representing the underlying structure; This is the sorted sequence of strings to be output. This represents the number of direct child nodes contained in the current non-leaf node. During actual computation, if two substrings have identical content, it means that the corresponding two subgraph structures are logically equivalent. In this case, the system does not need to perform a secondary sort; it can directly treat the two substrings as equal and preserve their original relative positions in the memory array. Conversely, for operators such as subtraction or division that do not satisfy the commutative law, the sequence is constructed according to the operand positions defined in the original abstract syntax tree, skipping the lexicographical sorting.
[0087] Based on the predetermined child node order, perform string concatenation of the topology data. To preserve the hierarchical boundaries of the original graph structure and prevent parsing ambiguity, as a preferred method, the operator type identifier of the current node is combined with the string sequence of its subordinate child nodes. By concatenating and aggregating elements using predefined square brackets and commas, a text string in the format "operator:[substring1, substring2]" is generated, representing the state of the current non-leaf node. This recursive concatenation operation proceeds layer by layer from bottom to top in the computation thread until the cursor reaches the directed acyclic graph trajectory. The unique root node. At this point, the system outputs the final normalized one-dimensional string representing the global graph computation state. For serializing memory objects and performing common character stream append operations, those skilled in the art can use the string builder component in the standard runtime environment to implement these operations, which are well-known techniques in the field and will not be elaborated upon here.
[0088] The embodiments of the present invention, by employing a bottom-up post-order traversal combined with a memoized cache dictionary, can effectively avoid repeated traversal and recursive concatenation of shared child nodes in a directed acyclic graph, thereby significantly reducing computational complexity and memory overhead.
[0089] In one embodiment, step S103 involves concatenating the normalized string, the predecessor hash value, the timestamp, and the random salt value, and performing a one-way hash operation to generate the current state hash value, including: Extract the binary stream of the preceding hash value, normalized string, timestamp and random salt value, and concatenate the binary stream of the preceding hash value, normalized string, timestamp and random salt value in a preset order to construct the original message; A secure hash algorithm is used to perform a hash calculation on the original message to obtain the current state hash value.
[0090] Specifically, after outputting the normalized one-dimensional string, the system guides the calculation process into the generation and solidification of the state check code. To verify whether the engineering parameters have been tampered with in subsequent transfers and to record the evolution of the data state, a hash operation is performed on the normalized string, combining the time dimension and the attributes of the preceding state, to generate a state hash value with verification properties. The concatenation and concatenation process of the state hash values is as follows: Extract the normalized one-dimensional string generated in the previous stage It then requests additional signature elements from the system context. Specifically, it retrieves the current business timestamp using the system clock rank. In a typical distributed infrastructure management platform, to avoid time resolution inconsistencies caused by cross-timezone server scheduling, the system forcibly converts the current system time to Coordinated Universal Time (UTC) when extracting timestamps, using millisecond-level long integer values since the epoch era as the standard format. Considering the continuous timeline of business approval flows, to establish relationships between states, a query is initiated to the underlying database to extract the state hash value of the predecessor historical locked entity node corresponding to the current business parameter, denoted as the predecessor hash value. If the system recognizes that the current operation is the first lock of this parameter in the entire project lifecycle, it will assign a preset fixed-length null hash (such as an all-zero hexadecimal string) as the initial preceding hash value.
[0091] After preparing the signature elements, a concatenated concatenation operation is performed to construct the original message. To avoid character confusion between different elements at the concatenation boundaries, a specific visible symbol (such as the vertical pipe symbol "|") is used as a delimiter to concatenate the preceding hash value, the normalized one-dimensional string, the business timestamp, and the system-generated salt value in a fixed memory layout order. This concatenated concatenation process outputs the original message to be encrypted. Its mathematical expression is:
[0092] In the formula, the symbol This represents the cascading concatenation operation at the underlying string level; Salt represents a fixed-length random string generated by the system, i.e., the salt value. To ensure that the concatenated message has sufficient security entropy, the cryptographically secure pseudo-random number generator (CSPRNG) provided by the underlying operating system is typically used to generate this salt value, which is set to a hexadecimal character range of 16 to 32 bytes. Introducing a salt value mechanism can usually increase the randomness of the final message, thereby improving the system's resistance to dictionary attacks or rainbow table attacks targeting hash algorithms.
[0093] For the assembled original message The system invokes internal cryptographic components to perform a one-way hash operation. From an information security perspective, one-way hash functions exhibit a significant avalanche effect; that is, any tiny character change in the original input message will lead to a huge and unpredictable change in the output hash value. This mathematical characteristic perfectly suits the tamper-proof verification requirements of engineering data. Therefore, hash functions with collision-resistant properties, such as secure hash algorithms (SHA-256 or SHA-3), are selected to perform data digest processing on the original message, generating a fixed-bit current state hash value. Its computational logic is expressed as follows:
[0094] In the formula, This represents the selected one-way cryptographic hash function. The underlying bitwise logic operations and data block padding logic of the cryptographic hash function can be implemented by those skilled in the art using cryptographic algorithm libraries in standard operating environments; these are well-known techniques in the field and will not be elaborated upon here.
[0095] Generate the hash value of the current state Based on this, the data persistence operation is performed. The state hash value is encapsulated as a state identifier within the graph update command. Upon receiving the command, the current state hash value is... The core attribute field is written into the latest generated historical locked entity node. By embedding the state hash value containing the predecessor hash factor into the graph database, the system constructs a state chain structure based on hash pointers in the topology graph. This chain structure links the parameter change history, providing structured data support for subsequent parameter change tracing and business consistency verification.
[0096] This invention extracts the preceding hash value, normalized string, timestamp, and random salt value into binary streams and concatenates them in a preset order. This effectively eliminates encoding ambiguity and boundary confusion that may occur when different data types are concatenated during the concatenation process. It ensures that each generated original message has a definite and unique byte sequence, guarantees computational efficiency, meets the audit and traceability requirements in high-security scenarios, and provides reliable technical support for data integrity protection in archiving systems.
[0097] In one embodiment, step S104, which involves writing the target parameter value, timestamp, random salt value, and current state hash value into the target parameter master node indicated by the graph update instruction for archiving, includes: Locate the target parameter master node corresponding to the current input parameter set in the graph database indicated by the graph update command. Instantiate the historical lock entity node in the target parameter master node. Write the target parameter value, timestamp, random salt value and current state hash value into the historical lock entity node for archiving. The current input parameter set is obtained by parsing the engineering parameter update command.
[0098] Specifically, the graph database receives graph update commands through the underlying network interface and initiates its internal graph transaction manager. The graph transaction manager parses the set of business parameter identifiers carried in the command and uses a graph traversal algorithm to locate the corresponding target parameter master node in the existing topology graph structure. To ensure the atomicity and isolation of data writes, the graph transaction manager allocates an independent transaction context space in memory for the current update operation. As a preferred approach, the system temporarily stores subsequent node creation and attribute assignment operations in this context to prevent incomplete intermediate states from being read by other concurrent query processes.
[0099] Based on the located target node, the graph database instantiates a new historically locked entity node and performs attribute assignment operations with hash state locks on it. Regarding the specific implementation of the data anti-tampering mechanism, the hash state lock is materialized as a data integrity credential based on a cryptographic algorithm, rather than a process mutex object at the system kernel level. The graph database utilizes the key-value pair mechanism of the attribute graph model to combine the currently valid parameter values, business timestamps, and the previously calculated current state hash value. This attribute is written as an independent attribute into the new node. The comprehensive attribute data block of a node can be abstractly represented as the following set of tuples:
[0100] In the above formula, Represents the Coordinated Universal Time timestamp obtained from the preceding steps; The random salt value generated in the preceding steps and used for hash calculations is also written to disk as a necessary cryptographic parameter for subsequent tamper-proof verification. This refers to the hash state lock that is permanently stored on the node. Represents the current standard parameter values that have been verified and are compliant with business specifications; Represents the Coordinated Universal Time timestamp obtained from the preceding steps; This refers to the hash state lock that is permanently stored on the node. This represents the state version number of the node on the current parameter evolution timeline. This version number corresponds to and is inherited from the current version count of the parameter master node. It is assigned a value of 1 upon initial creation and increments with each subsequent state change.
[0101] In this embodiment of the invention, by accurately locating the target parameter master node corresponding to the current set of input parameters in the graph database indicated by the graph update instruction, and instantiating the historical locked entity node for writing, version isolation and non-overwriteable storage of parameter change records can be achieved, ensuring that the historical entity node generated by each archive is independent and immutable; the target parameter value, timestamp, random salt value and current state hash value are uniformly persisted in the entity node, so that the archived data contains all verification elements, completing anti-tampering verification and audit traceability.
[0102] In one embodiment, the version number verification of the target parameter master node is performed based on an optimistic concurrency control mechanism, including: Extract the expected version number carried during the archiving process, and compare and exchange the verification with the latest version number currently recorded in the target parameter master node; If the verification is consistent, the write operation is performed and the latest version number on the target parameter master node is incremented synchronously. If the verification is inconsistent, a preset adaptive retry mechanism is triggered. The waiting time is set through an exponential backoff algorithm. After the waiting period ends, the latest node status is retrieved again to calculate the expected version number and perform verification. This continues until the number of retries exceeds the preset retry threshold, at which point a concurrency conflict exception is thrown to the upper layer.
[0103] Specifically, during the attribute write process, to address the potential data overwrite risk in high-concurrency environments, the graph database is configured with an optimistic concurrency control mechanism based on the aforementioned version number. In practice, before submitting the attribute update to the physical disk, the graph database extracts the expected version number carried in the current transaction context and performs a comparison and exchange (CAS) check with the latest version number currently recorded on the corresponding parameter master node in the underlying disk. If they match, it indicates that no other thread has modified the parameter during this calculation, the system approves the write operation, synchronously increments the version number on the parameter master node in the underlying disk, and mounts the historical node generated by the current transaction to disk. For cases of inconsistent verification, i.e., when a concurrency conflict is detected, to avoid directly blocking the approval process and causing business unavailability, the graph transaction manager has a built-in adaptive retry mechanism. The system sets a waiting time according to an exponential backoff algorithm with random jitter, and after the waiting period, it re-fetches the latest node state to perform calculation and verification. If the number of retries exceeds the preset retry threshold (usually set to an integer of 3 to 5 times), the system rolls back the current operation and throws a concurrency conflict exception to the upper layer. This mechanism helps prevent business states from being overwritten out of order, thereby maintaining the continuity of the hash verification chain.
[0104] This invention introduces a version number verification mechanism based on optimistic concurrency control. Before archiving, the expected version number is compared with the latest version number of the target parameter master node and the verification is performed, thereby achieving efficient concurrency conflict detection.
[0105] In one embodiment, constructing a data tracing path based on the directed dependency edge relationships between historically locked entity nodes includes: Loop detection is performed between historically locked entity nodes. If a closed loop is detected, the construction of the data tracing path is terminated. If no closed loop is detected, a directed dependency edge indicating the data flow direction is created between historically locked entity nodes based on the computational dependency relationship between them. Multiple historically locked entity nodes are then concatenated into a data tracing path through the directed dependency edge.
[0106] Specifically, after node attribute assignments are completed and the data is stored on disk, the graph database constructs dependency edges between nodes based on the computational evolution path in the directed acyclic graph trajectory. In engineering business systems, computational derivation relationships commonly exist between different parameters; for example, the calculation result of a certain engineering quantity often directly depends on multiple preceding material parameter inputs. To reflect this business relationship, the graph database creates directed dependency edges indicating the data flow between each historically locked entity node in this update. The topological definition of this dependency edge set is as follows:
[0107] In the formula, Represents the newly created set of directed dependency edges; Representing historical locked entity nodes as computational input sources; Representing historical locked entity nodes as computational output; and These represent the input node set and output node set defined in the graph update command, respectively; This is the association type identifier bound to the dependency edge. As a preferred approach, the association type identifier... Taken from a pre-defined system enumeration dictionary, for example, values that represent direct arithmetic derivations. .
[0108] Before actually writing dependent edges, the graph database calls the graph traversal component to perform loop detection. The system uses a depth-first search (DFS) algorithm to simulate tentative insertions. If the addition of a new edge is detected as forming a closed loop, the topology reconstruction operation is intercepted to prevent the introduction of circular dependency logic. After passing the loop detection, the graph database concatenates these computationally related states with topological connections into a data traceability path. When subsequent anti-tampering audits of a certain parameter are required, the system only needs to reverse-traverse these dependent edges and re-verify the hash state lock attributes on each node to investigate the source of abnormal data injection. The specific underlying implementation of transaction commits and data file index updates within the graph database can be accomplished by those skilled in the art using conventional graph database management engine technologies, which are well-known in the field and will not be elaborated upon here.
[0109] This invention utilizes the actual computational dependencies between entity nodes to accurately create directed dependency edges, and forms a complete data tracing path by splicing directed edges. This provides a clear and traceable graph structure basis for tracking the historical evolution of engineering parameters, analyzing impact surfaces, and locating the root causes of anomalies, and enables efficient traversal and querying of the tracing path.
[0110] In one embodiment, updating the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node includes: Extract the shortcut pointer of the target parameter master node, perform an atomic pointer swap on the shortcut pointer, and set the endpoint of the original shortcut edge to the address of the latest archived data. Specifically, after assigning node attributes and constructing dependent topologies, the system enters the physical storage and index update phase. Engineering operating environments frequently face sudden hardware power outages or system process interruptions. To reduce the probability of data corruption in such abnormal situations, the graph database performs physical data persistence to disk based on the ACID transaction mechanism and simultaneously resets the native shortcut edges in the graph. In this embodiment, this is achieved through the following method: Before flushing data to the physical disk, the graph transaction manager in the graph database introduces a write-ahead logging mechanism. This addresses the risk of abnormal interruptions during the process of writing data from memory to disk. Directly overwriting the underlying data file could result in some data being written while others are not, leading to inconsistencies. The graph transaction manager serializes all node creation, attribute assignment, and dependency edge construction operations within the current transaction context into sequential log records. These records are then appended sequentially to the persistent log file. From the perspective of storage media operation, this mechanism leverages the faster write speed of sequential disk I / O compared to random I / O. To prevent the log file from becoming excessively bloated during long-term system operation, a checkpointing mechanism is configured internally as a preferred approach. Once the graph database confirms that a batch of memory data has been safely flushed to the solid-state storage, the storage engine automatically truncates and cleans up older logs prior to that checkpoint, thus maintaining a dynamic balance of disk space.
[0111] After confirming the write-ahead log is written to disk, the graph database triggers an asynchronous disk flush operation. For the timing of flushing in-memory data, the system is configured with a monitoring component to monitor the status of the in-memory transaction buffer in real time. When the buffer occupancy rate exceeds a preset capacity threshold (this threshold is typically set to 60% to 80% of the total physical memory capacity), or when the time interval since the last disk flush exceeds a preset time interval, the storage engine will batch flush the newly added historical locked entity node data and dependent edge sets temporarily stored in the buffer to the underlying solid-state storage medium. Based on the internal page table structure of the graph data, the graph database aggregates discrete node data into contiguous data blocks for persistence to maintain the physical spatial locality of the graph structure.
[0112] When a query request for the latest value of the parameter corresponding to the target parameter master node is received, the latest archived data of the current parameter is addressed along the reset native shortcut edge.
[0113] Specifically, as new business status data is physically written to disk, to adapt to the high-frequency data query needs of the business application layer, the system performs a reset operation on the native shortcut edge. The graph database reads the memory address of the parameter master node corresponding to the current business parameter and extracts its original shortcut pointer. The graph database calls the atomic pointer swap instruction supported by the underlying hardware to synchronously update the endpoint reference of the native shortcut edge held by the parameter master node from the predecessor historical locked entity node to the latest historical locked entity node written to disk. This helps prevent concurrent query processes from reading invalid dangling memory addresses during update intervals. The mapping relationship of this pointer reset can be formally expressed as:
[0114] In the formula, The native shortcut edge held by the main node representing the parameter; Represents the parameter master node entities that exist in the global graph; This is the function for extracting the underlying physical address; When requesting a state for this transaction, the query engine can directly obtain the latest state along the native shortcut edge, reducing the computational overhead of traversing the entire state chain from the beginning.
[0115] After the native shortcut edge is reset and the page file is updated, the graph transaction manager appends a transaction commit flag to the system log to record the completion of the current ACID transaction. As a preferred approach, after the transaction ends, the system triggers a background garbage collection component to release the independent memory context space previously allocated for the transaction and remove the update lock attached to the parameter master node. Through this resource reclamation process, system memory can be reused. The specific implementation of the underlying B+ tree index maintenance and disk data file merging and compression can be accomplished by those skilled in the art using conventional database storage engine technologies, which are well-known in the field and will not be elaborated upon here.
[0116] This invention atomically swaps the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node. By using atomic pointer swapping operations, thread safety and visibility of pointer updates are ensured. Reference switching can be safely completed in high-concurrency write scenarios without introducing complex locking mechanisms. At the same time, the reset shortcut edge serves as a fast channel to the latest archived data. This allows subsequent query requests for the latest value of the target parameter to directly address the latest archived data without having to traverse back along the historical version link. This significantly reduces query latency and system resource overhead.
[0117] The charging control method of this invention will be described below with reference to specific scenarios.
[0118] Application Scenario: When a design institute engineer modifies the parameter "volume of precast main beam" via a business terminal, the system uses this change command as input to trigger the graph update mechanism. The system extracts the set of cost calculation formulas related to this volume parameter and constructs an initial abstract syntax tree (AST) in memory. For calculation logic that reuses the same volume parameter across different sections, based on the aforementioned joint hash key mechanism, the tree structure is folded into a directed acyclic graph (DAG), effectively reusing the same multiplication or addition calculation nodes.
[0119] After generating the calculation results, the system enters the state tamper-proofing and solidification phase. The current Coordinated Universal Time (UTC) timestamp is extracted, and the operating system's pseudo-random number generator is used to generate a 32-byte random salt value. The system concatenates the hash value of the predecessor state, the normalized directed acyclic graph serialization string, the timestamp, and the salt value, and outputs the current state hash value calculated for this volume change using the SHA-256 algorithm.
[0120] Subsequently, the update command is sent to the underlying graph database. The graph transaction manager allocates an independent transaction context for this update and verifies the version number on the "Main Beam Precast Component Volume" master node using a Compare-and-Exchange (CAS) command. After verifying that there are no concurrent conflicts, the graph database writes the new volume value, timestamp, salt value, and current state hash value as attributes into the newly created historical locked entity node. At the same time, the system creates directed dependency edges pointing to this new node and atomically resets the native shortcut edges on the master node to the physical address of this new node. With the successful flushing of the Write-Ahead Log (WAL) to disk, a complete engineering parameter calculation and disk write operation with end-to-end cryptographic tamper-proof characteristics is declared complete.
[0121] Experimental verification and effect comparison: To objectively quantify the technical effects of this invention, this embodiment deployed the system on a server cluster (configured as two dual-socket 64-core processors, 256GB of memory, and a solid-state storage array running a Linux kernel), and imported approximately 150,000 engineering parameter nodes and 420,000 dependency relationships from a cross-sea bridge project as a benchmark dataset. System testing covered three core dimensions: memory consumption, concurrent throughput, and state tracing latency.
[0122] (1) The optimization effect of DAG folding mechanism on memory consumption: When dealing with complex nested formula calculations exceeding 15 levels in depth, traditional serialization methods based on pure tree-structured abstract syntax trees (ASTs) suffer from exponentially increasing memory usage with each formula level because they cannot identify repeatedly referenced common sub-formulas in the business logic. By introducing the DAG folding mechanism based on joint hash keys in this embodiment, nodes that were previously repeatedly expanded in memory are effectively reduced. Experimental data shows that when processing a composite computation graph containing 10,000 operators, the memory usage of this invention remains stable between 12MB and 15MB, a reduction of approximately 91% compared to the traditional AST solution (peaking over 180MB). This improvement significantly reduces the garbage collection (GC) pressure on the Java Virtual Machine (JVM) or the underlying runtime environment, preventing memory overflow anomalies under high load.
[0123] (2) Improvement of concurrent throughput (TPS) by adaptive retry optimistic locking: In a scenario simulating batch parameter approval initiated by multiple departments, the write performance of the graph database was tested by increasing the number of simulated threads (set to a range of 100 to 2000 concurrent threads). Traditional pessimistic locking mechanisms, when handling cross-updates of the same parameter node group, suffer from frequent thread blocking and context switching, causing system throughput to rapidly drop to approximately 800 transactions per second (TPS) after the concurrency exceeds 500. This invention employs version number-based optimistic concurrency control (OCC) combined with an adaptive exponential backoff retry algorithm with random jitter, allowing threads to perform local non-blocking backoff when conflicts occur. Under extreme stress testing with 2000 concurrent threads, the throughput of this invention can still be maintained at approximately 3400 transactions per second (TPS), ensuring system availability for large-scale engineering projects during centralized settlement periods.
[0124] (3) Optimization of query tracing latency by resetting shortcut pointers across layers: In engineering auditing, auditors often need to frequently retrieve the latest state of a parameter and trace its historical change path. If using traditional relational database foreign key joins, after the number of historical state versions exceeds 50, the latency for a single state lookup typically exceeds 120 milliseconds due to Cartesian product expansion. This solution, because it resets the native shortcut edge in real time after each ACID transaction is written to disk, maintains a constant time complexity for retrieving the latest state of the parameter, regardless of the number of historical changes. Actual testing shows that in a state chain with a depth of up to 200 changes, the physical response time for retrieving the latest node state and corresponding hash state lock is consistently within 3 to 5 milliseconds, improving query efficiency by more than an order of magnitude and providing solid underlying data support for high-frequency auditing and anti-tampering verification.
[0125] This embodiment also provides an archiving device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0126] This embodiment provides an archiving device, such as Figure 2 As shown, it includes: The target parameter value calculation module 201 is used to construct an abstract syntax tree based on the engineering parameter update instruction and calculate the target parameter value of the engineering parameter update instruction. The normalized string processing module 202 is used to fold the abstract syntax tree into a directed acyclic graph and perform serialization processing on the directed acyclic graph to obtain a normalized string; The current state hash value concatenation module 203 extracts the preceding hash value of the engineering parameter update instruction, concatenates the normalized string, the preceding hash value, the timestamp, and the random salt value, and performs a one-way hash operation to generate the current state hash value. The current state hash value is then encapsulated into a graph update instruction, wherein the random salt value is obtained by pre-setting. The archiving module 204 writes the target parameter value, timestamp, random salt value and current state hash value into the target parameter master node as indicated by the graph update instruction for archiving.
[0127] In one embodiment, the normalized string processing module 202 includes: The memoized cache dictionary building unit is used to perform a post-order traversal of a directed acyclic graph using a bottom-up hierarchical reduction strategy and build a memoized cache dictionary during the traversal process. The traversal unit is used to check whether the node identifier of the traversed node hits the memoized cache dictionary when traversing the directed acyclic graph. If it hits, the generated substring is directly extracted. If it does not hit, the current node attribute is extracted and recursively concatenated to generate a substring. The substring is then stored in the memoized cache dictionary with the node identifier as the key. The normalized string concatenation unit is used to concatenate the substrings of each node in a directed acyclic graph layer by layer until the root node. The string concatenated at the root node is the normalized string.
[0128] In one embodiment, the current state hash value concatenation module 203 includes: The original message construction unit is used to extract the binary stream of the preceding hash value, normalized string, timestamp and random salt value, and concatenate the binary stream of the preceding hash value, normalized string, timestamp and random salt value in a preset order to construct the original message; The hash calculation unit is used to perform hash calculations on the original message using a secure hash algorithm to obtain the current state hash value.
[0129] In one embodiment, the archiving module 204 includes: The parameter writing unit is used to locate the target parameter master node corresponding to the current input parameter set in the graph database indicated by the graph update command, instantiate the historical locked entity node in the target parameter master node, and write the target parameter value, timestamp, random salt value and current state hash value into the historical locked entity node for archiving. The current input parameter set is obtained by parsing the engineering parameter update command.
[0130] In one embodiment, the archiving device further includes: The version number verification module is used to verify the version number of the target parameter master node based on an optimistic concurrency control mechanism. The data tracing path construction module is used to construct data tracing paths based on the directed dependency edge relationships between historically locked entity nodes; The native shortcut edge endpoint update module is used to update the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node.
[0131] In one embodiment, the version number verification module includes: The expected version number extraction unit is used to extract the expected version number carried during the archiving process, and compare and exchange the verification with the latest version number currently recorded in the target parameter master node. The expected version number verification unit is used to verify the expected version number and the latest version number. If the verification is consistent, the operation is written and the latest version number on the target parameter master node is incremented synchronously. If the verification is inconsistent, the preset adaptive retry mechanism is triggered. The waiting time is set by the exponential backoff algorithm. After the waiting period, the latest node status is pulled again to calculate the expected version number and verify it. The retry continues until the number of retries exceeds the preset retry threshold, at which point a concurrency conflict exception is thrown to the upper layer.
[0132] In one embodiment, the data tracing path construction module includes: The loop detection unit is used to perform loop detection between historically locked entity nodes; The directed dependency edge building unit is used to create directed dependency edges between historically locked entity nodes that indicate the direction of data flow based on the computational dependency relationships between them. Multiple historically locked entity nodes are then joined together to form a data tracing path through these directed dependency edges.
[0133] In one embodiment, the native shortcut edge endpoint update module includes: The shortcut pointer extraction unit is used to extract the shortcut pointer of the target parameter master node, perform atomic pointer swap on the shortcut pointer, and reference the endpoint of the original shortcut edge to the address of the latest archived data. The data addressing unit is used to address the latest archived data of the current parameter along the reset native shortcut edge when a query request for the latest value of the parameter corresponding to the target parameter master node is received.
[0134] The archiving apparatus provided in this embodiment of the invention can execute the archiving method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0135] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0136] The following is a detailed reference. Figure 3 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 301, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 302 or a program loaded from memory 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device. The processor 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0137] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0138] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 309, or installed from a memory 308, or installed from a ROM 302. When the computer program is executed by the processor 301, it performs the functions defined in the archiving method of the embodiments of the present invention.
[0139] Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0140] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the archiving method shown in the above embodiments is implemented.
[0141] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0142] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
[0143] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. An archiving method, characterized in that, The method includes: Construct an abstract syntax tree based on the engineering parameter update instruction, and calculate the target parameter value of the engineering parameter update instruction; The abstract syntax tree is folded down to a directed acyclic graph, and the directed acyclic graph is serialized to obtain a normalized string; Extract the preceding hash value of the engineering parameter update instruction, concatenate the normalized string, the preceding hash value, the timestamp, and the random salt value, and perform a one-way hash operation to generate the current state hash value. Encapsulate the current state hash value into a graph update instruction, wherein the random salt value is obtained by pre-setting. The target parameter value, the timestamp, the random salt value, and the current state hash value are written into the target parameter master node as indicated by the graph update instruction for archiving.
2. The archiving method according to claim 1, characterized in that, The serialization process of the directed acyclic graph to output a normalized string includes: A bottom-up hierarchical reduction strategy is used to perform a post-order traversal of the directed acyclic graph, and a memoized cache dictionary is constructed during the traversal process. Query whether the node identifier of the traversed node during the traversal of the directed acyclic graph matches the memoized cache dictionary. If it matches, directly extract the generated substring. If it does not match, extract the current node attribute, perform recursive concatenation to generate a substring, and store the substring in the memoized cache dictionary with the node identifier as the key. The substrings of each node in the directed acyclic graph are concatenated layer by layer until the root node is reached. The concatenated string at the root node is the normalized string.
3. The method according to claim 1, characterized in that, The step of concatenating the normalized string, the predecessor hash value, the timestamp, and the random salt value, and performing a one-way hash operation to generate the current state hash value includes: Extract the binary stream of the preceding hash value, the normalized string, the timestamp, and the random salt value, and concatenate the binary stream of the preceding hash value, the normalized string, the timestamp, and the random salt value in a preset order to construct the original message; A secure hash algorithm is used to perform a hash calculation on the original message to obtain the current state hash value.
4. The method according to claim 1, characterized in that, The step of writing the target parameter value, the timestamp, the random salt value, and the current state hash value into the target parameter master node indicated by the graph update instruction for archiving includes: The target parameter master node corresponding to the current input parameter set is located in the graph database indicated by the graph update instruction. A historical locking entity node is instantiated in the target parameter master node. The target parameter value, the timestamp, the random salt value, and the current state hash value are written into the historical locking entity node for archiving. The current input parameter set is obtained by parsing the engineering parameter update instruction.
5. The method according to claim 4, characterized in that, After writing the target parameter value, the timestamp, the random salt value, and the current state hash value into the target parameter master node indicated by the graph update instruction for archiving, the method further includes: The version number of the master node for the target parameter is verified based on an optimistic concurrency control mechanism. A data tracing path is constructed based on the directed dependency edge relationships between the historical locked entity nodes; Update the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node.
6. The method according to claim 5, characterized in that, The step of performing version number verification of the target parameter master node based on the optimistic concurrency control mechanism includes: Extract the expected version number carried during the archiving process, and compare and exchange the verification with the latest version number currently recorded by the target parameter master node; If the verification is consistent, the write operation is performed and the latest version number on the target parameter master node is incremented synchronously. If the verification is inconsistent, a preset adaptive retry mechanism is triggered. The waiting time is set through an exponential backoff algorithm. After the waiting period ends, the latest node status is retrieved again to calculate the expected version number and perform verification. This continues until the number of retries exceeds the preset retry threshold, at which point a concurrency conflict exception is thrown to the upper layer.
7. The method according to claim 5, characterized in that, The step of constructing a data tracing path based on the directed dependency edge relationships between the historically locked entity nodes includes: Perform loop detection between the historically locked entity nodes; If a closed loop is detected, the construction of the data tracing path is terminated. If no closed loop is detected, a directed dependency edge indicating the data flow direction is created between the historically locked entity nodes based on the computational dependency relationship between them. The multiple historically locked entity nodes are then joined together to form a data tracing path through the directed dependency edge.
8. The method according to claim 5, characterized in that, The step of updating the endpoint reference of the native shortcut edge on the target parameter master node to the latest archived historical locked entity node includes: Extract the shortcut pointer of the target parameter master node, perform an atomic pointer swap on the shortcut pointer, and reference the endpoint of the original shortcut edge as the address of the latest archived data; When a query request for the latest value of the parameter corresponding to the target parameter master node is received, the latest archived data of the current parameter is addressed along the reset native shortcut edge.
9. An archiving apparatus for performing the archiving method according to any one of claims 1 to 8, characterized in that, include: The target parameter value calculation module is used to construct an abstract syntax tree based on the engineering parameter update instruction and calculate the target parameter value of the engineering parameter update instruction. The normalized string processing module is used to fold the abstract syntax tree into a directed acyclic graph and perform serialization processing on the directed acyclic graph to obtain a normalized string; The current state hash value concatenation module extracts the preceding hash value of the engineering parameter update instruction, concatenates the normalized string, the preceding hash value, the timestamp, and the random salt value, and performs a one-way hash operation to generate the current state hash value. The current state hash value is then encapsulated into a graph update instruction, wherein the random salt value is obtained by pre-setting. The archiving module writes the target parameter value, the timestamp, the random salt value, and the current state hash value into the target parameter master node as indicated by the graph update instruction for archiving.
10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the archiving method of any one of claims 1 to 8.
