CN115203211A - Unique hash sequence number generation method and system - Google Patents

Unique hash sequence number generation method and system Download PDF

Info

Publication number
CN115203211A
CN115203211A CN202210920745.4A CN202210920745A CN115203211A CN 115203211 A CN115203211 A CN 115203211A CN 202210920745 A CN202210920745 A CN 202210920745A CN 115203211 A CN115203211 A CN 115203211A
Authority
CN
China
Prior art keywords
hash
sequence number
index
cblock
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210920745.4A
Other languages
Chinese (zh)
Inventor
王毅鹏
韩增
郑斌
曾柯杰
赵亚萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Financial Futures Information Technology Co ltd
Original Assignee
Shanghai Financial Futures Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Financial Futures Information Technology Co ltd filed Critical Shanghai Financial Futures Information Technology Co ltd
Priority to CN202210920745.4A priority Critical patent/CN115203211A/en
Publication of CN115203211A publication Critical patent/CN115203211A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a system for generating a unique hash sequence number, which solve the problem of large hash value range interval and improve the space utilization rate and the data query efficiency of an object using a character string as an index during storage. The technical scheme is as follows: processing the character string to generate a hash sequence number which is increased from 0, wherein the hash sequence number is used as an index to replace a storage data structure which originally needs the character string as the index; and using a cBlock _ map data caching structure, wherein when the cBlock _ map stores the hash item, the hash value of the hash item is used as an index and the hash value comprises information such as character strings, hash sequence numbers and the like. In the operation process of the method, the structure of the cblock _ map memory is stable, all possibly used spaces are prepared in advance in the construction method, and no scene exists when the space is full, objects are created again and data are copied. The cblock _ map is used for providing efficient and stable read-write capability, the index storage position of the hash value supports O (1) efficient search, and even if hash collision occurs, the query time can be controlled within a constant range in a linked list traversal mode.

Description

