A method and apparatus for service data management
By dynamically allocating storage space and establishing the association between auxiliary storage space and business identifiers in business scenarios with simple data structures, the problem of MySQL resource waste is solved, and efficient business data management and cost savings are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2026-03-17
AI Technical Summary
In business scenarios with simple data structures and applications, using MySQL databases leads to resource waste, lacks advanced features, and results in increased storage costs and low management efficiency.
By dynamically allocating storage space based on business identifiers, establishing the association between auxiliary storage space and business identifiers, and utilizing hash mapping and index files, business events can be successfully written, including the dynamic allocation of storage space and auxiliary storage space.
It achieves cost savings in storage without requiring dedicated database management, and improves the efficiency of business data management and the simplicity and efficiency of the write process.
Smart Images

Figure CN116842002B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for business data management. Background Technology
[0002] Data, as the carrier of information, embodies vital resources across various business areas. Effective data management allows for better utilization of these resources. Currently, with the development of database technology, various types of databases are emerging, and MySQL is widely used due to its stable performance and rich functionality.
[0003] In the process of realizing this invention, the inventors discovered the following problems in the prior art:
[0004] In practice, for some business scenarios with simple data structures and simple applications, such as package tracking, package tracking includes various stages such as packaging, transportation, and delivery. This massive amount of business data is generally only used for querying, and the events do not need to be updated. It does not involve advanced features of the MySQL database, so using MySQL is not particularly economical, resulting in a waste of database resources. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for business data management. Based on the storage space obtained by the business identifier, when the storage space is insufficient to meet the volume of business event data, auxiliary storage space is allocated, and a relationship between the auxiliary storage space and the business identifier is established. Business events are written to the storage space determined by the business identifier and the auxiliary storage space. Through this method of dynamically allocating storage space and auxiliary storage space, the smooth writing of business events is guaranteed. This not only eliminates the need for dedicated database management, saving storage costs, but also makes the writing process simple and efficient, improving the management efficiency of business data.
[0006] To achieve the aforementioned objective, according to one aspect of the present invention, a method for business data management is provided, comprising:
[0007] Obtain a business event write request, wherein the business corresponds to multiple business events, and the request includes a business identifier;
[0008] Obtain the storage space corresponding to the service based on the service identifier;
[0009] Determine whether the storage space meets the data volume of the business event, and if not, allocate auxiliary storage space for the business, and establish an association between the auxiliary storage space and the business identifier;
[0010] The storage space to be stored for the service is obtained according to the service identifier, and the service event is written into the storage space to be stored. The storage space to be stored includes the storage space and the auxiliary storage space.
[0011] Optionally, establishing the association between the auxiliary storage space and the service identifier includes: establishing the association between the auxiliary storage space and the service identifier by creating an index file; before obtaining the storage space corresponding to the service based on the service identifier, the method further includes: in response to allocating storage space for the service, establishing the association between the storage space and the service identifier by creating an index file.
[0012] Optionally, obtaining the storage space to be stored for the service based on the service identifier includes: performing a hash mapping process on the service identifier to obtain an index value corresponding to the service; and searching for the storage space to be stored for the service from the index file based on the index value.
[0013] Optionally, the index file includes: a spatial index file and a service index file; finding the storage space for the service from the index file according to the index value includes: reading the space information corresponding to the service from the service index file according to the index value, the space information including the space information of the storage space and the space information of the auxiliary storage space; and determining the storage space for the service according to the space information through the spatial index file.
[0014] Optionally, the method further includes: in response to a business event read request, reading spatial information corresponding to the business from the business index file according to the index value corresponding to the business; determining the storage space and auxiliary storage space corresponding to the business according to the spatial information and the spatial index file, wherein the storage space and the auxiliary storage space include a start position and an end position; reading business event data stored in the storage space and the auxiliary storage space according to the start position and the end position, and segmenting the business event data according to the delimiter between business events to obtain each business event corresponding to the business.
[0015] Optionally, after writing the business event into the storage space, the method further includes: determining whether the business event is the end event of the business; if so, the process ends; otherwise, determining whether the storage space for the business is full; if so, allocating auxiliary storage space for the business again; otherwise, the process ends.
[0016] Optionally, the service corresponds to a preset number of service events, and each service event has a preset size; when allocating storage space or auxiliary storage space for the service, the size of the allocated storage space or auxiliary storage space is determined based on the remaining service events of the service and the preset size of each remaining service event.
[0017] Optionally, the method further includes: after the lifecycle of all business events corresponding to the business ends, transferring the business events corresponding to the business to a new storage space; and deleting the business event data in the original storage space where there is empty space.
[0018] According to a second aspect of the present invention, a business data management apparatus is provided, comprising:
[0019] The write request acquisition module is used to acquire business event write requests, wherein the business corresponds to multiple business events, and the request includes a business identifier;
[0020] A storage space acquisition module is used to obtain the storage space corresponding to the service based on the service identifier;
[0021] The storage space determination module is used to determine whether the storage space meets the data volume of the business event, and if not, to allocate auxiliary storage space for the business and establish an association between the auxiliary storage space and the business identifier.
[0022] The business event writing module is used to obtain the storage space to be stored for the business based on the business identifier, and write the business event into the storage space to be stored, wherein the storage space to be stored includes the storage space and the auxiliary storage space.
[0023] According to a third aspect of the present invention, an electronic device for business data management is provided, characterized in that it comprises:
[0024] One or more processors;
[0025] Storage device for storing one or more programs.
[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiments of the present invention.
[0027] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.
[0028] One embodiment of the invention has the following advantages or beneficial effects: By obtaining a business event write request, where a business corresponds to multiple business events and the request includes a business identifier; obtaining the storage space corresponding to the business based on the business identifier; determining whether the storage space meets the data volume of the business event, and allocating auxiliary storage space for the business if it does not, and establishing an association between the auxiliary storage space and the business identifier; obtaining the storage space to be stored for the business based on the business identifier, and writing the business event into the storage space to be stored, where the storage space to be stored includes the storage space and the auxiliary storage space, this technical solution realizes that storage space obtained based on the business identifier, when the storage space does not meet the data volume of the business event, allocates auxiliary storage space, establishes a relationship between the auxiliary storage space and the business identifier, and writes the business event into the storage space and the auxiliary storage space determined by the business identifier. Through this method of dynamically allocating storage space and auxiliary storage space, the smooth writing of business events is guaranteed. This not only eliminates the need for dedicated database management, saving storage costs, but also makes the writing process simple and efficient, improving the management efficiency of business data. Attached Figure Description
[0029] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0030] Figure 1 This is a schematic diagram of the main flow of a business data management method according to an embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of the business data writing process according to an embodiment of the present invention;
[0032] Figure 3 This is a schematic diagram of the main modules of a business data management device according to an embodiment of the present invention;
[0033] Figure 4 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0034] Figure 5 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0035] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0036] Currently, for some business scenarios with simple data structures and applications, the use of MySQL results in a waste of database resources because its data management does not involve advanced features of the MySQL database, and it cannot well meet the actual application needs.
[0037] To address the aforementioned problems in existing technologies, this invention proposes a method for business data management. Based on the storage space obtained from the business identifier, when the storage space is insufficient to handle the volume of business event data, auxiliary storage space is allocated, and a relationship is established between the auxiliary storage space and the business identifier. Business events are then written to the storage space determined by the business identifier and the auxiliary storage space. This method of dynamically allocating storage space and auxiliary storage space ensures the smooth writing of business events. It not only eliminates the need for dedicated database management, saving storage costs, but also simplifies and improves the efficiency of business data management by making the writing process simple and efficient.
[0038] In the description of the embodiments of the present invention, the terms involved and their meanings are as follows:
[0039] MySQL: A relational database;
[0040] Hash Map: An implementation of the Map interface based on a hash table. This implementation provides all optional map operations and allows null values and null keys.
[0041] Figure 1 This is a schematic diagram of the main flow of a business data management method according to an embodiment of the present invention, such as... Figure 1 As shown, the business data management method of this embodiment of the invention includes the following steps S101 to S104.
[0042] Step S101: Obtain a business event write request. The business corresponds to multiple business events, and the request includes a business identifier.
[0043] Specifically, for scenarios with simple data structures and applications, the system receives a write-to-store request for the business event after its execution. Taking package tracking as an example, the process nodes of this business are executed sequentially according to a plan, and can be divided into eight events: packaging, sorting, shipping, arrival at location A, arrival at location B, sorting, arrival at the delivery station, and delivery to the destination. The business identifier for package tracking is the package ID. Package tracking is mainly used for querying, and a write-to-store request is issued as soon as the event is completed. After the write is completed, the business data does not require subsequent updates or maintenance. Of course, the above business scenario is not limited to package tracking. As long as the event storage in the business scenario does not need to be updated, the business has an identifier, and the number of events corresponding to the business is predictable, it meets the application scenario of this invention.
[0044] Step S102: Obtain the storage space corresponding to the service based on the service identifier.
[0045] According to one embodiment of the present invention, the service corresponds to a preset number of service events, and each service event has a preset size; when allocating storage space for the service, the size of the allocated storage space is determined based on the remaining service events of the service and the preset size of each remaining service event.
[0046] According to another embodiment of the present invention, before obtaining the storage space corresponding to the service based on the service identifier, the method further includes: in response to allocating storage space for the service, establishing an association between the storage space and the service identifier by creating an index file.
[0047] Specifically, taking the aforementioned logistics parcel business as an example, the parcel business is pre-defined to have a total of 8 events (packaging, sorting, shipping, arrival at location A, arrival at location B, sorting, arrival at the distribution station, and delivery to the destination). Based on the content of each event, the required data volume for each business event is pre-defined. Based on the remaining business events in the business and the pre-defined data volume for each remaining business event, the allocated storage space can be determined. The business system allocates storage space for storing and managing business data. In response to the allocated storage space, a corresponding index file is created to mark the storage space name and specific location information of the business event, and a relationship is established between the storage space and the business identifier. This allows the storage space size of the corresponding business event to be obtained through the index file based on the business identifier.
[0048] Step S103: Determine whether the storage space meets the data volume of the business event, and if not, allocate auxiliary storage space for the business, and establish the association between the auxiliary storage space and the business identifier.
[0049] According to one embodiment of the present invention, the service corresponds to a preset number of service events, and each service event has a preset size; when allocating auxiliary storage space for the service, the size of the allocated auxiliary storage space is determined according to the remaining service events of the service and the preset size of each remaining service event.
[0050] According to another embodiment of the present invention, establishing the association between the auxiliary storage space and the service identifier includes: establishing the association between the auxiliary storage space and the service identifier by creating an index file.
[0051] Specifically, based on the number of business events to be written and the preset size of each business event to be written, the data volume of the business event is obtained. Combined with the storage space size of the business events obtained above, it is determined whether the storage space meets the data volume requirements of the business events. If not, auxiliary storage space is allocated to the business according to the data volume of the business events. Based on the allocated auxiliary storage space, an index file related to the auxiliary storage space is created, and the index file related to the auxiliary storage space is associated with the business identifier so that the auxiliary storage space can be obtained through the business identifier.
[0052] Step S104: Obtain the storage space to be stored for the service according to the service identifier, and write the service event into the storage space to be stored. The storage space to be stored includes the storage space and the auxiliary storage space.
[0053] According to one embodiment of the present invention, obtaining the storage space to be stored for a service based on the service identifier includes: performing a hash mapping process on the service identifier to obtain an index value corresponding to the service; and searching for the storage space to be stored for the service from the index file based on the index value.
[0054] Specifically, based on the business identifier in the write request, a hash mapping is performed on the business identifier to obtain the index value of the index file corresponding to the business. For example, a Hash Map is a collection used to store key-value pairs, which are distributed across an array, which forms the backbone of the Hash Map. Using the business identifier as the key, a hash function is used to determine the index value of the business corresponding to the business identifier in the index file. If the index values determined by the hash function are the same, a linked list index is used to determine the next index value.
[0055] According to another embodiment of the present invention, the index file includes: a spatial index file and a service index file; searching for the storage space of the service in the index file according to the index value includes: reading the spatial information corresponding to the service from the service index file according to the index value, the spatial information including the spatial information of the storage space and the spatial information of the auxiliary storage space; and determining the storage space of the service according to the spatial information through the spatial index file.
[0056] Specifically, the index file in this invention includes a spatial index file and a business index file. The business index file is used to provide the storage space identifier corresponding to the business and the row number information of the spatial index file where the space identifier is located, as well as the auxiliary storage space identifier and the row number information of the spatial index file where the space identifier is located. The spatial index file is used to provide the storage information of the storage space and auxiliary storage space of the business. The storage information includes the space identifier and location information.
[0057] Based on the index value of the business index file obtained by the hash mapping process, the storage space identifier corresponding to the business and the line number information of the space index file where the space identifier is located, as well as the auxiliary storage space identifier and the line number information of the space index file where the space identifier is located, are read from the business index file. Based on the space identifier and the line number information of the space index file where the space identifier is located, the storage space to be stored for the business is obtained through the space index file. The storage space to be stored includes the storage space and the auxiliary storage space. The business events to be written are written to the storage space to be stored, thus completing the business data writing operation.
[0058] For example, the space index files for file spaces a and b are shown in Tables 1 and 2 below, and the business index files are shown in Tables 3 and 4 below. Table 3 is the main table of the business index files, used to record the storage space where the business event resides and its storage location within that storage space; Table 4 is the auxiliary table of the business index files, used to record the auxiliary storage space where the business event resides and its storage location within that auxiliary storage space. The following examples illustrate the specific methods for building index files based on allocated auxiliary storage spaces and obtaining the storage space to be stored based on the index value corresponding to the business identifier.
[0059] Table 1
[0060]
[0061] Table 2
[0062]
[0063] Table 3
[0064] index Space: lines Auxiliary Space Line Package index value of 'a' Space a: 1 100 …… …… …… Package b index value Space b: 3
[0065] Table 4
[0066] Space: lines Next space line Line 100 (Package a) Space b: 20 …… …… ……
[0067] For example, when storing data for business events, if the data volume of a business event is set to 1200 bytes, the space information of the storage space corresponding to the business can be obtained from Table 3 as the first row of space a based on the business identifier "package a". According to the index file of space a in Table 1, the start position of its first row is 1001, the end position is 9000, and the next write position is 7824. The remaining available space is 1176 bytes, which is not enough to meet the data volume of the business event. Therefore, auxiliary storage space (e.g., storage space b in Table 2) needs to be allocated. The location information (start position, end position) of the allocated auxiliary storage space is stored in the space index file of space b (see Table 2). The space information of the auxiliary storage space (auxiliary storage space b and the storage position 20 rows in the auxiliary storage space) is written into Table 4 (e.g., the 100th row of Table 4). The row number information written into Table 4 (the 100th row) is written into the auxiliary space row of Table 3. Regarding the space information for package b in Table 3, the auxiliary space row value is empty, indicating that business package b does not require the allocation of auxiliary storage space, and the available space in the storage space is sufficient for its use. Furthermore, the auxiliary table for the aforementioned business index file can use a pointer approach, where the next space row in the table serves as a pointer to continue indexing the next auxiliary storage space. This allows for unlimited allocation of auxiliary storage space to ensure the storage management of business data in special scenarios.
[0068] According to Tables 3 and 4, when obtaining the write request of a business event, a hash mapping is performed on the business identifier "package a" to obtain the index value of package a in the main table of the business index file (Table 3). This determines the row number of package a in the main index file. The row number indicates that the storage space information of package a is the first row of the space index file for space a, and the space information of the auxiliary storage space is the space information of the auxiliary storage space shown in the 100th row of the auxiliary table 4 of the business index file. Furthermore, according to Table 4, the space information of the auxiliary storage space recorded in its 100th row is the 20th row of the space index file for space b. Therefore, the storage space information of package a includes the first row of the space index file for space a and the 20th row of the space index file for space b. Furthermore, based on the storage space information of package a and the space index files shown in Tables 1 and 2, the storage space corresponding to package a can be determined. For space a, the first line of the space index file of space a is retrieved based on this information, and the position information (start position 1001, end position 9000, and next write position 7824) in the storage space information of package a is obtained, that is, the storage space is the position between 7824 and 9000 in space a; for space b, the 20th line of the space index file of space b is retrieved based on this information, and the position information (start position 2001, end position 7000) in the storage space information of package a is obtained, that is, the auxiliary storage space is the position between 2001 and 7000 in space b. In summary, the storage space to be stored for the business is the position between 7824 and 9000 in space a (storage space) and the position between 2001 and 7000 in space b (auxiliary storage space). After the business event is written, the information of the next write position column of package a in Table 2 is supplemented according to the write position of the last position of the business event.
[0069] Using the aforementioned index file, the storage space corresponding to the service is obtained based on the service identifier. If the available space in the storage space does not meet the storage requirements, auxiliary storage space is allocated and used as the corresponding storage space. This achieves a dynamic allocation of storage space and ensures the smooth writing of events.
[0070] According to another embodiment of the present invention, the method for managing business data further includes: responding to a business event reading request, reading spatial information corresponding to the business from the business index file according to the index value corresponding to the business; determining, according to the spatial information and the spatial index file, a storage space and an auxiliary storage space corresponding to the business, wherein the storage space and the auxiliary storage space include a start position and an end position; reading business event data stored in the storage space and the auxiliary storage space according to the start position and the end position, and segmenting the business event data according to the delimiter between business events to obtain each business event corresponding to the business.
[0071] Specifically, in response to a read request for a business event, the index value corresponding to the business is obtained based on the business identifier. The space information of the storage space and the space information of the auxiliary storage space corresponding to the business are read from the business index file. Based on the read space information, the space index file and the line number information of the space index file corresponding to the space information are determined. Then, the start and end positions of the business data storage in the storage space and the auxiliary storage space are read. Based on the read start and end positions, the data of all business events are read from the disk space at once. Since there is a delimiter between each business event, the business data is divided by the delimiter to obtain the data of each business event corresponding to the business.
[0072] Since the business events in this invention are executed sequentially according to a plan, when reading a business, as long as the storage space corresponding to the business is determined, a single reading can be performed based on the start and end positions, followed by sequential segmentation, which effectively improves execution efficiency.
[0073] According to another embodiment of the present invention, after writing the business event into the storage space, the method further includes: determining whether the business event is the end event of the business; if so, the process ends; otherwise, determining whether the storage space for the business is full; if so, allocating auxiliary storage space for the business again; otherwise, the process ends.
[0074] Specifically, after a business event is written to the storage space, if there are subsequent business events, it is determined whether there is any remaining space in the storage space. If there is no remaining space, that is, the storage needs of subsequent business events are not met, then the size of the auxiliary storage space to be allocated is determined again based on the subsequent business events and the preset data size of each subsequent business event, so as to store the subsequent business events.
[0075] Figure 2This is a schematic diagram of the business data writing process according to an embodiment of the present invention. After obtaining a write request for a business event, the system determines whether there is storage space for the business event based on the business identifier and whether the available space size of the storage space meets the data volume of the business event. When the storage space corresponding to the business event meets the requirements, the business event is written to the storage space. If not, an auxiliary storage space is allocated, and the allocated auxiliary storage space information is written to the index file, establishing an association between the auxiliary storage space and the business identifier. The system obtains the storage space to be used for the business event based on the business identifier, writes the business event to the storage space to be used, and after writing, determines whether the business event is an end event and whether there is remaining space in the storage space to be used. If the written business event is an end event, the process ends. If there are subsequent business events and there is remaining space in the storage space to be used, the process ends. If there are subsequent business events but the storage space to be used is full, an auxiliary storage space needs to be allocated for the storage management of subsequent events, and the auxiliary storage space information is written to the index file.
[0076] According to another embodiment of the present invention, the method for managing business data further includes: after the lifecycle of all business events corresponding to the business ends, transferring the business events corresponding to the business to a new storage space; and deleting the business event data in the original storage space where there is blank space.
[0077] Specifically, when allocating storage space for business events, to avoid multiple allocations, a certain margin is generally added based on the data volume of the business event. Although this design avoids the problem of multiple allocations, there will be some blank space in the storage file after the business event storage ends. Therefore, after the lifecycle of all business events corresponding to the business ends, the business events corresponding to the business are sequentially and continuously transferred to a new storage space; the business event data with blank space is deleted, and the corresponding index file is updated and modified synchronously to improve the utilization of storage space and save resources.
[0078] In addition, business data management methods also include: periodically deleting outdated business data and corresponding indexes based on the date to ensure efficient access to storage space.
[0079] The business data management method of this invention, for scenarios with simple data structures and applications, adopts a dynamic allocation of storage space and combines it with index files to realize the management of business data. This not only eliminates the need for a professional database system, saving storage costs, but also ensures that business events are stored sequentially and continuously in the storage space, making the read and write process simple and efficient, thus improving the management efficiency of business data.
[0080] Figure 3This is a schematic diagram of the main modules of a business data management device according to an embodiment of the present invention. Figure 3 As shown, the business data management device 300 mainly includes a write request acquisition module 301, a storage space acquisition module 302, a storage space judgment module 303, and a business event writing module 304.
[0081] The write request acquisition module 301 is used to acquire a business event write request, wherein the business corresponds to multiple business events, and the request includes a business identifier;
[0082] Storage space acquisition module 302 is used to obtain the storage space corresponding to the service based on the service identifier;
[0083] The storage space determination module 303 is used to determine whether the storage space meets the data volume of the business event, and if not, to allocate auxiliary storage space for the business, and to establish an association between the auxiliary storage space and the business identifier;
[0084] The business event writing module 304 is used to obtain the storage space to be stored for the business according to the business identifier, and write the business event into the storage space, wherein the storage space to be stored includes the storage space and the auxiliary storage space.
[0085] According to an embodiment of the present invention, the storage space determination module 303 can also be used to: establish the association between the auxiliary storage space and the service identifier by establishing an index file; the service data management device 300 further includes an index establishment module (not shown in the figure), used to: before obtaining the storage space corresponding to the service according to the service identifier, in response to allocating storage space for the service, establish the association between the storage space and the service identifier by establishing an index file.
[0086] According to another embodiment of the present invention, the service event writing module 304 can also be used to: perform hash mapping processing on the service identifier to obtain the index value corresponding to the service; and search for the storage space to be stored for the service in the index file according to the index value.
[0087] According to another embodiment of the present invention, the index file includes: a spatial index file and a service index file; the service event writing module 304 can also be used to: read the spatial information corresponding to the service from the service index file according to the index value, the spatial information including the spatial information of the storage space and the spatial information of the auxiliary storage space; and determine the storage space of the service according to the spatial information and the spatial index file.
[0088] According to another embodiment of the present invention, the business data management device 300 further includes a business event reading module (not shown in the figure), configured to: in response to a business event reading request, read spatial information corresponding to the business from the business index file according to the index value corresponding to the business; determine the storage space and auxiliary storage space corresponding to the business according to the spatial information and the spatial index file, wherein the storage space and the auxiliary storage space include a start position and an end position; read the business event data stored in the storage space and the auxiliary storage space according to the start position and the end position, and segment the business event data according to the delimiter between business events to obtain each business event corresponding to the business.
[0089] According to another embodiment of the present invention, the business data management device 300 further includes a second judgment module (not shown in the figure), configured to: after writing the business event into the storage space, determine whether the business event is the end event of the business; if so, end the process; otherwise, determine whether the storage space for the business is full; if so, allocate auxiliary storage space for the business again; otherwise, end the process.
[0090] According to another embodiment of the present invention, the service corresponds to a preset number of service events, and each service event has a preset size; the service data management device 300 further includes an allocation module (not shown in the figure), used to: when allocating storage space or auxiliary storage space for the service, determine the size of the allocated storage space or auxiliary storage space according to the remaining service events of the service and the preset size of each remaining service event.
[0091] According to another embodiment of the present invention, the business data management device 300 further includes a business event management module (not shown in the figure), which is used to: transfer the business events corresponding to the business to a new storage space after the life cycle of all business events corresponding to the business ends; and delete the business event data in the original storage space where there is blank space.
[0092] Figure 4 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied.
[0093] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, a network 404, and a server 405. Network 404 serves as the medium for providing communication links between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0094] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications, such as business data management applications, can be installed on terminal devices 401, 402, and 403 (for example only).
[0095] Terminal devices 401, 402, and 403 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0096] Server 405 can be a server providing various services, such as a backend management server supporting business data management performed by users using terminal devices 401, 402, and 403 (for example only). The backend management server can obtain business event write requests, where each business corresponds to multiple business events, and the request includes a business identifier; obtain the storage space corresponding to the business based on the business identifier; determine whether the storage space meets the data volume of the business event, and if not, allocate auxiliary storage space for the business, and establish an association between the auxiliary storage space and the business identifier; obtain the storage space to be stored for the business based on the business identifier, write the business event into the storage space to be stored, where the storage space to be stored includes the storage space and the auxiliary storage space, and process the data, and then feed back the processing result (e.g., business data – for example only) to the terminal device.
[0097] It should be noted that the business data management method provided in this embodiment of the invention is generally executed by server 405, and correspondingly, the business data management device is generally set in server 405.
[0098] It should be understood that Figure 4 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0099] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing terminal devices or servers of the present invention. Figure 5 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0100] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0101] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0102] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a 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 communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined above in the system of this invention.
[0103] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0104] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0105] The units described in the embodiments of the present invention can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor can be described as including: a write request acquisition module, a storage space acquisition module, a storage space determination module, and a business event writing module.
[0106] In some cases, the names of these modules do not constitute a limitation on the module itself. For example, the write request acquisition module can also be described as "a module for acquiring business event write requests, wherein the business corresponds to multiple business events, and the request includes a business identifier".
[0107] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: obtaining a service event write request, wherein the service corresponds to multiple service events, and the request includes a service identifier; obtaining storage space corresponding to the service based on the service identifier; determining whether the storage space meets the data volume of the service event, and if not, allocating auxiliary storage space for the service, and establishing an association between the auxiliary storage space and the service identifier; obtaining a storage space to be stored for the service based on the service identifier, and writing the service event into the storage space to be stored, wherein the storage space to be stored includes the storage space and the auxiliary storage space.
[0108] According to the technical solution of the present invention, the following advantages or beneficial effects are achieved: by obtaining a business event write request, where a business corresponds to multiple business events and the request includes a business identifier; obtaining the storage space corresponding to the business based on the business identifier; determining whether the storage space meets the data volume of the business event, and allocating auxiliary storage space for the business if it does not meet the requirements, and establishing an association between the auxiliary storage space and the business identifier; obtaining the storage space to be stored for the business based on the business identifier, and writing the business event into the storage space to be stored, where the storage space to be stored includes the storage space and the auxiliary storage space, the technical solution realizes that based on the storage space obtained from the business identifier, when the storage space does not meet the data volume of the business event, auxiliary storage space is allocated, and a relationship between the auxiliary storage space and the business identifier is established, and the business event is written into the storage space and the auxiliary storage space determined by the business identifier. Through this method of dynamically allocating storage space and auxiliary storage space, the smooth writing of business events is guaranteed. This not only eliminates the need for dedicated database management, saving storage costs, but also makes the writing process simple and efficient, improving the management efficiency of business data.
[0109] The specific embodiments described herein do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of service data management, characterized by, The application comprises: After the business event execution is completed, a business event write request is received, the business corresponds to multiple business events, and the request comprises a business identifier; wherein each business event of the business is executed in a planned order; According to the business identifier, a storage space corresponding to the business is obtained; It is judged whether the storage space meets the data volume of the business event, and if not, auxiliary storage space is allocated for the business, and an association between the auxiliary storage space and the business identifier is established; wherein each business event has a preset data volume; when the auxiliary storage space is allocated for the business, the size of the auxiliary storage space is determined according to the remaining business events of the business and the preset data volume of each remaining business event; According to the business identifier, the storage space of the business to be stored is obtained, and the business event is written into the storage space to be stored, wherein the storage space to be stored comprises the storage space and the auxiliary storage space.
2. The method of claim 1, wherein, The association between the auxiliary storage space and the business identifier is established, comprising: The association between the auxiliary storage space and the business identifier is established by establishing an index file; Before the storage space corresponding to the business is obtained according to the business identifier, it further comprises: In response to allocating storage space for the business, the association between the storage space and the business identifier is established by establishing an index file.
3. The method of claim 2, wherein, According to the business identifier, the storage space of the business to be stored is obtained, comprising: Hash mapping processing is performed on the business identifier to obtain an index value corresponding to the business; According to the index value, the storage space of the business to be stored is found in the index file.
4. The method of claim 3, wherein, The index file comprises a space index file and a business index file; According to the index value, the storage space of the business to be stored is found in the index file, comprising: According to the index value, the space information corresponding to the business is read from the business index file, wherein the space information comprises the space information of the storage space and the space information of the auxiliary storage space; According to the space information, the storage space of the business to be stored is determined through the space index file.
5. The method according to claim 4, characterized in that, It further comprises: In response to a business event read request, the space information corresponding to the business is read from the business index file according to the index value corresponding to the business; According to the space information, the storage space and the auxiliary storage space corresponding to the business are determined through the space index file, wherein the storage space and the auxiliary storage space comprise a start position and an end position; According to the start position and the end position, the business event data saved in the storage space and the auxiliary storage space is read, and the business event data is cut to obtain each business event corresponding to the business according to the separator between the business events.
6. The method of claim 1, wherein, After the business event is written into the storage space to be stored, it further comprises: It is judged whether the business event is an end event of the business; If yes, the process is ended, otherwise, it is judged whether the storage space to be stored of the business is full; If yes, the auxiliary storage space is allocated for the business again, otherwise, the process is ended.
7. The method of claim 1, wherein, The business corresponds to a preset number of business events, and each business event has a preset size; When allocating storage space or auxiliary storage space for the business, the size of the allocated storage space or auxiliary storage space is determined according to the remaining business events of the business and the preset size of each remaining business event.
8. The method of claim 1, wherein, Further comprising: After the life cycle of all business events corresponding to the business ends, the business events corresponding to the business are transferred to a new storage space; Delete the business event data in the original storage space with blank space.
9. A service data management apparatus characterized by comprising: Comprise: A write request acquisition module is configured to receive a business event write request after the execution of the business event is completed, the business corresponds to a plurality of business events, and the request includes a business identifier; wherein each business event of the business is executed in a planned order; A storage space acquisition module is configured to obtain the storage space corresponding to the business according to the business identifier; A storage space judgment module is configured to determine whether the storage space meets the data volume of the business event, and in the case of not meeting, allocate auxiliary storage space for the business, and establish an association between the auxiliary storage space and the business identifier; wherein each business event has a preset data volume; when allocating auxiliary storage space for the business, the size of the allocated auxiliary storage space is determined according to the remaining business events of the business and the preset data volume of each remaining business event; A business event write module is configured to obtain the storage space to be stored of the business according to the business identifier, and write the business event into the storage space to be stored, wherein the storage space to be stored includes the storage space and the auxiliary storage space.
10. A mobile electronic device terminal, characterized by Comprise: One or more processors; Storage device, for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-8.
11. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-8.
Citation Information
Patent Citations
Quota allocation method and device for distributed storage system
CN107426321A
Index creation method, device and apparatus based on service identifier
CN110347674A
Object storage device and an operating method thereof
US20170364280A1