A data storage method, device, apparatus and storage medium
By building a unified timeline storage mechanism in the parameter timing library and the transaction timing library, the data redundancy and performance issues under the traditional exchange rate processing method are solved, efficient data storage and retrieval are achieved, and system performance and resource utilization are improved.
Patent Information
- Application Number
- CN202310620672.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-05-29
AI Technical Summary
Traditional exchange rate processing methods lead to data storage redundancy and system performance degradation, especially in frequent transactions where exchange rate information is recorded for each transaction, wasting storage resources and reducing system processing performance.
A storage method that combines the parameter time series library and the transaction time series library is adopted. By obtaining the pending events at the target time point, parameter query events and parameter maintenance events are constructed respectively, and transaction information and exchange rate parameters are stored on the same reference time axis to avoid repeated recording of exchange rate information.
It improves storage resource utilization and system processing performance, reduces data storage redundancy, ensures data consistency and retrieval efficiency, and reduces the retrieval time complexity to a constant time. The API response time is at the millisecond level, and the throughput is no less than 1000tps.
Smart Images

Figure CN116662338B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a data storage method, apparatus, device, and storage medium. Background Art
[0002] As transaction volume increases, the corresponding transaction and parameter maintenance tasks become increasingly demanding. For financial institutions involved in cross-border transactions, handling returns, installment payments, and other innovative business scenarios amidst exchange rate fluctuations requires efficient and accurate calculation of transaction amounts during currency conversion.
[0003] Traditional exchange rate processing uses relational databases to store and manage exchange rate data. Specifically, exchange rate data is bound to transaction data, and both transaction data and exchange rate information are aggregated during each transaction. However, exchange rate fluctuations are much less frequent than transactions. Therefore, recording exchange rate information for every transaction results in redundant data storage, which in turn wastes storage resources and reduces system processing performance. Summary of the Invention
[0004] Embodiments of the present application provide a data storage method, apparatus, device, and storage medium for improving storage resource utilization and system processing performance.
[0005] In one aspect, an embodiment of the present application provides a data storage method, including:
[0006] Get the pending events at the target time point;
[0007] If the pending event is a transaction processing event, obtaining a first exchange rate parameter associated with the pending event from a parameter timing library, and constructing a first parameter query event based on the first exchange rate parameter; and storing the first parameter query event and transaction information in the pending event in a transaction timing library, where the parameter timing library and the transaction timing library correspond to the same reference timeline.
[0008] If the to-be-processed time is a parameter processing event, a first parameter maintenance event is constructed based on the type of the parameter processing event, and the first parameter maintenance event and a second exchange rate parameter associated with the first parameter processing event are saved in the parameter timing library.
[0009] In one aspect, an embodiment of the present application provides a data storage device, comprising:
[0010] The acquisition module is used to obtain the pending events at the target time point;
[0011] a processing module configured to, if the event to be processed is a transaction processing event, obtain a first exchange rate parameter associated with the event to be processed from a parameter time series library, and construct a first parameter query event based on the first exchange rate parameter; and store the first parameter query event and transaction information in the event to be processed in a transaction time series library, wherein the parameter time series library and the transaction time series library correspond to the same reference time axis;
[0012] The processing module is further configured to, if the to-be-processed time is a parameter processing event, construct a first parameter maintenance event based on the type of the parameter processing event, and save the first parameter maintenance event and the second exchange rate parameter associated with the first parameter processing event in the parameter timing library.
[0013] Optionally, the processing module is specifically configured to:
[0014] The exchange rate parameter of the historical time point closest to the target time point in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0015] Optionally, the processing module is specifically configured to:
[0016] Obtaining associated transactions of the pending event from the transaction sequence library;
[0017] The exchange rate parameter at the historical time point corresponding to the associated transaction in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0018] Optionally, the processing module is specifically configured to:
[0019] Obtaining a second parameter query event of the associated transaction from the transaction time sequence library;
[0020] The first parameter query event is constructed based on the first exchange rate parameter and the second parameter query event.
[0021] Optionally, the processing module is specifically configured to:
[0022] If the type of the parameter processing event is a parameter addition type, constructing a first parameter maintenance event based on the parameter addition type;
[0023] Optionally, the processing module is specifically configured to:
[0024] If the type of the parameter processing event is a parameter change type, obtaining, from the parameter time series library, a second exchange rate parameter at a historical time point closest to the target time point, and a second parameter maintenance event corresponding to the second exchange rate parameter at the historical time point;
[0025] A first parameter maintenance event is constructed based on the parameter change type and the second parameter maintenance event.
[0026] Optionally, the processing module is specifically configured to:
[0027] Read pending events at the target time point from the event queue.
[0028] Optionally, a backtracking module is also included;
[0029] The backtracking module is specifically used for:
[0030] Obtaining transaction information recorded at multiple time points within the time period to be traced back from the transaction time series library, and generating a transaction chain based on the obtained transaction information;
[0031] The exchange rate parameters recorded at multiple time points within the time period to be backdated are obtained from the parameter time series library, and an exchange rate change chain is generated based on the obtained exchange rate parameters.
[0032] On the one hand, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data storage method when executing the program.
[0033] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by a computer device. When the program is run on the computer device, the computer device executes the steps of the above-mentioned data storage method.
[0034] In an embodiment of the present application, if the pending event is a transaction processing event, a corresponding parameter query event is constructed, and the parameter query event and the transaction information in the pending event are stored in the transaction time series library. If the pending event is a parameter processing event, a corresponding parameter maintenance event is constructed, and the parameter maintenance event and the exchange rate parameter are associated and stored in the parameter time series library. Therefore, it is not necessary to record the corresponding exchange rate information for each transaction, avoiding data storage redundancy, improving the utilization rate of storage resources and the processing performance of the system. Secondly, the parameter time series library and the transaction time series library use the same reference time axis to store and manage data, so that the retrieval time complexity is constant time complexity. In addition, the storage mechanism of event binding data is used to store the transaction time series data and the exchange rate parameter time series data, so that the time series data recorded in the parameter time series library and the transaction time series library directly reflect the business processing process, ensuring the consistency of the data information carried by the dual time series database with the actual business information, without the need to introduce additional intermediate data and without losing the real data of the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 A schematic diagram of the structure of a system architecture provided in an embodiment of the present application;
[0037] Figure 2A A schematic diagram of the structure of a distributed microservice architecture provided in an embodiment of the present application;
[0038] Figure 2B A regional diagram of a dual-time service life cycle provided in an embodiment of the present application;
[0039] Figure 2C A schematic diagram of the structure of a dual time series database provided in an embodiment of the present application;
[0040] Figure 3 A flowchart of a data storage method provided in an embodiment of the present application;
[0041] Figure 4 A flowchart of an event dispatching method provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of data records in a transaction sequence library provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of data recording of a parameter timing library provided in an embodiment of the present application;
[0044] Figure 7 A schematic diagram of data records of a parameter timing library and a transaction timing library provided in an embodiment of the present application;
[0045] Figure 8 A flowchart of a data storage method provided in an embodiment of the present application;
[0046] Figure 9 A schematic structural diagram of a data storage device provided in an embodiment of the present application;
[0047] Figure 10 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and beneficial effects of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0049] refer to Figure 1 , which is a system architecture diagram applicable to an embodiment of the present application. The system architecture includes at least a terminal device 101 and a server 102. The number of terminal devices 101 can be one or more, and the number of servers 102 can also be one or more. This application does not specifically limit the number of terminal devices 101 and servers 102.
[0050] The terminal device 101 is pre-installed with service applications, where the service applications include client applications, web applications, mini-program applications, etc. The terminal device 101 can be a smartphone, tablet computer, laptop computer, desktop computer, smart home appliance, smart voice interaction device, smart car device, etc., but is not limited thereto.
[0051] Server 102 is a backend server for business applications. Server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0052] In some embodiments, see Figure 2A Server 102 is a distributed microservice architecture that provides external services through a unified Application Programming Interface (API) gateway. The distributed microservice architecture includes multiple microservices 201, which interact and process messages through asynchronous message middleware 202. Each microservice corresponds to a dedicated dual-time series database 203, which is used to store dual-time series business data (time series data of exchange rate parameters and time series data of transactions) and persist it to file 204 using virtualization mapping technology.
[0053] See also Figure 2BThis is a dual-time-series domain diagram of the service lifecycle. The diagram includes the pre-event domain, service preparation domain, failure domain, service lifecycle domain 1, and service lifecycle domain 2. The exchange rates and transactions in the pre-event domain have not yet occurred and are therefore meaningless. Transactions in the failure domain have already occurred but no corresponding exchange rate configuration exists. In the service preparation domain, the exchange rate is ready, but the transaction has not yet occurred. Service lifecycle domain 1 indicates that the exchange rate updated at update time 1 has already been used in transactions. Service lifecycle domain 2 indicates that the exchange rate updated at update time 2 has already been used in transactions.
[0054] In some embodiments, the specific architecture of the dual time series database 203 is as follows: Figure 2C As shown, the dual time series database 203 is divided into multiple storage groups based on capacity. Each storage group can be further divided into multiple blocks, each of which stores time series data for exchange rate parameters and transactions. Dual time series database 203 persists fully written block data to file 204 using virtualization mapping technology. By grouping and sharding the dual time series database, the efficiency of parallel data query and processing is improved.
[0055] The following describes a process of a data storage method provided by an embodiment of the present application. Figure 3 As shown, the process of the method is executed by a computer device, which may be Figure 1 The terminal device 101 and / or server 102 shown includes the following steps:
[0056] Step S301: Obtain the event to be processed at the target time point.
[0057] Specifically, the dual time series database includes a parameter time series database and a transaction time series database, both of which are memory-mapped and stored in data blocks. The time series data for exchange rate parameters at each point in time is stored in a block, and similarly, the time series data for transactions at each point in time is also stored in a block. Therefore, the latency of the recall process depends on the latency of both the data block retrieval and the memory mapping process. Data blocks are retrieved using a hash of the timeline, and data block memory virtualization technology maps data blocks as a whole at each time point. Both latency levels are in the millisecond range, resulting in short data recall latency.
[0058] Time series databases require that events be processed in strict accordance with the time sequence. Confusion of the sequence will lead to unexpected results in storing data in extreme scenarios, which will cause data unreliability. Therefore, this application uses an event processor to read the pending events at the target time point from the event queue. Specifically, see Figure 4The event queue 401 is a first-in, first-out queue. The event processor 402 takes out the pending events from the event queue one by one according to the first-come, first-served principle and distributes them to the dual time series database 403.
[0059] Step S302: If the event to be processed is a transaction processing event, obtain a first exchange rate parameter associated with the event to be processed from the parameter sequence library, construct a first parameter query event based on the first exchange rate parameter, and save the transaction information in the first parameter query event and the event to be processed in the transaction sequence library.
[0060] Specifically, see Figure 5 Each time point T in the transaction time series database contains multiple data records 501. Each data record includes transaction information 502 and a corresponding parameter query event 503. Transaction information 502 includes the transaction date, transaction primary key, and transaction content. Parameter query event 503 includes event type, exchange rate parameter, previous associated event, and subsequent associated event. If the event type is query, the previous associated event refers to the parameter query event for the previous associated transaction, and the subsequent associated event refers to the parameter query event for the subsequent associated transaction. It should be noted that the previous associated event and the subsequent associated event are optional data items in the data record.
[0061] In some embodiments, the exchange rate parameter at the historical time point closest to the target time point in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0062] Specifically, when the pending event is a newly initiated consumer transaction, the consumer transaction has no preceding associated transaction, and the consumer transaction needs to be processed according to the latest exchange rate. Therefore, the exchange rate parameter of the historical time point closest to the target time point is obtained from the parameter time series library as the first exchange rate parameter. Since the pending event has no preceding associated transaction, the preceding associated event in the first parameter query event is empty. If the pending event is also a termination transaction, the subsequent associated event in the first parameter query event is also empty. If the pending event is not a termination transaction, wait until the subsequent associated transaction of the pending event is executed, and then use the parameter query event of the subsequent associated transaction as the subsequent associated event in the first parameter query event. The first parameter query event also includes: event type (query), first exchange rate parameter. According to Figure 5 In the format shown, the transaction information in the first parameter query event and the pending event is saved in the transaction sequence library.
[0063] In some embodiments, associated transactions of the pending event are obtained from a transaction sequence library; exchange rate parameters at historical time points corresponding to the associated transactions in a parameter sequence library are used as first exchange rate parameters associated with the pending event; a second parameter query event for the associated transaction is obtained from the transaction sequence library; and a first parameter query event is constructed based on the first exchange rate parameter and the second parameter query event.
[0064] Specifically, when the pending event includes a related transaction and the processing of the pending event depends on the exchange rate parameters corresponding to the related transaction, the exchange rate parameters corresponding to the historical time point of the related transaction are obtained from the parameter time series library as the first exchange rate parameter. For example, if the pending event is a return event, the return event has an associated consumer transaction, and the return must be processed according to the exchange rate parameters corresponding to the consumer transaction. Therefore, the exchange rate parameters corresponding to the consumer transaction are obtained.
[0065] Furthermore, if a related transaction is a predecessor related transaction of a pending event, the predecessor related event in the first parameter query event is the second parameter query event of the related transaction. If the pending event is also a final transaction, the subsequent related event in the first parameter query event is empty. If the pending event is not a final transaction, the parameter query event of the subsequent related transaction is used as the subsequent related event in the first parameter query event after the subsequent related transaction of the pending event is completed.
[0066] The first parameter query event also includes: event type (query), first exchange rate parameter. Figure 5 In the format shown, the transaction information in the first parameter query event and the pending event is saved in the transaction sequence library.
[0067] In some embodiments, when the event to be processed includes an associated transaction, but the processing of the event to be processed does not depend on the exchange rate parameter corresponding to the processing of the associated transaction, the exchange rate parameter of the historical time point closest to the target time point in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0068] Furthermore, if a related transaction is a predecessor related transaction of a pending event, the predecessor related event in the first parameter query event is the second parameter query event of the related transaction. If the pending event is also a final transaction, the subsequent related event in the first parameter query event is empty. If the pending event is not a final transaction, the parameter query event of the subsequent related transaction is used as the subsequent related event in the first parameter query event after the subsequent related transaction of the pending event is completed.
[0069] The first parameter query event also includes: event type (query), first exchange rate parameter. Figure 5In the format shown, the transaction information in the first parameter query event and the pending event is saved in the transaction sequence library.
[0070] Step S303: If the time to be processed is a parameter processing event, a first parameter maintenance event is constructed based on the type of the parameter processing event, and the first parameter maintenance event and the second exchange rate parameter associated with the first parameter processing event are saved in a parameter time series library.
[0071] Specifically, see Figure 6 Each time point T in the parameter time series library contains multiple data records 601. Each data record 601 includes an exchange rate parameter 602 and a corresponding parameter maintenance event 602. The exchange rate parameter 601 includes the exchange rate date, base currency, conversion currency, and exchange rate value. A parameter maintenance event 602 includes an event type, a preceding associated event, and a subsequent associated event. Event types include addition, modification, and deletion. A preceding associated event refers to a parameter maintenance event associated with a preceding parameter change, while a subsequent associated event refers to a parameter maintenance event associated with a preceding parameter change. It should be noted that preceding and subsequent associated events are optional data items in a data record.
[0072] In some embodiments, if the type of the parameter processing event is a parameter addition type, a first parameter maintenance event is constructed based on the parameter addition type.
[0073] Specifically, when the type of the parameter processing event is a parameter addition type, the parameter processing event does not have a parameter maintenance event for the preceding parameter change. Therefore, the preceding associated event in the first parameter maintenance event is empty. After waiting for the subsequent parameter change of the pending event to be processed to be completed, the parameter maintenance event for the subsequent parameter change is used as the subsequent associated event in the first parameter maintenance event. The first parameter maintenance event also includes: event type (new). The second exchange rate parameter is directly obtained from the parameter processing event. According to Figure 6 In the format shown, the first parameter maintenance event and the second exchange rate parameter are saved in the transaction sequence library.
[0074] In some embodiments, if the type of the parameter processing event is a parameter change type, the second exchange rate parameter of the historical time point closest to the target time point and the second parameter maintenance event corresponding to the second exchange rate parameter at the historical time point are obtained from the parameter timing library; based on the parameter change type and the second parameter maintenance event, a first parameter maintenance event is constructed.
[0075] Specifically, the parameter change type includes the deletion type and the modification type. Accordingly, the second exchange rate parameter is the exchange rate parameter that needs to be deleted or modified. The second parameter maintenance event is the preceding associated event of the parameter processing event; after the subsequent parameter change of the pending event is completed, the parameter maintenance event of the subsequent parameter change is used as the subsequent associated event in the first parameter maintenance event. The first parameter maintenance event also includes: event type (new or modified). According to Figure 6 In the format shown, the first parameter maintenance event and the second exchange rate parameter are saved in the transaction sequence library.
[0076] In an embodiment of the present application, if the pending event is a transaction processing event, a corresponding parameter query event is constructed, and the parameter query event and the transaction information in the pending event are stored in the transaction time series library. If the pending event is a parameter processing event, a corresponding parameter maintenance event is constructed, and the parameter maintenance event and the exchange rate parameter are associated and stored in the parameter time series library. Therefore, it is not necessary to record the corresponding exchange rate information for each transaction, avoiding data storage redundancy, improving storage resource utilization and system processing performance. Secondly, the parameter time series library and the transaction time series library use the same reference time axis to store and manage data, so that the retrieval time complexity is constant time complexity, the overall API response time is in the millisecond level, and the device throughput is not less than 1000 tps. In addition, the transaction time series data and the exchange rate parameter time series data are stored through the event binding data storage mechanism, so that the time series data recorded by the parameter time series library and the transaction time series library directly reflect the business processing process, ensuring the consistency of the data information carried by the dual time series database with the actual business information, without the need to introduce additional intermediate data and without losing real business data.
[0077] In some embodiments, transaction information recorded at multiple time points within the time period to be backtracked is obtained from a transaction time series library, and a transaction chain is generated based on the obtained transaction information; exchange rate parameters recorded at multiple time points within the time period to be backtracked are obtained from a parameter time series library, and an exchange rate change chain is generated based on the obtained exchange rate parameters.
[0078] Specifically, the parameter time series library and the transaction time series library correspond to the same reference time axis. The parameter time series library and the transaction time series library use time points to store and manage data.
[0079] For example, see Figure 7 The reference timeline is set to include time points T1, T2, and T3. For time point T1, the parameter time series library includes: exchange rate parameter 1 (corresponding to conversion currency 1), exchange rate parameter 2 (corresponding to conversion currency 2), exchange rate parameter m (corresponding to conversion currency m), and corresponding parameter maintenance events; the transaction time series library includes: transaction information 1, transaction information 2, ..., transaction information x, and corresponding parameter query events, where x is a positive integer.
[0080] For time point T2, the parameter timing library includes: exchange rate parameter 1 (corresponding to conversion currency 1), exchange rate parameter n (corresponding to conversion currency n), exchange rate parameter m (corresponding to conversion currency m) and corresponding parameter maintenance events; the transaction timing library includes: transaction information 1, transaction information 2, ..., transaction information y and corresponding parameter query events, where y is a positive integer.
[0081] For time point T3, the parameter timing library includes: exchange rate parameter 1 (corresponding to conversion currency 1), exchange rate parameter m (corresponding to conversion currency m) and corresponding parameter maintenance events; the transaction timing library includes: transaction information 1, transaction information 2, ..., transaction information z and corresponding parameter query events, where z is a positive integer.
[0082] By connecting the exchange rate parameter 1 at time point T1, the exchange rate parameter 1 at time point T2, and the exchange rate parameter 1 at time point T3, an exchange rate change chain corresponding to conversion currency 1 can be obtained.
[0083] Assuming that transaction information 1 at time point T1 and transaction information 2 at time point T3 are related transactions, the transaction information 1 at time point T1 and the transaction information 2 at time point T3 are connected to obtain a transaction chain.
[0084] In the embodiments of this application, an exchange rate change chain and transaction chain, constructed through an event backtracking mechanism bound to a unified timeline, simplify the process of data changes, event triggering, and backtracking. Implementing the exchange rate change chain and transaction chain based on the time binding mechanism reduces the complexity of representing associated data. The use of linked list data retrieval to implement event backtracking eliminates the need to consider temporal correspondences and business dependencies, reducing the complexity of understanding business scenarios in areas such as device operation monitoring and troubleshooting.
[0085] In order to better explain the embodiment of the present application, the following describes a data storage method provided by the embodiment of the present application in combination with a specific implementation scenario. The process of the method can be as follows: Figure 1 The server 102 shown executes, as Figure 8 As shown:
[0086] At X time on day T, a new exchange rate parameter for converting currency n is added. The exchange rate value in the exchange rate parameter is 6.1. A parameter maintenance event is created based on the event type (new), and the parameter maintenance event and exchange rate parameter are saved in the parameter time series library.
[0087] At time X on day T, a consumption transaction associated with conversion currency n also occurs. The latest exchange rate parameter for conversion currency n is queried. The exchange rate parameter value is 6.1. A parameter query event is then constructed based on the exchange rate parameter, and the parameter query event and consumption transaction information are saved in the transaction time series database.
[0088] At time Y on day T, the exchange rate parameter for currency n changes, that is, the exchange rate value for currency n increases from 6.1 to 6.3. Based on the event type (modification) and the preceding associated event (querying the parameter maintenance event for currency n on day T at time X), a parameter maintenance event is constructed, and the parameter maintenance event and exchange rate parameter are saved in the parameter time series library.
[0089] At Z on day T, a return transaction associated with a purchase transaction occurs. The exchange rate parameter for converting currency n at the time of the purchase transaction is queried, which corresponds to an exchange rate of 6.1. A parameter query event is constructed based on the exchange rate parameter, and the parameter query event and return transaction information are saved in the transaction time series database.
[0090] At time U on day T, the exchange rate parameter for the conversion currency n changes, that is, the exchange rate value of the conversion currency n increases from 6.3 to 6.4. Based on the event type (modification) and the preceding associated event (querying the parameter maintenance event for the conversion currency n at time Y on day T), a parameter maintenance event is constructed, and the parameter maintenance event and exchange rate parameter are saved in the parameter time series library.
[0091] When tracing back the entire exchange rate change and transaction process, the exchange rate change chain can be obtained based on the exchange rate parameters and corresponding parameter maintenance events at three time points: X:00 on day T, Y:00 on day T, and U:00 on day T. The transaction chain can also be obtained based on the transaction information and corresponding parameter query events at X:00 on day T and Z:00 on day T.
[0092] In the embodiments of this application, an exchange rate change chain and transaction chain, constructed through an event backtracking mechanism bound to a unified timeline, simplify the process of data changes, event triggering, and backtracking. Implementing the exchange rate change chain and transaction chain based on the time binding mechanism reduces the complexity of representing associated data. The use of linked list data retrieval to implement event backtracking eliminates the need to consider temporal correspondences and business dependencies, reducing the complexity of understanding business scenarios in areas such as device operation monitoring and troubleshooting.
[0093] Based on the same technical concept, the embodiment of the present application provides a structural diagram of a data storage device, such as Figure 9 As shown, the apparatus 900 includes:
[0094] Acquisition module 901, used to acquire the pending events at the target time point;
[0095] Processing module 902 is configured to, if the pending event is a transaction processing event, obtain a first exchange rate parameter associated with the pending event from a parameter time series library, construct a first parameter query event based on the first exchange rate parameter, and store the first parameter query event and transaction information in the pending event in a transaction time series library, where the parameter time series library and the transaction time series library correspond to the same reference timeline.
[0096] The processing module 902 is further configured to, if the to-be-processed time is a parameter processing event, construct a first parameter maintenance event based on the type of the parameter processing event, and save the first parameter maintenance event and the second exchange rate parameter associated with the first parameter processing event in the parameter timing library.
[0097] Optionally, the processing module 902 is specifically configured to:
[0098] The exchange rate parameter of the historical time point closest to the target time point in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0099] Optionally, the processing module 902 is specifically configured to:
[0100] Obtaining associated transactions of the pending event from the transaction sequence library;
[0101] The exchange rate parameter at the historical time point corresponding to the associated transaction in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
[0102] Optionally, the processing module 902 is specifically configured to:
[0103] Obtaining a second parameter query event of the associated transaction from the transaction time sequence library;
[0104] The first parameter query event is constructed based on the first exchange rate parameter and the second parameter query event.
[0105] Optionally, the processing module 902 is specifically configured to:
[0106] If the type of the parameter processing event is a parameter addition type, constructing a first parameter maintenance event based on the parameter addition type;
[0107] Optionally, the processing module 902 is specifically configured to:
[0108] If the type of the parameter processing event is a parameter change type, obtaining, from the parameter time series library, a second exchange rate parameter at a historical time point closest to the target time point, and a second parameter maintenance event corresponding to the second exchange rate parameter at the historical time point;
[0109] A first parameter maintenance event is constructed based on the parameter change type and the second parameter maintenance event.
[0110] Optionally, the processing module 902 is specifically configured to:
[0111] Read pending events at the target time point from the event queue.
[0112] Optionally, a backtracking module 903 is further included;
[0113] The backtracking module 903 is specifically used for:
[0114] Obtaining transaction information recorded at multiple time points within the time period to be traced back from the transaction time series library, and generating a transaction chain based on the obtained transaction information;
[0115] The exchange rate parameters recorded at multiple time points within the time period to be backdated are obtained from the parameter time series library, and an exchange rate change chain is generated based on the obtained exchange rate parameters.
[0116] In the embodiments of the present application, when the pending event is a transaction processing event, a corresponding parameter query event is constructed, and the parameter query event and the transaction information in the pending event are stored in the transaction time series library. When the pending event is a parameter processing event, a corresponding parameter maintenance event is constructed, and the parameter maintenance event is associated with the exchange rate parameter and stored in the parameter time series library. Therefore, it is not necessary to record the corresponding exchange rate information for each transaction, avoiding data storage redundancy, improving storage resource utilization and system processing performance. Secondly, the parameter time series library and the transaction time series library use the same reference time axis to store and manage data, making the retrieval time complexity constant. In addition, the storage mechanism of event-bound data is used to store the transaction time series data and the exchange rate parameter time series data. This allows the time series data recorded in the parameter time series library and the transaction time series library to directly reflect the business processing process, ensuring the consistency of the data information carried by the dual time series database with the actual business information, without the need to introduce additional intermediate data and without losing the real business data. The exchange rate change chain and transaction chain constructed by the event backtracking mechanism bound to the unified time axis simplify the exchange rate data change, event triggering, and backtracking process.
[0117] Based on the same technical concept, the embodiment of the present application provides a computer device, which can be Figure 1 The terminal device and / or server shown, such as Figure 10 As shown, it includes at least one processor 1001 and a memory 1002 connected to the at least one processor. The specific connection medium between the processor 1001 and the memory 1002 is not limited in the embodiment of the present application. Figure 10For example, the processor 1001 and the memory 1002 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.
[0118] In an embodiment of the present application, the memory 1002 stores instructions that can be executed by at least one processor 1001. The at least one processor 1001 can perform the steps of the above-mentioned data storage method by executing the instructions stored in the memory 1002.
[0119] The processor 1001 is the control center of the computer device and can connect various parts of the computer device using various interfaces and lines. It can realize dual-time service data storage by running or executing instructions stored in the memory 1002 and calling data stored in the memory 1002. Optionally, the processor 1001 may include one or more processing units. The processor 1001 may integrate an application processor and a modem processor. The application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understood that the modem processor may not be integrated into the processor 1001. In some embodiments, the processor 1001 and the memory 1002 may be implemented on the same chip. In some embodiments, they may also be implemented on separate chips.
[0120] The processor 1001 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0121] Memory 1002 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory 1002 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. Memory 1002 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer device, but is not limited thereto. The memory 1002 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0122] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by a computer device. When the program runs on the computer device, the computer device executes the steps of the above-mentioned data storage method.
[0123] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0124] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer device or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer readable memory that can direct a computer device or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer device or other programmable data processing device so that a series of operating steps are executed on the computer device or other programmable device to produce a process implemented by the computer device, thereby providing instructions for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0127] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0128] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A data storage method, characterized in that: include: Get the pending events at the target time point; If the event to be processed is a transaction processing event, obtaining a first exchange rate parameter associated with the event to be processed from a parameter time series library, and constructing a first parameter query event based on the first exchange rate parameter; and storing the transaction information in the first parameter query event and the pending event in a transaction sequence library, wherein the parameter sequence library and the transaction sequence library correspond to the same reference time axis; If the event to be processed is a parameter processing event, a first parameter maintenance event is constructed based on the type of the parameter processing event, and the first parameter maintenance event and a second exchange rate parameter associated with the first parameter maintenance event are saved in the parameter time series library.
2. The method according to claim 1, wherein The acquiring the first exchange rate parameter associated with the event to be processed from the parameter time series library includes: The exchange rate parameter of the historical time point closest to the target time point in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
3. The method according to claim 1, wherein The acquiring the first exchange rate parameter associated with the event to be processed from the parameter time series library includes: Obtaining associated transactions of the pending event from the transaction sequence library; The exchange rate parameter at the historical time point corresponding to the associated transaction in the parameter time series library is used as the first exchange rate parameter associated with the event to be processed.
4. The method according to claim 3, wherein The constructing a first parameter query event based on the first exchange rate parameter includes: Obtaining a second parameter query event of the associated transaction from the transaction time sequence library; The first parameter query event is constructed based on the first exchange rate parameter and the second parameter query event.
5. The method according to claim 1, wherein The constructing a first parameter maintenance event based on the type of the parameter processing event includes: If the type of the parameter processing event is a parameter addition type, a first parameter maintenance event is constructed based on the parameter addition type.
6. The method according to claim 1, wherein The constructing a first parameter maintenance event based on the type of the parameter processing event includes: If the type of the parameter processing event is a parameter change type, obtaining, from the parameter time series library, a second exchange rate parameter at a historical time point closest to the target time point, and a second parameter maintenance event corresponding to the second exchange rate parameter at the historical time point; A first parameter maintenance event is constructed based on the parameter change type and the second parameter maintenance event.
7. The method according to claim 1, wherein The obtaining of pending events at a target time point includes: Read pending events at the target time point from the event queue.
8. The method according to any one of claims 1 to 7, characterized in that Also includes: Obtaining transaction information recorded at multiple time points within the time period to be backdated from the transaction time series library, and generating a transaction chain based on the obtained transaction information; The exchange rate parameters recorded at multiple time points within the time period to be backdated are obtained from the parameter time series library, and an exchange rate change chain is generated based on the obtained exchange rate parameters.
9. A data storage device, characterized in that include: The acquisition module is used to obtain the pending events at the target time point; a processing module configured to, if the event to be processed is a transaction processing event, obtain a first exchange rate parameter associated with the event to be processed from a parameter time series library, and construct a first parameter query event based on the first exchange rate parameter; and storing the transaction information in the first parameter query event and the pending event in a transaction sequence library, wherein the parameter sequence library and the transaction sequence library correspond to the same reference time axis; The processing module is further configured to, if the event to be processed is a parameter processing event, construct a first parameter maintenance event based on the type of the parameter processing event, and save the first parameter maintenance event and a second exchange rate parameter associated with the first parameter maintenance event in the parameter timing library.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that It stores a computer program that can be executed by a computer device. When the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 8.
Citation Information
Patent Citations
Exchange rate transaction method, device, equipment, system and storage medium
CN113781046A
Equipment data query method and device, server and computer readable storage medium
CN114356958A