Unique hash sequence number generation method and system
Technical Field
The invention relates to a sequence number generation technology, in particular to a unique hash sequence number generation method and a unique hash sequence number generation system.
Background
In the background system development design, the character string needs to be hashed, or the character string needs to be stored as an index when structured data is processed, and the hash function needs to be used for hashing the character string in all scenes to obtain a hash value of the character string, wherein the hash value is in a digital format and is used as an index number for data storage.
Hash functions (english: hash), also called hashing algorithms, are a way to create small digital "fingerprints" from any kind of data. The hash function compresses a message or data into a digest so that the amount of data is reduced, fixing the format of the data, and creating a fingerprint called a "hash value". The hash value is typically represented by a short string of random letters and numbers.
However, the hash function commonly used at present is applied in this scenario, and has the problems of slow processing, hash value collision, and large hash value range.
Disclosure of Invention
The following presents a simplified summary of one or more aspects in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
The invention aims to solve the problems and provides a method and a system for generating a unique hash sequence number, which effectively solve the problem of large hash value range interval and improve the space utilization rate and the data query efficiency of objects using character strings as indexes during storage.
The technical scheme of the invention is as follows: the invention discloses a method for generating a unique hash sequence number, which comprises a new process of creating the unique hash sequence number, wherein the new process comprises the following steps:
firstly, acquiring a character string with a to-be-acquired hash sequence number, and mapping the character string into a hash value according to character processing by using a hash function;
checking whether a code _ table of a cblock _ map type has a valid value in a position corresponding to an index by taking the hash value as the index, if not, creating a hash item, assigning a hash sequence number to the newly-created hash item, adding 1 by itself, simultaneously creating a hash chain table by taking the hash item as a head pointer, storing the hash chain table in the index position corresponding to the code _ table, and returning the hash sequence number; if the index corresponding position has an effective value in the code _ table, the effective value is used as the first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the input character string is compared, and if the character string is equal, the hash sequence number of the hash item is returned; if no equal character strings exist, a new hash item is created at the tail node of the linked list, the hash sequence number and the character string value of the hash item are updated, the hash sequence number is increased by 1, and the hash sequence number of the new hash item is returned.
According to an embodiment of the unique hash sequence number generation method of the present invention, the method further includes a process of obtaining the hash sequence number, and the obtaining process includes:
firstly, acquiring a character string with a to-be-acquired hash sequence number, and mapping a hash value according to character processing by using a hash function;
checking whether a valid value exists in a position corresponding to the index in a code _ table of the cblock _ map type by taking the Hash value as the index, and if the valid value does not exist, returning to the inquiry failure; if the index corresponding position has an effective value in the code _ table, the effective value is used as the first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the incoming character string or not is compared, and if equal character strings exist, the hash sequence number of the hash item is returned; if no equal character strings exist, returning to the inquiry failure.
According to an embodiment of the unique hash sequence number generation method, a data cache structure of the cblock _ map reads cache values quickly according to indexes, wherein the bottom layer of the cblock _ map stores and manages data in a two-dimensional pointer array form, row and column values can be defined during initialization, but no memory application is performed, the two-dimensional pointer array is initialized as required according to the index position when the index is inserted, and the array of the row where the index is located is initialized every time.
According to an embodiment of the unique hash sequence number generation method of the present invention, the bottom storage component of cblock _ map is further configured with processes of initialization, data saving, and data reading, wherein:
the code _ table initialization procedure of the cblock _ map type is further configured to: firstly, creating a pointer of a cblock _ map type, adding parameters of line number and page number in a construction method, storing a cblock _ map bottom layer in a two-dimensional pointer array form, setting the line array as a null pointer in a unified way when the array is initialized, and not applying for additional space;
the code _ table save data flow of cblock _ map type is further configured to: firstly, judging which row array the data to be stored should be located in according to the value of the transmitted hash sequence number, if the row array does not exist, establishing and initializing the row array, then taking the remainder of the page number according to the hash sequence number to obtain a specific storage position, and updating the array to be stored to the storage position;
the code _ table read data flow of the cblock _ map type is further configured to: firstly, judging which row array the data to be read should be located in according to the incoming hash sequence number value, and if the row array does not exist, returning to the step of failure in reading; and (4) taking the surplus of the pages according to the hash sequence number to obtain a specific storage position, judging whether the storage position is empty, if so, returning the inquiry failure, otherwise, returning the value stored at the index.
The invention also discloses a unique hash sequence number generation system, which comprises: creating a subsystem with a new unique hash sequence number, wherein the subsystem with the new unique hash sequence number further comprises:
newly establishing a mapping module of the hash sequence number, acquiring a character string which is transmitted with the hash sequence number to be acquired, and mapping the character string into a hash value according to character processing by using a hash function;
the method comprises the steps that a first branch module of a hash sequence number is newly built, whether an effective value exists in a code _ table of a cblock _ map type or not is checked by taking a hash value as an index, if the effective value does not exist, a hash item is built, the hash sequence number is assigned to the newly built hash item and is added by 1, a hash chain table with the hash item as a head pointer is built, and the hash chain table returns to the hash sequence number after being stored in an index position corresponding to the code _ table;
a second branch module for newly building a hash sequence number, using the hash value as an index, checking whether an effective value exists at a position corresponding to the index in a code _ table of the cblock _ map type, if so, taking the effective value as a first node of the hash chain table, traversing sub-items of the hash chain table, comparing whether a character string cached in each hash item is equal to an incoming character string, and if so, returning the hash sequence number of the hash item; if no equal character strings exist, a new hash item is created at the tail node of the linked list, the hash sequence number and the character string value of the hash item are updated, the hash sequence number is increased by 1, and the hash sequence number of the new hash item is returned.
According to an embodiment of the unique hash sequence number generation system of the present invention, the system includes: a subsystem for obtaining a unique hash sequence number, wherein the subsystem for obtaining a unique hash sequence number further comprises:
the mapping module for acquiring the hash sequence number acquires a character string transmitted with the hash sequence number to be acquired, and processes and maps the hash value according to characters by using a hash function;
the first branch module for acquiring the hash sequence number checks code _ table of cblock _ map type by taking the hash value as an index, checks whether an effective value exists at the position corresponding to the index, and returns to the inquiry failure if the effective value does not exist;
a second branch module for obtaining a hash sequence number, checking whether an effective value exists at a position corresponding to an index in a code _ table of a cblock _ map type by taking the hash value as the index, traversing sub-items of the hash chain table by taking the effective value as a first node of the hash chain table if the effective value exists at the position corresponding to the index in the code _ table, comparing whether a character string cached in each hash item is equal to an incoming character string, and returning the hash sequence number of the hash item if the character string is equal to the incoming character string; if no equal character strings exist, returning to the inquiry failure.
According to an embodiment of the unique hash sequence number generation system, a data cache structure of the cblock _ map reads cache values quickly according to indexes, wherein a bottom layer of the cblock _ map stores and manages data in a two-dimensional pointer array form, row and column values can be defined during initialization, but no memory application is performed, the two-dimensional pointer array is initialized as required according to index positions when the indexes are inserted, and the array of the row where the indexes are located is initialized every time.
According to an embodiment of the unique hash sequence number generation system of the present invention, the system further includes a bottom storage component of cblock _ map, the bottom storage component of cblock _ map is further configured with an initialization unit, a data saving unit, and a data reading unit, wherein:
the device comprises an initialization unit, a code _ table and a code _ table, wherein the initialization unit is configured to create a pointer of a cblock _ map type, parameters of line number and page number are added in a construction method, a cblock _ map bottom layer is stored in a two-dimensional pointer array form, the value of the line number and the page number specifies the maximum index number supported by the code _ table, and when the array is initialized, the line array is uniformly set as a null pointer without additional space application;
the data storage unit is configured to judge which row array the data to be stored should be located in according to the transmitted hash sequence number value, if the row array does not exist, a new row array is established and initialized, then the number of pages is left according to the hash sequence number to obtain a specific storage position, and the array to be stored is updated to the storage position;
the data reading unit is configured to judge which row array the data to be read should be located in according to the incoming hash sequence number value, and if the row array does not exist, the data reading unit returns that the reading fails; and (4) taking the surplus of the pages according to the hash sequence number to obtain a specific storage position, judging whether the storage position is empty, if so, returning the inquiry failure, otherwise, returning the value stored at the index.
Compared with the prior art, the invention has the following beneficial effects: the unique hash sequence number generation method provided by the invention processes the character string to generate the hash sequence number starting from 0, effectively solves the problem of large hash value range interval, converts the index character string into a numerical value which is self-increased from 0 when processing the structured data storage taking the character string as the index, and effectively improves the space utilization rate and the data query efficiency of the object taking the character string as the index during storage.
In detail, the present invention is characterized in that:
1. the method of the invention processes the character string to generate the hash sequence number which is increased from 0, the hash sequence number can be used as an index to replace a storage data structure which needs the character string as the index originally, the data access capability of the storage data structure is greatly improved, and the memory space used in the storage is saved.
2. The method uses a data cache structure of the cblock _ map to provide the data storage capacity of a large space, the cblock _ map takes the hash value of the hash item as an index when the hash item is stored, the hash value comprises information such as character strings and hash sequence numbers, and the index range supports the data size of 0-MAX _ INT. In the operation process of the method, the structure of the cblock _ map memory is stable, all the spaces which can be used are prepared in advance in the construction method, and no scene exists in which the object is recreated and the data is copied when the spaces are full.
3. The method uses the cblock _ map to provide efficient and stable read-write capacity, supports the search of O (1) efficiency for the index storage position of the hash value, and can control the query time within a constant range in a linked list traversal mode even if the hash collision occurs.
Drawings
The above features and advantages of the present disclosure will be better understood upon reading the detailed description of embodiments of the disclosure in conjunction with the following drawings. In the drawings, components are not necessarily drawn to scale, and components having similar relative characteristics or features may have the same or similar reference numerals.
Fig. 1 shows a flow chart of the new hash sequence number of the present invention.
Fig. 2 shows a flowchart of obtaining a hash sequence number according to the present invention.
Fig. 3 shows a flowchart for initializing the bottom storage cblock _ map according to the present invention.
FIG. 4 shows a set (save) flow diagram of the underlying storage cBlock _ map of the present invention.
FIG. 5 shows a flowchart of get (read) of the underlying storage cBlock _ map of the present invention.
FIG. 6 illustrates a schematic diagram of an embodiment of the unique hash sequence number generation system of the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and the specific embodiments. It is noted that the aspects described below in connection with the figures and the specific embodiments are only exemplary and should not be construed as imposing any limitation on the scope of the present invention.
As shown in fig. 1 and fig. 2, the external invocation interfaces of the embodiments of the unique hash sequence number generation method of the present invention are new invocation interfaces and obtained invocation interfaces, respectively.
As shown in fig. 1, the process of creating the unique hash number is described in detail as follows.
Firstly, a character string with a to-be-taken hash sequence number is acquired, and a hash function is used for processing and mapping the character string into a long type hash value (the value range of the hash value is 0-MAX _ INT).
Checking whether a code _ table (a character string hash value mapping table) of a cblock _ map type has a valid value at a position corresponding to an index by taking the hash value as the index, if not, creating a hash item, assigning a hash sequence number to the newly-created hash item, increasing by 1, simultaneously creating a hash chain table taking the hash item as a head pointer, storing the hash chain table at the index position corresponding to the code _ table, and returning the hash sequence number index; if the index corresponding position has an effective value in the code _ table, the effective value is the first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the transmitted character string is compared, and if the character string is equal, the hash serial number of the hash item is returned; and if no equal character string exists, creating a new hash item at the tail node of the linked list, updating the hash sequence number and the character string value of the hash item, increasing the hash sequence number by 1, and returning the hash sequence number of the new hash item.
As shown in fig. 2, the process of obtaining the hash sequence number is described in detail as follows.
Firstly, a character string with a to-be-taken hash sequence number is acquired, and a hash function is used for processing and mapping the character string into a long type hash value (the value range of the hash value is 0-MAX _ INT).
Checking whether an effective value exists in a code _ table of the cblock _ map type by taking the Hash value as an index, and if the effective value does not exist in a position corresponding to the index, returning to the inquiry failure; if the index corresponding position has an effective value in the code _ table, the effective value is the first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the incoming character string or not is compared, and if the character string is equal, the hash serial number of the hash item is returned; if no equal character strings exist, returning the query failure.
The core method of the cblock _ map of the bottom-layer storage component realized by the method comprises the processes of initializing the cblock _ map, storing data and reading the data.
The Cblock _ map is a data cache structure, and the cache value is quickly read according to the index. The bottom layer of the Cblock _ map stores and manages data in a two-dimensional pointer array form, and row and column values can be defined during initialization, but no memory application is carried out. The array is initialized according to the index position when the array is inserted, and the array of the row where the index is located is initialized each time, so that excessive memory occupation is prevented, and the data storage performance is effectively improved.
Fig. 3 depicts a code _ table initialization procedure for cblock _ map type. As shown in fig. 3, firstly, a pointer of cblock _ map type is created, parameters of line number and page number may be added in the construction method, the cblock _ map bottom layer is stored in a two-dimensional pointer array form, and the value of line number and page number specifies the maximum index number supported by code _ table. When the array is initialized, the row array is uniformly set as a null pointer, and no additional space application is carried out.
FIG. 4 depicts a code table save data flow for a cblock map type. As shown in fig. 4, first, it is determined in which row array the data to be stored should be located according to the incoming hash sequence number index value, if the row array does not exist, a new row array is created and initialized, and then the number of pages is left according to the hash sequence number index to obtain a specific storage location, and the array to be stored is updated to the storage location.
Fig. 5 depicts a code _ table read data flow of the cblock _ map type. As shown in fig. 5, first, according to the incoming hash sequence number index value, it is determined in which row array the data to be read should be located, and if the row array does not exist, a read failure is returned; and (4) taking the surplus of the pages according to the hash sequence number index to obtain a specific storage position, judging whether the storage position is empty or not, if so, returning the query failure, otherwise, returning the value stored at the index.
As shown in fig. 3 to 5, in the method, based on the hash function, a code _ table of the cblock _ map type is added, and for all processed character string caches, the cblock _ map fast access capability is relied on, and the hashed hash value which is out of order is converted into the hash sequence number which is increased from 0, so as to provide the ordered character string hash value for the calling party. When the hash function encounters the hash collision problem when processing the character string, the form of a linked list is adopted, the character string value comparison is completed in sequence, and the hash collision is completely avoided. The algorithm processing jitter caused by the hash collision is negligible in consideration of the small probability of the hash collision and the efficient traversal characteristics of the linked list.
In the above embodiments, appropriate extensions may be made. For example, the cblock _ map underlying storage class may be replaced by other types of classes, and the underlying storage may use other data structures other than two-dimensional arrays of pointers, as long as a mapping of a large range of hash values is provided. In the above embodiment, a linked list address method is adopted as a solution for hash collision, and other modes such as an open address method, linear detection, quadratic detection, and establishment of a common overflow area may be substituted. The method can be characterized by sequential numerical conversion of character strings and has the characteristics of high performance and zero conflict.
Fig. 6 illustrates the principles of an embodiment of the unique hash sequence number generation system of the present invention. Referring to fig. 6, the system of the present embodiment includes: newly building a subsystem with a unique hash sequence number, obtaining the subsystem with the unique hash sequence number, and storing the bottom layer of the cblock _ map.
The subsystem for creating the unique hash sequence number comprises a mapping module for creating the hash sequence number, a first branch module for creating the hash sequence number and a second branch module for creating the hash sequence number.
And the mapping module for newly establishing the hash sequence number is configured to acquire the character string of the incoming hash sequence number to be acquired and map the character string into a hash value by using a hash function according to character processing.
And the first branch module for newly building the hash sequence number is configured to check whether a code _ table of the cblock _ map type has a valid value at a position corresponding to the index by taking the hash value as the index, if not, a hash item is built, the hash sequence number is assigned to the newly built hash item and is increased by 1, a hash chain table with the hash item as a head pointer is built, and the hash chain table is stored at an index position corresponding to the code _ table and then returned to the hash sequence number.
The second branch module for newly building the hash sequence number is configured to check whether an effective value exists in a code _ table of the cblock _ map type by taking the hash value as an index, if the effective value exists in the code _ table in the index corresponding position, the effective value is taken as a first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the transmitted character string is compared, and if the character string is equal, the hash sequence number of the hash item is returned; and if no equal character string exists, creating a new hash item at the tail node of the linked list, updating the hash sequence number and the character string value of the hash item, increasing the hash sequence number by 1, and returning the hash sequence number of the new hash item.
The subsystem for acquiring the unique hash sequence number comprises: the system comprises a mapping module for acquiring the hash sequence number, a first branch module for acquiring the hash sequence number and a second branch module for acquiring the hash sequence number.
And the mapping module for acquiring the hash sequence number is configured to acquire a character string of the to-be-acquired hash sequence number, and process the mapping hash value according to characters by using a hash function.
And the first branch module for acquiring the hash sequence number is configured to check whether an effective value exists in a code _ table of the cblock _ map type by taking the hash value as an index, and if the effective value does not exist in the position corresponding to the index, returning to the inquiry failure.
A second branch module for obtaining the hash sequence number, configured to check, with the hash value as an index, whether an effective value exists at a position corresponding to the index in the code _ table of the cblock _ map type, if the effective value exists at the position corresponding to the index in the code _ table, the effective value is used as a first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the incoming character string is compared, and if the character string is equal, the hash sequence number of the hash item is returned; if no equal character strings exist, returning the query failure.
The data caching structure of the cblock _ map is used for rapidly reading a caching value according to an index, wherein the bottom layer of the cblock _ map stores and manages data in a two-dimensional pointer array form, row and column numerical values can be defined during initialization, but no memory application is carried out, the two-dimensional pointer array is initialized as required according to an index position when the pointer is inserted, and the array of the row where the index is located is initialized every time.
The bottom-layer storage component of the cblock _ map is further configured with an initialization unit, a data saving unit and a data reading unit.
The device comprises an initialization unit, a code _ table and a code _ table, wherein the initialization unit is configured to create a pointer of a cblock _ map type, parameters of line number and page number are added in a construction method, a cblock _ map bottom layer is stored in a two-dimensional pointer array form, the value of the line number and the page number specifies the maximum index number supported by the code _ table, and when the array is initialized, the line array is uniformly set as a null pointer without additional space application;
the data storage unit is configured to judge which row array the data to be stored should be located in according to the incoming hash sequence number value, if the row array does not exist, a new row array is established and initialized, then the remainder of the number of pages is obtained according to the hash sequence number to obtain a specific storage position, and the array to be stored is updated to the storage position;
the data reading unit is configured to judge which row array the data to be read should be located in according to the incoming hash sequence number value, and if the row array does not exist, the data reading unit returns that the reading fails; and (4) taking the surplus of the pages according to the hash sequence number to obtain a specific storage position, judging whether the storage position is empty, if so, returning the inquiry failure, otherwise, returning the value stored at the index.
While, for purposes of simplicity of explanation, the methodologies are shown and described as a series of acts, it is to be understood and appreciated that the methodologies are not limited by the order of acts, as some acts may, in accordance with one or more embodiments, occur in different orders and/or concurrently with other acts from that shown and described herein or not shown and described herein, as would be understood by one skilled in the art.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. Any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a web site, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk (disk) and disc (disc), as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks (disks) usually reproduce data magnetically, while discs (discs) reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A method for generating a unique hash sequence number is characterized in that the method comprises a process of creating the unique hash sequence number, and the new process comprises the following steps:
firstly, acquiring a character string with a to-be-acquired hash sequence number, and mapping the character string into a hash value according to character processing by using a hash function;
checking whether a code _ table of the cblock _ map type has a valid value at a position corresponding to an index by taking the hash value as the index, if not, creating a hash item, assigning a hash sequence number to the newly created hash item, increasing 1 by itself, simultaneously creating a hash chain table taking the hash item as a head pointer, storing the hash chain table at the index position corresponding to the code _ table, and returning the hash sequence number; if the index corresponding position has an effective value in the code _ table, the effective value is used as the first node of the hash chain table, sub-items of the hash chain table are traversed, whether the character string cached in each hash item is equal to the input character string is compared, and if the character string is equal, the hash sequence number of the hash item is returned; and if no equal character string exists, creating a new hash item at the tail node of the linked list, updating the hash sequence number and the character string value of the hash item, increasing the hash sequence number by 1, and returning the hash sequence number of the new hash item.
2. The method of claim 1, further comprising a process of obtaining the hash sequence number, wherein the obtaining process comprises:
firstly, acquiring a character string with a to-be-taken hash serial number, and mapping a hash value according to character processing by using a hash function;
checking whether a valid value exists in a position corresponding to the index in a code _ table of the cblock _ map type by taking the Hash value as the index, and if the valid value does not exist, returning to the inquiry failure; if the index corresponding position has an effective value in the code _ table, taking the effective value as a first node of the hash chain table, traversing sub-items of the hash chain table, comparing whether the character string cached in each hash item is equal to the incoming character string, and if the character string is equal, returning the hash serial number of the hash item; if no equal character strings exist, returning to the inquiry failure.
3. The method for generating the unique hash sequence number according to claim 2, wherein a data cache structure of the cblock _ map is to read cache values quickly according to indexes, wherein a bottom layer of the cblock _ map stores and manages data in a two-dimensional pointer array form, row and column values can be defined during initialization, but no memory application is performed, the two-dimensional pointer array is initialized as required according to an index position when the index is inserted, and an array of rows where the indexes are located is initialized each time.
4. The unique hash sequence number generation method of claim 3, wherein the underlying storage component of cblock _ map is further configured with processes of initialization, data saving, and data reading, wherein:
the code _ table initialization procedure of the cblock _ map type is further configured to: firstly, creating a pointer of a cblock _ map type, adding parameters of line number and page number in a construction method, storing a cblock _ map bottom layer into a two-dimensional pointer array form, specifying the maximum index number supported by code _ table by the value of line number and page number, uniformly setting the line array as a null pointer during array initialization, and not applying for additional space;
the code _ table save data flow of cblock _ map type is further configured to: firstly, judging which row array the data to be stored should be located in according to the value of the transmitted hash sequence number, if the row array does not exist, establishing and initializing the row array, then taking the remainder of the page number according to the hash sequence number to obtain a specific storage position, and updating the array to be stored to the storage position;
the code _ table read data flow of the cblock _ map type is further configured to: firstly, judging which row array the data to be read should be located in according to the incoming hash sequence number value, and if the row array does not exist, returning to read failure; and (4) taking the surplus of the pages according to the hash sequence number to obtain a specific storage position, judging whether the storage position is empty, if so, returning to the failure of query, otherwise, returning to the value stored at the index.
5. A unique hash sequence number generation system, comprising: creating a subsystem with a new unique hash sequence number, wherein the subsystem with the new unique hash sequence number further comprises:
newly establishing a mapping module of the hash sequence number, acquiring a character string which is transmitted with the hash sequence number to be acquired, and mapping the character string into a hash value according to character processing by using a hash function;
the method comprises the steps that a first branch module of a newly-built Hash sequence number is used for checking whether an effective value exists in a code _ table of a cblock _ map type or not in a position corresponding to an index by taking a Hash value as an index, if the effective value does not exist, a Hash item is built, the Hash sequence number is assigned to the newly-built Hash item and is increased by 1, a Hash chain table with the Hash item as a head pointer is built, and the Hash sequence number is returned after the Hash chain table is stored in an index position corresponding to the code _ table;
a second branch module for newly building a hash sequence number, using the hash value as an index, checking whether an effective value exists at a position corresponding to the index in code _ table of the cblock _ map type, if so, taking the effective value as a first node of the hash chain table, traversing sub-items of the hash chain table, comparing whether the character string cached in each hash item is equal to the input character string, and if so, returning the hash sequence number of the hash item; and if no equal character string exists, creating a new hash item at the tail node of the linked list, updating the hash sequence number and the character string value of the hash item, increasing the hash sequence number by 1, and returning the hash sequence number of the new hash item.
6. The unique hash sequence number generation system of claim 5, wherein the system comprises: a subsystem for obtaining a unique hash sequence number, wherein the subsystem for obtaining a unique hash sequence number further comprises:
the mapping module for acquiring the hash sequence number acquires a character string transmitted with the hash sequence number to be acquired, and processes and maps the hash value according to characters by using a hash function;
the first branch module for acquiring the hash sequence number checks code _ table of cblock _ map type by taking the hash value as an index, checks whether an effective value exists at the position corresponding to the index, and returns to the inquiry failure if the effective value does not exist;
a second branch module for obtaining a hash sequence number, checking whether an effective value exists in a code _ table of a cblock _ map type by taking a hash value as an index, if so, taking the effective value as a first node of the hash chain table, traversing sub-items of the hash chain table, comparing whether a character string cached in each hash item is equal to an incoming character string, and if so, returning the hash sequence number of the hash item; if no equal character strings exist, returning the query failure.
7. The unique hash sequence number generation system of claim 6, wherein the data cache structure of the cblock _ map is to read cache values quickly according to indexes, wherein the bottom layer of the cblock _ map stores and manages data in a two-dimensional pointer array form, row and column values can be defined during initialization, but no memory application is made, the two-dimensional pointer array is initialized as required according to the index position when inserted, and the array of the row of the index is initialized each time.
8. The unique hash sequence number generation system of claim 7, wherein the system further comprises an underlying storage component of cblock _ map, the underlying storage component of cblock _ map further configured with an initialization unit, a data saving unit, and a data reading unit, wherein:
the device comprises an initialization unit, a code _ table and a code _ table, wherein the initialization unit is configured to create a pointer of a cblock _ map type, parameters of line number and page number are added in a construction method, a cblock _ map bottom layer is stored in a two-dimensional pointer array form, the value of the line number and the page number specifies the maximum index number supported by the code _ table, and when the array is initialized, the line array is uniformly set as a null pointer without additional space application;
the data storage unit is configured to judge which row array the data to be stored should be located in according to the transmitted hash sequence number value, if the row array does not exist, a new row array is established and initialized, then the number of pages is left according to the hash sequence number to obtain a specific storage position, and the array to be stored is updated to the storage position;
the data reading unit is configured to judge which row array the data to be read should be located in according to the incoming hash sequence number value, and if the row array does not exist, the data reading unit returns that the reading fails; and (4) taking the surplus of the pages according to the hash sequence number to obtain a specific storage position, judging whether the storage position is empty, if so, returning the inquiry failure, otherwise, returning the value stored at the index.
CN202210920745.4A 2022-08-02 2022-08-02 Unique hash sequence number generation method and system Pending CN115203211A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210920745.4A CN115203211A (en) 2022-08-02 2022-08-02 Unique hash sequence number generation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210920745.4A CN115203211A (en) 2022-08-02 2022-08-02 Unique hash sequence number generation method and system

