CN106815227A - A kind of method and apparatus of storage information - Google Patents
A kind of method and apparatus of storage information Download PDFInfo
- Publication number
- CN106815227A CN106815227A CN201510850340.8A CN201510850340A CN106815227A CN 106815227 A CN106815227 A CN 106815227A CN 201510850340 A CN201510850340 A CN 201510850340A CN 106815227 A CN106815227 A CN 106815227A
- Authority
- CN
- China
- Prior art keywords
- information
- identity
- compressed file
- offset code
- file
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/174—Redundancy elimination performed by the file system
- G06F16/1744—Redundancy elimination performed by the file system using compression, e.g. sparse files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Relatively low with the compression ratio for solving prior art short message the invention relates to technical field of data storage, more particularly to a kind of method and apparatus of storage information, take up room big problem.The embodiment of the present application provides a kind of method of storage information, and the information Store that the method will be received is in the buffer;After the quantity of the information for receiving reaches setting quantity, the information to being stored in the buffering area is compressed treatment, generates a compressed file;By in the total information storage file in compressed file write-in storage medium.Because the embodiment of the present application is compressed multiple information as an entirety, the overall information content increases, and improves the similarity of the information content, therefore can improve the compression ratio of information, preferably saves memory space.
Description
Technical field
The application is related to technical field of data storage, more particularly to a kind of method and apparatus of storage information.
Background technology
In recent years, with the development of network technology, panoramic social platform gradually comes into vogue.These
Platform can be software, such as MSN;Can also be website, such as blog or forum.It is high
The network of speed substantially increases the speed of accumulation and the propagation of information, and people exchange individual's by social platform
Gains in depth of comprehension, exchange various information, facilitate very much.
Information in social platform is broadly divided into four kinds:Voice messaging, text information, pictorial information and video
Information.Wherein, text information proportion is maximum.It is (super that text information is divided into long message according to message length
Cross 200 words) or short message (no more than 200 words).It is presently used for issuing and obtaining short message
Social platform is more popular, such as microblogging and MSN.
With the prevalence of social platform, the text information delivered and store in social platform increases in geometric progression
Plus, the memory technology to text information proposes requirement very high.In order to save memory space, existing letter
Breath memory technology is compressed to every text information, but the compression ratio of short message is relatively low, takes up room big.
The content of the invention
The embodiment of the present application provides a kind of method and apparatus of storage information, is deposited with solving existing memory technology
Compression ratio is low during storage short message, and take up room big shortcoming.
The embodiment of the present application provides a kind of method of storage information, including:
The information Store from user equipment that will be received is in the buffer;
After the quantity of the information for receiving reaches setting quantity, the information to being stored in the buffering area is pressed
Contracting is processed, and generates a compressed file;
By in the total information storage file in compressed file write-in storage medium.
Because the embodiment of the present application is compressed multiple information as an entirety, the overall information content increases
It is many, improve the similarity of the information content, therefore the compression ratio of information can be improved, preferably save storage
Space.
Optionally, after the compressed file is write in the total information storage file in storage medium, also wrap
Include:
For described information generates an identity for being used for Query Information;
The identity is sent to the user equipment, so that the user equipment is according to the identity mark
Know and search corresponding information.
Deposited because the compressed file offset code that the identity in the embodiment of the present application includes can be used for positioning
The position of the affiliated compressed file in total information storage file of storage information, and can be including information offset code
Information is oriented in compressed file, therefore the position of the information of storage can be easily positioned by identity.
Optionally, it is that described information generates an identity for being used for Query Information, including:
Size generation compressed file offset code according to the total information storage file;
Position generation information offset code according to described information in the compressed file;
The numeral that the compressed file offset code and described information offset code are combined into is used as inquiring about institute
State the identity of information.
Deposited because the compressed file offset code that the identity in the embodiment of the present application includes can be used for positioning
The position of the affiliated compressed file in total information storage file of storage information, and can be including information offset code
Information is oriented in compressed file, therefore the position of the information of storage can be easily positioned by identity.
Optionally, it is that described information generates an identity for being used to inquire about described information, including:
Order according to the described information for receiving is for described information for described information generates a serial number;
After for described information one identity of generation, also include:
Positional information of the identity of described information with described information in the storage medium is tied up
It is fixed;
Wherein, the positional information includes compressed file offset code and information offset code.
Because the embodiment of the present application can generate the serial number bound with information position, thus can be square
Just user determines the position of information by the binding information between serial number and serial number and positional information
Information.
The embodiment of the present application provide it is a kind of enter row information read method, including:
Receive the identity of the information read the need for user equipment sends;
According to the identity, the corresponding information institute of the identity is determined from total information storage file
Compressed file, wherein the compressed file be the information for receiving quantity reach setting quantity after, it is right
The information stored in the buffering area is compressed what treatment was obtained;
The compressed file is decompressed, and according to owning that the identity is obtained from after decompression
The corresponding information of the identity is determined in information;
The corresponding information of the identity for determining is sent to the user equipment.
The process comprising multiple information can be determined according to identity because the embodiment of the present application provides method
The information corresponding with identity in the total information storage file of compression, therefore, the embodiment of the present application reads
The method of information can be used for reading specific in the compression ratio being made up of multiple information compressed file higher
Information.
Optionally, it is described according to the identity, the identity is determined from total information storage file
Compressed file where corresponding information, including:
According to the compressed file offset code that the identity is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
The identity correspondence is determined from all information obtained after decompression according to the identity
Information, including:
According to the information offset code that the identity is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Because the embodiment of the present application identity includes compressed file offset code and information offset code, it is possible to root
Determine according to compressed file offset code and information offset code corresponding with compressed file offset code and information offset code
Information, therefore the embodiment of the present application can accurately determine to be compressed with total letter of multiple information according to identity
An information in breath storage file.
Optionally, it is described according to the identity, the identity is determined from total information storage file
Compressed file where corresponding information, including:
The binding relationship of identity and positional information of the information in the storage medium according to information, really
Surely the corresponding positional information of the identity for receiving;
According to the compressed file offset code that the positional information is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
The identity correspondence is determined from all information obtained after decompression according to the identity
Information, including:
According to the information offset code that the positional information is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Tied up due to existing between the embodiment of the present application identity and compressed file offset code and information offset code
Determine relation, it is possible to determine and compressed file offset code and letter according to compressed file offset code and information offset code
The corresponding information of offset code is ceased, therefore the embodiment of the present application can accurately determine to be compressed with according to identity
An information in the total information storage file of multiple information.
The embodiment of the present application provides a kind of equipment of storage information, including:
Buffer module, for the information Store from user equipment that will receive in the buffer;
Compression module, for after the quantity of the information for receiving reaches setting quantity, to being deposited in the buffering area
The information of storage is compressed treatment, generates a compressed file;
Writing module, for by the total information storage file in compressed file write-in storage medium.
Optionally, said write module, is additionally operable to:
For described information generates an identity for being used for Query Information;
The identity is sent to the user equipment, so that the user equipment is according to the identity mark
Know and search corresponding information.
Optionally, said write module, specifically for:
Size generation compressed file offset code according to the total information storage file;
Position generation information offset code according to described information in the compressed file;
The numeral that the compressed file offset code and described information offset code are combined into is used as inquiring about institute
State the identity of information.
Optionally, said write module, specifically for:
Order according to the described information for receiving is for described information for described information generates a serial number;
Positional information of the identity of described information with described information in the storage medium is tied up
It is fixed;
Wherein, the positional information includes compressed file offset code and information offset code.
The embodiment of the present application provide it is a kind of enter row information read equipment, including:
Receiver module, the identity for receiving the information read the need for user equipment sends;
Compression set module, for according to the identity, the body being determined from total information storage file
Compressed file where the corresponding information of part mark, wherein the compressed file is the quantity in the information for receiving
After reaching setting quantity, the information to being stored in the buffering area is compressed what treatment was obtained;
Information locating module, for being decompressed to the compressed file, and according to the identity from
The corresponding information of the identity is determined in all information obtained after decompression;
Sending module, for the corresponding information of the identity for determining to be sent into the user equipment.
Optionally, the compression set module, specifically for:
According to the compressed file offset code that the identity is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module, specifically for:
According to the information offset code that the identity is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Optionally, the compression set module, specifically for:
The binding relationship of identity and positional information of the information in the storage medium according to information, really
Surely the corresponding positional information of the identity for receiving;
According to the compressed file offset code that the positional information is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module, specifically for:
According to the information offset code that the positional information is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Brief description of the drawings
Fig. 1 is the method flow schematic diagram of the embodiment of the present application storage information;
Fig. 2 is the method flow schematic diagram that the embodiment of the present application reads information;
Fig. 3 is the overall flow figure of the method that the embodiment of the present application stored and read information;
Fig. 4 is the device structure schematic diagram of the embodiment of the present application storage information;
Fig. 5 is the device structure schematic diagram that the embodiment of the present application reads information;
Fig. 6 (a) is the system schematic of the embodiment of the present application;
Fig. 6 (b) is a kind of theory diagram of storage information of the embodiment of the present application.
Specific embodiment
The information Store that a kind of method and apparatus of storage information of the embodiment of the present application offer will be received is in buffering
Qu Zhong;After the quantity of the information for receiving reaches setting quantity, the information to being stored in the buffering area is carried out
Compression is processed, and generates a compressed file;The compressed file is write the total information storage in storage medium
In file.Because the embodiment of the present application is compressed multiple information as an entirety, in overall information
Appearance increases, and improves the similarity of the information content, therefore can improve the compression ratio of information, preferably saves
Memory space.
To make the purpose, technical scheme and advantage of the embodiment of the present application clearer, below in conjunction with the application
Accompanying drawing in embodiment, is clearly and completely described to the technical scheme in the embodiment of the present application, it is clear that
Described embodiment is some embodiments of the present application, rather than whole embodiments.Based in the application
Embodiment, those of ordinary skill in the art obtained under the premise of creative work is not made it is all its
His embodiment, belongs to the scope of the application protection.
As shown in figure 1, the embodiment of the present application provides a kind of method of storage information, including:
Step 101, the information Store that will be received are in the buffer;
Step 102, the information for receiving quantity reach setting quantity after, in the buffering area store
Information is compressed treatment, generates a compressed file;
Step 103, by the compressed file write storage medium in total information storage file in.
The equipment that the executive agent of the embodiment of the present application method can have storage information function, such as server,
The plurality of devices such as mobile phone, are illustrated using server as executive agent below for convenience of description.Server will
The information for receiving carries out certain treatment and restores in storage medium.Buffering area can be server internal memory or
Hard disk.Buffering area there are certain requirements to read or write speed, and the read or write speed of internal memory is very fast, does buffering area and is more suitable for.
There can be multiple buffering area in server, the different types of information of each buffering area correspondence.
Server can obtain information from one or more user equipmenies.Information can be including but not limited to following
Content:
Word, sound, picture or video.
In practical application, the information received from user equipment can be put into buffering area by server, work as Information Number
Amount reaches setting quantity (user can set, such as 1000), and all of information in buffering area is compressed
Treatment.A compressed file is obtained after compression, by compressed file write-in total information storage file.After write-in
Compressed file turn into total information storage file a blocks of files.Total information storage file is dedicated for storage
Information, wherein being divided into a compressed file block, a plurality of information is included in each compressed file block.Same clothes
One or more total information storage files are stored in business device, each total information storage file represents a kind of info class
Type.For example, same server can store total information storage file 1 and total information storage file 2, deposit
The information type stored up in total information storage file 1 is " word ", is stored in total information storage file 2
Information type is " sound ".
When server includes multiple buffering area, server includes same amount of total information storage file.It is slow
Rush area and total information storage file is corresponded, and type is identical.Server after information is received, to letter
Breath type is judged, then information is stored in into the buffering area that type meets, and then the information in buffering area is deposited
Enter with buffering area type identical total information storage file.For example, server receives information being carried out to information
Judge, if information is acoustic information, by acoustic information storage to the buffering area for caching acoustic information,
When the information content in acoustic information buffering area reaches setting quantity, then to the sound in the buffering area of acoustic information
Message breath is compressed, then by the corresponding total information storage file of compressed file write-in acoustic information;If
Information is text information, then by text information storage to the buffering area for caching text information, when word letter
Information content in breath buffering area reaches setting quantity, then the text information in text information buffering area is carried out
Compression, then by the corresponding total information storage file of compressed file write-in text information.
Can also be stored separately for compressed file by server, but when needing to read the information being stored in, Ke Nengxu
Open multiple compressed files, speed is relative deposit be in it is slower in a total information storage file.
Optionally, method is in the total information storage file in compressed file being write into total information storage file
Comprising all data after write the compressed file.
If when server generates compressed file, total information storage file has been present, then in storage medium
This newly-generated compressed file is added at the ending of the total information storage file of storage.For example, server is given birth to
Into compressed file, total information storage file has been present, and is 2MB, then in total information storage file 2MB
Write-in compressed file is added behind file.
If when server generates compressed file, total information storage file does not exist, then by the pressure in buffering area
Contracting file writes storage medium as total information storage file.
The embodiment of the present application server can check the information of storage for user, be that the information of each storage is compiled
Compressed file offset code and information offset code are made, and has generated the identity bound therewith.Compressed file is inclined
The positional information that frameshit and information offset code representative information are stored in total information storage file is stored.If storage
There are multiple total information storage files in medium, server can be by different total information storage file storages in tool
Have different digital number file in.When the corresponding buffering area of total information storage file receives information,
Server can also generate the file numeral identical total information stored with the total information storage file and store
Code.For example, total information storage file 1 is stored in the file of entitled " 1 ", when correspondence total information is deposited
In the buffering area of storage file 1 during storage information, except generating compressed file offset code corresponding with information and letter
Breath offset code, also generates total information storage code, and the content of total information storage code is " 1 ".
Compressed file offset code:The compressed file block belonging to the information corresponding with identity is represented to be stored in always
Before information Store file, the size of total information storage file.For example, one information is stored in server slow
Area is rushed, now the size of total information storage file is 2MB, the lowest order of compressed file offset code represents 1KB
Size, then compressed file offset code is 2048.Server can determine total information according to compressed file offset code
Compressed file block corresponding with compressed file offset code in storage file, and to its decompression processing, solved
Pressure file.The size that the lowest order of compressed file offset code represents capacity can be set.
Information offset code:Server receives information and information can be stored in into buffering area, when being stored in buffering area, according to
The quantity generation information offset code of information in buffering area.For example, when information is stored in buffering area, having in buffering area
4 information, then information offset code is 4.First the information offset code for being stored in buffering area is 0.Server exists
Decompression processing is carried out to the compressed file block belonging to information according to compressed file offset code, after obtaining decompressing files,
Corresponding that information of information offset code is chosen in a plurality of information that decompressing files is included by information offset code
Elect and be returned to user equipment.
Identity:User equipment is needed to the corresponding identity of server with information in server lookup information
Mark.Identity can be divided into two kinds.
The first, identity comprising information compressed file offset code and information offset code
In practical application, identity can be 32 bit binary numbers, and first 16 offset for compressed file
Code, 16 is information offset code afterwards.
For example, a compressed file offset code for information is binary number 10000000000, compressed file is inclined
Lowest order represents 1KB in frameshit, and information offset code is binary number 10.Then server is navigated to always first
Information Store file includes multiple compressed file blocks, in the corresponding total information storage file of compressed file block 1
Content in 0~1MB memory spaces, 1~2MB storages in the corresponding total information storage file of compressed file block 2
Content.Then server determines that the file to be inquired about belongs to compressed file block 2 according to compressed file offset code,
Compressed file block 2 is decompressed, decompressing files is obtained.There are 100 sequential information in decompressing files,
Determine that the information to be inquired about is the Article 3 in this 100 information according to information offset code.
Secondth, serial number
Identity can be the serial number of information, and representative server received institute before an information is received
There is the quantity of information (including in buffering area and in compressed file block).Serial number and compressed file offset code
There are mapping relations with information offset code.Server can be compiled according to serial number and mapping relations determination order
Number corresponding compressed file offset code and information offset code, further according to compressed file offset code and information offset code
Determine the information corresponding with compressed file offset code and information offset code that total information storage file is included.
For example, equipment received 32 information altogether before an information is received, then the serial number of the information
(identity) is 32.Serial number 32 has mapping relations with document misregistration code 1 and information offset code 2,
It is literary with compression that server determines that total information storage file is included according to document misregistration code 1 and information offset code 2
Part offset code 1 and information offset 2 corresponding information of code.
If identity is serial number, server is inclined with compressed file offset code and information by serial number
In mapping relations storage indexed file between frameshit, when user equipment proposes that inquiry identity is corresponding
After information, server determines the corresponding compressed file offset code of identity and information offset according to index file
Code.
Wherein, index file includes serial number and the compressed file offset code corresponding with serial number and letter
Breath offset code.For example, index file is " 1 --- 10 ", " 2 --- 11 ", compressed file offset code and information
Offset code is respectively 1 bit digital.In serial number " 1 " corresponding " 10 " 1 to represent compressed file offset code be 1,
0 representative information offset code is 0.
As shown in Fig. 2 the embodiment of the present application provides a kind of method of reading information including:
Step 201, receives the identity of the information read the need for user equipment sends;
Step 202, according to the identity, determines the identity pair from total information storage file
Compressed file where the information answered, wherein the compressed file is to reach setting in the quantity of the information for receiving
After quantity, the information to being stored in the buffering area is compressed what treatment was obtained;
Step 203, decompresses to the compressed file, and according to the identity from after decompression
The corresponding information of the identity is determined in all information for obtaining;
Step 204, the user equipment is sent to by the corresponding information of the identity for determining.
The embodiment of the present application user equipment can be panel computer, mobile phone or other terminals that can be surfed the Net.
The method of the executive agent server of storage information method and reading information holds in the embodiment of the present application
Row principal server can be same equipment, or two equipment.If two equipment, two set
The transmission of total information storage file can be completed between standby.
Can be same user equipment to server storage information and the equipment for reading information from server,
Can be two different user equipmenies.If two equipment, can be by the equipment of server storage information
The equipment that the identity of the storage information received from server is sent to reading information, to read information
Equipment is according to identity Query Information.
For example, user equipment 1 to server storage information A, and obtain the identity of information A from server
Mark, user equipment 2 by with user equipment 1 synchronously obtain the identity of information A, it is also possible to from clothes
Business device inquires information A.
User equipment provides the identity of the information to be inquired about to server.Identity by server with
Family device-to-server is generated when storing an information, for inquiring about what is stored in this information, with server
Information is one-to-one.After user equipment is to server storage information, server can feed back to user equipment
The identity of information.User equipment can classify to the identity fed back, and the standard of classification can be with
It is time or information type.For example, user has issued a voice messaging in January 1 using microblogging software,
Identity of the server feedback to this information of user equipment.After user equipment receives the identity, will
The information puts the issue of January 1 voice messaging classification under, and user can be by inquiring about the information on January 1
" voice " classification obtains the identity of this information.
Total information storage file is dedicated for storage information, wherein it is divided into a compressed file block, each compression text
Include a plurality of information in part block.One or more total information storage files are stored in same server, often
Individual total information storage file represents a kind of information type.For example, same server can store total information depositing
Storage file 1 and total information storage file 2, the information type stored in total information storage file 1 is " word ",
The information type stored in total information storage file 2 is " sound ".
Identity in the embodiment of the present application is divided into two kinds:
The first, identity comprising information compressed file offset code and information offset code
Server can determine the information to be inquired about according to compressed file offset code and information offset code.
Compressed file offset code:The compressed file block belonging to the information corresponding with identity is represented to be stored in always
Before information Store file, the size of total information storage file.For example, one information is stored in server slow
Area is rushed, now the size of total information storage file is 2MB, the lowest order of compressed file offset code represents 1KB
Size, then compressed file offset code is 2048.Server can determine total information according to compressed file offset code
Compressed file block corresponding with compressed file offset code in storage file, and to its decompression processing, solved
Pressure file.The size that the lowest order of compressed file offset code represents capacity can be set.
Information offset code:Server receives information and information can be stored in into buffering area, when being stored in buffering area, according to
The quantity generation information offset code of information in buffering area.For example, when information is stored in buffering area, having in buffering area
4 information, then information offset code is 4.First the information offset code for being stored in buffering area is 0.Server exists
Decompression processing is carried out to the compressed file block belonging to information according to compressed file offset code, after obtaining decompressing files,
Corresponding that information of information offset code is chosen in a plurality of information that decompressing files is included by information offset code
Elect and be returned to user equipment.
After server receives identity, the compressed file offset code in identity determines and total information
The corresponding compressed file block of compressed file offset code in storage file, and it is decompressed.For example, compression
The lowest order of document misregistration code represents 1KB sizes, then compressed file offset code is 2048, then server is true
The compressed file block being positioned at total information storage file 2048KB, and it is decompressed.Obtained after decompression
Obtain multiple decompressions file (i.e. a plurality of information).
Server determines the position of the corresponding information of information offset code in a plurality of information according to information offset code.Example
Such as, information offset code is 4, then the 4th in a plurality of information article is the corresponding information of information offset code.
In practical application, identity can be 32 bit binary numbers, and first 16 offset for compressed file
Code, 16 is information offset code afterwards.
Secondth, serial number
Identity can be the serial number of information, serial number and compressed file offset code and information offset
There are mapping relations in code.Mapping relations between serial number and compressed file offset code and information offset code are deposited
In storage indexed file.Server can be in serial number and index file mapping relations determination sequentially
Corresponding compressed file offset code and information offset code are numbered, further according to compressed file offset code and information offset
Code determines the information corresponding with compressed file offset code and information offset code that total information storage file is included.Example
Such as, the identity of the information to be inquired about that user equipment sends to server is serial number 1, server
Inquiry search index file, obtains compressed file offset code corresponding with serial number 1 and information offset code.
Determine information approach with compression of the identity comprising information according to compressed file offset code and information offset code
Document misregistration code is identical with the description in information offset code.
Wherein, index file includes serial number and the compressed file offset code corresponding with serial number and letter
Breath offset code.For example, index file is " 1 --- 10 ", " 2 --- 11 ", compressed file offset code and information
Offset code is respectively 1 bit digital.In serial number " 1 " corresponding " 10 " 1 to represent compressed file offset code be 1,
0 representative information offset code is 0.
Server sends information to user equipment after determining information, and user equipment can be by presentation of information out.
Embodiment of the present invention storage information and read information executive agent can be same entity, or
Different entities.
Illustrated so that storage information and reading information executive agent are same servers as an example below.
As shown in figure 3, the embodiment of the present application provides a kind of overall flow for storing and reading information including:
Step 301~step 304 in the overall flow of the embodiment of the present application is constantly to perform repeatedly.
Step 301, server receives the information of user equipment input;
The information of network protocol format is converted into step 302, the server information of native protocol;
Step 303, the server is stored the information in buffering area, generation compressed file offset code,
Information offset code and identity, comprising compressed file offset code and information offset code wherein in identity;
Identity is sent to the user equipment by step 304, the server;
Step 305, the server are if it is determined that the quantity of the information in buffering area reaches setting quantity, then right
Information in buffering area is compressed, and compressed file is write into total information storage file;
Step 306, the server receives the identity for wanting Query Information of user equipment transmission;
Step 307, the identification information of the procotol that the server will be received from the user equipment
And it is converted into the identification information of native protocol;
Step 308, the server according to the compressed file offset code included in the identity of native protocol,
Compressed file where the corresponding information of identity of native protocol is determined from total information storage file;
Step 309, the server is decompressed to the compressed file, and according to the identity
In include information offset code determine that the identity is corresponding from all information obtained after decompression
Information;
The corresponding information of the identity for determining is sent to the user by step 310, the server
Equipment.
Based on same inventive concept, a kind of equipment of data storage is additionally provided in the embodiment of the present application, due to
The corresponding method of the equipment is the method in the embodiment of the present application, and the principle of equipment solve problem and this Shen
Please embodiment method it is similar, therefore the implementation of the device may refer to the implementation of method, repeat part no longer
Repeat.
As shown in figure 4, the embodiment of the present application provides a kind of equipment of storage information, including:
Buffer module 401, for the information Store that will receive in the buffer;
Compression module 402, for after the quantity of the information for receiving reaches setting quantity, to the buffering area
The information of middle storage is compressed treatment, generates a compressed file;
Writing module 403, for by the total information storage file in compressed file write-in storage medium.
Optionally, said write module 403, specifically for:
For described information generates an identity for being used for Query Information;
The identity is sent to the user equipment, so that the user equipment is according to the identity mark
Know and search corresponding information.
Optionally, said write module 403, specifically for:
Size generation compressed file offset code according to the total information storage file;
Position generation information offset code according to described information in the compressed file;
The numeral that the compressed file offset code and described information offset code are combined into is used as inquiring about institute
State the identity of information.
Optionally, said write module 403, specifically for:
Order according to the described information for receiving is for described information for described information generates a serial number;
After for described information one identity of generation, also include:
Positional information of the identity of described information with described information in the storage medium is tied up
It is fixed;
Wherein, the positional information includes compressed file offset code and information offset code.
As shown in figure 5, the embodiment of the present application provide it is a kind of enter row information read equipment, including:
Receiver module 501, the identity for receiving the information read the need for user equipment sends;
Compression set module 502, for according to the identity, institute being determined from total information storage file
Compressed file where stating the corresponding information of identity, wherein the compressed file is in the information for receiving
After quantity reaches setting quantity, the information to being stored in the buffering area is compressed what treatment was obtained;
Information locating module 503, for being decompressed to the compressed file, and according to the identity mark
Knowledge determines the corresponding information of the identity from all information obtained after decompression;
Sending module 504, sets for the corresponding information of the identity for determining to be sent into the user
It is standby.
Optionally, the compression set module 502, specifically for:
According to the compressed file offset code that the identity is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module 503, specifically for:
According to the information offset code that the identity is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Optionally, the compression set module 502, specifically for:
The binding relationship of identity and positional information of the information in the storage medium according to information, really
Surely the corresponding positional information of the identity for receiving;
According to the compressed file offset code that the positional information is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module 503, specifically for:
According to the information offset code that the positional information is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
In force, the equipment of the reading information of the equipment of the storage information of the embodiment of the present application Fig. 4 and Fig. 5
Can be two independent equipment, it is also possible to synthesize an equipment.
As shown in Fig. 6 (a), the embodiment of the present application provides a kind of system of storage information, including:User equipment
10 and server 20.User equipment 10 includes application layer, and server 20 includes interface layer, data processing
Layer and data storage layer.
Buffer module 401 above, compression module 402, writing module 403, receiver module 501, pressure
Contracting locating module 502, Information locating module 503 and sending module 504 are all located at the data of server 20
Reason layer.
As shown in Fig. 6 (b), the embodiment of the present application provides a kind of theory diagram of storage information.
Application layer:Information Store and information searching function can be completed, user can be used user equipment to complete should
Layer function.Application layer can be supplied to the interface of user's typing information, and user's typing can also be facilitated to inquire about letter
The condition of the breath and presentation of information that will inquire is out.
Interface layer:User meets procotol in the operation of application layer and information, and interface layer will meet network association
The operation of view and information are converted into operation and the information of the Local server information to meeting native protocol.Interface
Layer includes that information Store interface and information read interface.
Data analysis layer:For completing data compression, index maintenance, data query and data decompression function.
Buffering area is located at data analysis layer.
Data storage layer:For storing index file and total information storage file.
The system of the embodiment of the present application can complete two kinds of functions of information Store and information inquiry.System completes two
The step of kind of function can be:
First, information Store
1st, user is input into information by application layer, and application layer sends information to interface layer;
2nd, the information of network protocol format is converted into interface layer the information of native protocol, and by native protocol
Information be sent to data analysis layer;
3rd, data analysis layer is stored information in buffering area, generation compressed file offset code, information offset
Code and identity, and updating maintenance state index file;
4th, identity is sent to application layer by data analysis layer by interface layer;The body that application layer will be received
Part mark is stored;
5th, data analysis layer is if it is determined that the data in buffering area reach setting quantity, then to the letter in buffering area
Breath is compressed, and by the total information storage file of compressed file write data accumulation layer, will safeguard state
Index file write-in data storage layer, in replacement data process layer store index file.
2nd, information reads
1st, user obtains the identity for wanting Query Information in application layer, sends it to the interface of server
Layer;
2nd, the identification information of the procotol received from application layer is converted into native protocol by interface layer
Identification information is sent to data analysis layer;
3rd, data analysis layer determines that the compressed file of the information to be inquired about is inclined according to index file and identity
Frameshit and information offset code;
4th, data analysis layer determines the information to be inquired about in the total of data storage layer according to compressed file offset code
Compressed file block affiliated in information Store file, decompression processing is carried out to compressed file block, obtains decompression text
Part;
5th, data analysis layer leads to information according to the information to be inquired about in information offset code determination decompressing files
Cross interface layer and be sent to application layer.
Wherein, user can obtain the identity for wanting Query Information in application layer by certain search criterion.
For example, user searches for " information issued before 10 days " in application layer, application layer is true according to this search condition
Surely (application layer can be the identity mark of the information issued in application layer to judge which information that stores in application layer
The time for know, releasing news is stored for user according to the time to inquire about) meet this condition, and really
The identity of fixed qualified information.
It can be seen from the above:The embodiment of the present application provides a kind of method of storage information, and the method will
The information Store for receiving is in the buffer;After the quantity of the information for receiving reaches setting quantity, to described slow
Rush the information stored in area and be compressed treatment, generate a compressed file;Compressed file write-in is deposited
In total information storage file in storage media.Because the embodiment of the present application is entered multiple information as an entirety
Row compression, the overall information content increases, and improves the similarity of the information content, therefore can improve information
Compression ratio, preferably save memory space.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or meter
Calculation machine program product.Therefore, the application can using complete hardware embodiment, complete application software embodiment,
Or the form of the embodiment in terms of connected applications software and hardware.And, the application can be used at one or many
Individual computer-usable storage medium (the including but not limited to disk for wherein including computer usable program code
Memory, CD-ROM, optical memory etc.) on implement computer program product form.
The application is produced with reference to the method according to the embodiment of the present application, equipment (system) and computer program
The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions realize flow chart and
/ or block diagram in each flow and/or the flow in square frame and flow chart and/or block diagram and/
Or the combination of square frame.These computer program instructions to all-purpose computer, special-purpose computer, insertion can be provided
The processor of formula processor or other programmable data processing devices is producing a machine so that by calculating
The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one
The device of the function of being specified in individual flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or the treatment of other programmable datas to set
In the standby computer-readable memory for working in a specific way so that storage is in the computer-readable memory
Instruction produce include the manufacture of command device, the command device realization in one flow of flow chart or multiple
The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made
Obtain and series of operation steps is performed on computer or other programmable devices to produce computer implemented place
Reason, so as to the instruction performed on computer or other programmable devices is provided for realizing in flow chart one
The step of function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
Although having been described for the preferred embodiment of the application, those skilled in the art once know base
This creative concept, then can make other change and modification to these embodiments.So, appended right will
Ask and be intended to be construed to include preferred embodiment and fall into having altered and changing for the application scope.
Obviously, those skilled in the art can carry out various changes and modification without deviating from this Shen to the application
Spirit and scope please.So, if the application these modification and modification belong to the application claim and
Within the scope of its equivalent technologies, then the application is also intended to comprising these changes and modification.
Claims (14)
1. a kind of method of storage information, it is characterised in that including:
The information Store from user equipment that will be received is in the buffer;
After the quantity of the information for receiving reaches setting quantity, the information to being stored in the buffering area is pressed
Contracting is processed, and generates a compressed file;
By in the total information storage file in compressed file write-in storage medium.
2. method as described in claim 1, it is characterised in that the compressed file is write and is stored
After in total information storage file in medium, also include:
For described information generates an identity for being used for Query Information;
The identity is sent to the user equipment, so that the user equipment is according to the identity mark
Know and search corresponding information.
3. method as described in claim 2, it is characterised in that be used for for described information generates
The identity of Query Information, including:
Size generation compressed file offset code according to the total information storage file;
Position generation information offset code according to described information in the compressed file;
The numeral that the compressed file offset code and described information offset code are combined into is used as inquiring about institute
State the identity of information.
4. method as described in claim 2, it is characterised in that be used for for described information generates
The identity of described information is inquired about, including:
Order according to the described information for receiving is for described information for described information generates a serial number;
After for described information one identity of generation, also include:
Positional information of the identity of described information with described information in the storage medium is tied up
It is fixed;
Wherein, the positional information includes compressed file offset code and information offset code.
5. it is a kind of enter row information read method, it is characterised in that including:
Receive the identity of the information read the need for user equipment sends;
According to the identity, the corresponding information institute of the identity is determined from total information storage file
Compressed file, wherein the compressed file be the information for receiving quantity reach setting quantity after, it is right
The information stored in the buffering area is compressed what treatment was obtained;
The compressed file is decompressed, and according to owning that the identity is obtained from after decompression
The corresponding information of the identity is determined in information;
The corresponding information of the identity for determining is sent to the user equipment.
6. method as described in claim 5, it is characterised in that described according to the identity,
Compressed file where the corresponding information of the identity is determined from total information storage file, including:
According to the compressed file offset code that the identity is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
The identity correspondence is determined from all information obtained after decompression according to the identity
Information, including:
According to the information offset code that the identity is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
7. method as described in claim 5, it is characterised in that described according to the identity,
Compressed file where the corresponding information of the identity is determined from total information storage file, including:
The binding relationship of identity and positional information of the information in the storage medium according to information, really
Surely the corresponding positional information of the identity for receiving;
According to the compressed file offset code that the positional information is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
The identity correspondence is determined from all information obtained after decompression according to the identity
Information, including:
According to the information offset code that the positional information is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
8. a kind of equipment of storage information, it is characterised in that including:
Buffer module, for the information Store from user equipment that will receive in the buffer;
Compression module, for after the quantity of the information for receiving reaches setting quantity, to being deposited in the buffering area
The information of storage is compressed treatment, generates a compressed file;
Writing module, for by the total information storage file in compressed file write-in storage medium.
9. equipment as described in claim 8, it is characterised in that said write module, is additionally operable to:
For described information generates an identity for being used for Query Information;
The identity is sent to the user equipment, so that the user equipment is according to the identity mark
Know and search corresponding information.
10. equipment as described in claim 8, it is characterised in that said write module, specifically for:
Size generation compressed file offset code according to the total information storage file;
Position generation information offset code according to described information in the compressed file;
The numeral that the compressed file offset code and described information offset code are combined into is used as inquiring about institute
State the identity of information.
11. equipment as described in claim 8, it is characterised in that said write module, specifically for:
Order according to the described information for receiving is for described information for described information generates a serial number;
Positional information of the identity of described information with described information in the storage medium is tied up
It is fixed;
Wherein, the positional information includes compressed file offset code and information offset code.
12. it is a kind of enter row information read equipment, it is characterised in that including:
Receiver module, the identity for receiving the information read the need for user equipment sends;
Compression set module, for according to the identity, the body being determined from total information storage file
Compressed file where the corresponding information of part mark, wherein the compressed file is the quantity in the information for receiving
After reaching setting quantity, the information to being stored in the buffering area is compressed what treatment was obtained;
Information locating module, for being decompressed to the compressed file, and according to the identity from
The corresponding information of the identity is determined in all information obtained after decompression;
Sending module, for the corresponding information of the identity for determining to be sent into the user equipment.
13. equipment as described in claim 12, it is characterised in that the compression set module, tool
Body is used for:
According to the compressed file offset code that the identity is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module, specifically for:
According to the information offset code that the identity is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
14. equipment as described in claim 12, it is characterised in that the compression set module, tool
Body is used for:
The binding relationship of identity and positional information of the information in the storage medium according to information, really
Surely the corresponding positional information of the identity for receiving;
According to the compressed file offset code that the positional information is included, determine in the total information storage file with
The corresponding compressed file of the compressed file offset code;
Described information locating module, specifically for:
According to the information offset code that the positional information is included, determine from all information obtained after decompression
Information corresponding with described information offset code.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510850340.8A CN106815227A (en) | 2015-11-27 | 2015-11-27 | A kind of method and apparatus of storage information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510850340.8A CN106815227A (en) | 2015-11-27 | 2015-11-27 | A kind of method and apparatus of storage information |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106815227A true CN106815227A (en) | 2017-06-09 |
Family
ID=59155504
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510850340.8A Pending CN106815227A (en) | 2015-11-27 | 2015-11-27 | A kind of method and apparatus of storage information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106815227A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107910046A (en) * | 2017-11-24 | 2018-04-13 | 郑州云海信息技术有限公司 | A kind of medical image real-time compression system and method |
WO2019184218A1 (en) * | 2018-03-27 | 2019-10-03 | 平安科技(深圳)有限公司 | Log archiving method, electronic device, and readable storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5794228A (en) * | 1993-04-16 | 1998-08-11 | Sybase, Inc. | Database system with buffer manager providing per page native data compression and decompression |
CN1979475A (en) * | 2005-12-07 | 2007-06-13 | 华为技术有限公司 | Compressed file processing method |
CN102193917A (en) * | 2010-03-01 | 2011-09-21 | 中国移动通信集团公司 | Method and device for processing and querying data |
CN102831245A (en) * | 2012-09-17 | 2012-12-19 | 洛阳翔霏机电科技有限责任公司 | Real-time data storage and reading method of relational database |
CN104090987A (en) * | 2014-07-28 | 2014-10-08 | 华中科技大学 | Historical data storage and indexing method |
-
2015
- 2015-11-27 CN CN201510850340.8A patent/CN106815227A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5794228A (en) * | 1993-04-16 | 1998-08-11 | Sybase, Inc. | Database system with buffer manager providing per page native data compression and decompression |
CN1979475A (en) * | 2005-12-07 | 2007-06-13 | 华为技术有限公司 | Compressed file processing method |
CN102193917A (en) * | 2010-03-01 | 2011-09-21 | 中国移动通信集团公司 | Method and device for processing and querying data |
CN102831245A (en) * | 2012-09-17 | 2012-12-19 | 洛阳翔霏机电科技有限责任公司 | Real-time data storage and reading method of relational database |
CN104090987A (en) * | 2014-07-28 | 2014-10-08 | 华中科技大学 | Historical data storage and indexing method |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107910046A (en) * | 2017-11-24 | 2018-04-13 | 郑州云海信息技术有限公司 | A kind of medical image real-time compression system and method |
WO2019184218A1 (en) * | 2018-03-27 | 2019-10-03 | 平安科技(深圳)有限公司 | Log archiving method, electronic device, and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104104717B (en) | Deliver channel data statistical approach and device | |
CN101901248B (en) | Method and device for creating and updating Bloom filter and searching elements | |
CN104504131A (en) | Method and device for realizing user comments based on lineation as well as terminal device and system | |
CN102737065B (en) | Method and device for acquiring data | |
CN103279496A (en) | Terminal and display method of associated information | |
CN106156070B (en) | A kind of querying method, file mergences method and relevant apparatus | |
CN104700836A (en) | Voice recognition method and voice recognition system | |
CN101031101A (en) | Method and device for reminding SMS split | |
CN103475572A (en) | Method, device and system for sending multiple pictures in instant messaging application | |
CN106874348A (en) | File is stored and the method for indexing means, device and reading file | |
CN108572789A (en) | Disk storage method and apparatus, information push method and device and electronic equipment | |
CN104657435A (en) | Storage management method for application data and network management system | |
CN106909595A (en) | A kind of data migration method and device | |
CN103533169A (en) | Method for positioning and linking field of electronic business card based on mobile terminal | |
CN106897283A (en) | The treating method and apparatus of multimedia messages | |
CN104219639A (en) | Method and device for displaying text message record | |
CN106201218A (en) | Method and device for clearing picture files in chat records and mobile device | |
CN116521793A (en) | Meta-universe data processing method and device | |
CN110874358A (en) | Multi-attribute column storage and retrieval method and device and electronic equipment | |
CN106815227A (en) | A kind of method and apparatus of storage information | |
CN105337848B (en) | The remark names preparation method and device of network good friend | |
CN103905661B (en) | The method and Cloud Server of information forwarding | |
CN103957211B (en) | Data communications method and device between client and front end page | |
CN101789991A (en) | Method, device and mobile terminal for acquiring data change information | |
CN105282206A (en) | Method, device and system for processing website resource files |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170609 |
|
RJ01 | Rejection of invention patent application after publication |