Publications (1)

Publication Number Publication Date
CN115203211A true CN115203211A (en) 2022-10-18

Family

ID=83585657

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210920745.4A Pending CN115203211A (en) 2022-08-02 2022-08-02 Unique hash sequence number generation method and system

Country Status (1)

Country Link
CN (1) CN115203211A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116056146A (en) * 2023-03-06 2023-05-02 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116056146A (en) * 2023-03-06 2023-05-02 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array
CN116056146B (en) * 2023-03-06 2023-07-04 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array

Similar Documents

Publication Publication Date Title
CN110008738B (en) Caching method, device, medium and computing equipment for block chain contract data
CN110134335B (en) RDF data management method and device based on key value pair and storage medium
CN111352586B (en) Directory aggregation method, device, equipment and medium for accelerating file reading and writing
WO2018205151A1 (en) Data updating method and storage device
CN111177143B (en) Key value data storage method and device, storage medium and electronic equipment
CN111324665A (en) Log playback method and device
CN113535670B (en) Virtual resource mirror image storage system and implementation method thereof
US9292549B2 (en) Method and system for index serialization
CN109460406B (en) Data processing method and device
US10860480B2 (en) Method and device for cache management
CN111352589B (en) Distributed storage method, device, equipment and readable medium
KR20210027625A (en) Method for managing of memory address mapping table for data storage device
CN113326005A (en) Read-write method and device for RAID storage system
CN115203211A (en) Unique hash sequence number generation method and system
CN115718819A (en) Index construction method, data reading method and index construction device
CN115952195A (en) Block chain data tracing query optimization method
CN112131200B (en) Cifs sharing-based distributed mass file query system and method
US10691757B1 (en) Method and system for cached document search
CN111241090B (en) Method and device for managing data index in storage system
WO2007087754A1 (en) Object reference method and system based on object storage library
CN112860802A (en) Database operation statement processing method and device and electronic equipment
CN115934583B (en) Hierarchical caching method, device and system
CN114077378A (en) Index construction method and device
CN115495462A (en) Batch data updating method and device, electronic equipment and readable storage medium
CN114490727A (en) High-dimensional vector searching method for target database and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination