Summary of the invention
The embodiment of the present disclosure proposes method and apparatus for storing data.
In a first aspect, the embodiment of the present disclosure provides a kind of method for storing data, this method comprises: receiving fragment
Data and compression advisory information, wherein above-mentioned compression advisory information includes not compressing instruction information or compression tutorial message,
In, above-mentioned compression tutorial message includes compression algorithm information and targeted compression length;In response to the above-mentioned compression advisory information of determination
Including compressing tutorial message, executes following storing step: determining whether to compress above-mentioned fragment data;In response to determining pair
Above-mentioned fragment data is compressed, and is pressed using the corresponding compression algorithm of above-mentioned compression algorithm information above-mentioned fragment data
Contracting, obtains the compressed data of above-mentioned fragment data;In response to the length and above-mentioned targeted compression length of the above-mentioned compressed data of determination
Match, execute following first storing step: correcting and eleting codes being carried out to above-mentioned compressed data and encode to obtain first coding data, and
By the mark associated storage of above-mentioned first coding data, above-mentioned compression algorithm information and above-mentioned fragment data.
In some embodiments, above-mentioned storing step further include: above-mentioned fragment data is not compressed in response to determination
Or determine that the length of above-mentioned compressed data and above-mentioned targeted compression length mismatch, execute following second storing step: to upper
It states fragment data and carries out correcting and eleting codes and encode to obtain the second coded data, and by above-mentioned second coded data and above-mentioned fragment data
Mark associated storage.
In some embodiments, the above method further include: refer in response to the above-mentioned compression advisory information of determination including not compressing
Show information, executes above-mentioned second storing step.
In some embodiments, above-mentioned to determine whether to compress above-mentioned fragment data, comprising: prediction uses above-mentioned pressure
The corresponding compression algorithm of compression algorithm information carries out above-mentioned fragment data to compress the used time;In response to the determination above-mentioned time
More than or equal to preset threshold, determination is not compressed above-mentioned fragment data;It is less than in response to the determination above-mentioned time above-mentioned pre-
If threshold value, determine whether to compress above-mentioned fragment data according to running state information.
In some embodiments, above-mentioned fragment data and above-mentioned compression advisory information are determining in the following manner: being sentenced
Whether acquired initial data of breaking is compressed, and generates compression advisory information based on judging result;By above-mentioned initial data into
Row data fragmentation obtains at least one fragment data.
In some embodiments, the above method further include: receive data acquisition request, wherein above-mentioned data acquisition request
Including target identification;Target data is determined from the data stored according to above-mentioned target identification, wherein target data includes compiling
Code data and mark;In response to further including compression algorithm information in the above-mentioned target data of determination, to the volume in above-mentioned target data
Code data are decoded, and using compression algorithm corresponding with the compression algorithm information in above-mentioned target data to decoded
Coded data is decompressed, and the data that decompression obtains are sent;In response to not including compression in the above-mentioned target data of determination
Algorithm information is decoded the coded data in above-mentioned target data, and the data that decoding obtains are sent.
Second aspect, the embodiment of the present disclosure provide a kind of device for storing data, and above-mentioned apparatus includes: to receive list
Member is configured to receive fragment data and compression advisory information, wherein above-mentioned compression advisory information includes not compressing instruction information
Or compression tutorial message, wherein above-mentioned compression tutorial message includes compression algorithm information and targeted compression length;Execution unit,
It is configured in response to determine that above-mentioned compression advisory information includes compression tutorial message, executes preset storing step, wherein on
It states execution unit and comprises determining that unit, be configured to determine and whether above-mentioned fragment data compressed;Compression unit is matched
It is set to and above-mentioned fragment data is compressed in response to determination, using the corresponding compression algorithm of above-mentioned compression algorithm information to above-mentioned
Fragment data is compressed, and the compressed data of above-mentioned fragment data is obtained;First storage unit is configured in response to determine
The length and above-mentioned targeted compression length for stating compressed data match, and execute following first storing step: to above-mentioned compressed data
It carries out correcting and eleting codes and encodes to obtain first coding data, and by above-mentioned first coding data, above-mentioned compression algorithm information and above-mentioned
The mark associated storage of fragment data.
In some embodiments, above-mentioned execution unit further include: it is not right to be configured in response to determination for the second storage unit
Above-mentioned fragment data compress or determine the length of above-mentioned compressed data and above-mentioned targeted compression length mismatches, execute with
Lower second storing step: correcting and eleting codes are carried out to above-mentioned fragment data and encode to obtain the second coded data, and above-mentioned second is compiled
The mark associated storage of code data and above-mentioned fragment data.
In some embodiments, above-mentioned apparatus further include: third storing step is configured in response to determine above-mentioned compression
Advisory information includes not compressing instruction information, executes above-mentioned second storing step.
In some embodiments, above-mentioned determination unit is further configured to: prediction uses above-mentioned compression algorithm information pair
The compression algorithm answered carries out above-mentioned fragment data to compress the used time;It is greater than or equal in response to the determination above-mentioned time pre-
If threshold value, determination is not compressed above-mentioned fragment data;It is less than above-mentioned preset threshold in response to the determination above-mentioned time, according to fortune
Row status information determines whether to compress above-mentioned fragment data.
In some embodiments, above-mentioned fragment data and above-mentioned compression advisory information are determining in the following manner: being sentenced
Whether acquired initial data of breaking is compressed, and generates compression advisory information based on judging result;By above-mentioned initial data into
Row data fragmentation obtains at least one fragment data.
In some embodiments, above-mentioned apparatus further include: request reception unit is configured to receive data acquisition request,
Wherein, above-mentioned data acquisition request includes target identification;Data determination unit is configured to according to above-mentioned target identification from being deposited
Target data is determined in the data of storage, wherein target data includes coded data and mark;First transmission unit, is configured to
In response to further including compression algorithm information in the above-mentioned target data of determination, the coded data in above-mentioned target data is solved
Code, and decoded coded data is carried out using compression algorithm corresponding with the compression algorithm information in above-mentioned target data
Decompression sends the data that decompression obtains;Second transmission unit is configured in response to determine in above-mentioned target data not
Including compression algorithm information, the coded data in above-mentioned target data is decoded, and the data that decoding obtains are sent out
It send.
The third aspect, the embodiment of the present disclosure provide a kind of server, which includes: one or more processors;
Storage device is stored thereon with one or more programs, when said one or multiple programs are by said one or multiple processors
When execution, so that said one or multiple processors realize the method as described in implementation any in first aspect.
Fourth aspect, the embodiment of the present disclosure provide a kind of computer-readable medium, are stored thereon with computer program,
In, the method as described in implementation any in first aspect is realized when which is executed by processor.
The method and apparatus for storing data that the embodiment of the present disclosure provides receive fragment data and compression recommendation letter
Breath executes following storing step: first, it is determined whether to fragment if it includes compression tutorial message that compression, which is established in information,
Data are compressed, if it is determined that are compressed to fragment data, then using the compression algorithm information pair in compression tutorial message
The compression algorithm answered compresses fragment data, obtains the compressed data of fragment data.Later, if it is determined that fragment data
The length of compressed data matches with the targeted compression length in compression tutorial message, then executes following first storing step: right
Compressed data carries out correcting and eleting codes and encodes to obtain first coding data, and by first coding data, compression algorithm information and fragment number
According to mark associated storage.It realizes before carrying out correcting and eleting codes coding to fragment data according to compression tutorial message to fragment number
According to being compressed, to save data space, data carrying cost is reduced.
Specific embodiment
The disclosure is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the disclosure can phase
Mutually combination.The disclosure is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the method for storing data or device for storing data that can apply the embodiment of the present disclosure
Exemplary system architecture 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103,105 He of network 104 and server
Memory node 106,107,108.Network 104 is to provide communication chain between terminal device 101,102,103 and server 105
The medium on road.Network 104 may include various connection types, such as wired, wireless communication link or fiber optic cables etc..Clothes
It is engaged in connecting between device 105 and memory node 106,107,108 by wired, wireless communication link.
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out
Send message etc..Various telecommunication customer end applications can be installed, such as web browser is answered on terminal device 101,102,103
With, shopping class application, searching class application, instant messaging tools, mailbox client, social platform software etc..
Terminal device 101,102,103 can be hardware, be also possible to software.When terminal device 101,102,103 is hard
When part, can be with data to be uploaded to the various electronic equipments of remote server function, including but not limited to smart phone,
Tablet computer, pocket computer on knee and desktop computer etc..It, can be with when terminal device 101,102,103 is software
It is mounted in above-mentioned cited electronic equipment.Multiple softwares or software module may be implemented into (such as providing distribution in it
Formula service), single software or software module also may be implemented into.It is not specifically limited herein.
Server 105 can be to provide the server of various services, such as to the original that terminal device 101,102,103 uploads
Beginning data carry out analysis and generate compression advisory information, and carry out data fragmentation to initial data and obtain the background service of fragment data
Device.Compression advisory information and fragment data can be sent to memory node 106,107,108 and carried out further by background server
Processing.
It should be noted that server 105 can be hardware, it is also possible to software.It, can when server 105 is hardware
To be implemented as the distributed server cluster that multiple servers form, individual server also may be implemented into.When server 105 is
When software, multiple softwares or software module (such as providing Distributed Services) may be implemented into, also may be implemented into single
Software or software module.It is not specifically limited herein.
Memory node 106,107,108 can refer to data storage server for storing data, data storage service
Device such as can be compressed to received fragment data, encode, store at the processing.Under application scenes, server 105 and deposit
Storage node 106,107,108 can refer to identical server.
It should be understood that the number of terminal device, network, server and memory node in Fig. 1 is only schematical.Root
It factually now needs, can have any number of terminal device, network, server and memory node.
It should be noted that method provided by the embodiment of the present disclosure for storing data generally by memory node 106,
107, it 108 executes, correspondingly, device for storing data is generally positioned in memory node 106,107,108.
With continued reference to Fig. 2, the process of one embodiment of the method for storing data according to the disclosure is shown
200.The method for storing data, comprising the following steps:
Step 201, fragment data and compression advisory information are received.
In the present embodiment, method for storing data executing subject (such as memory node shown in FIG. 1 106,
107,108) fragment data and compression advisory information can by various modes be obtained.As an example, executing subject can pass through
Wired connection mode or radio connection receive fragment data and pressure from server (such as server 105 shown in FIG. 1)
Contracting advisory information.Herein, fragment data may include mark, which can be used for the unique identification fragment data.
Here, fragment data can refer to that initial data can refer to what is obtained after initial data progress data fragmentation
The data to be stored that user sends.Compression advisory information may include not compressing instruction information or compression tutorial message.It does not press
Contracting instruction information, which can serve to indicate that, not to be compressed above-mentioned fragment data.Compression tutorial message may include compression algorithm letter
Breath and targeted compression length, wherein compression algorithm information may include the title of compression algorithm, and targeted compression length can be used for
Indicate the compressed expected data length of above-mentioned fragment data.
In some optional implementations of the present embodiment, fragment data and compression advisory information in step 201 can
To be to send fragment data and compress the executing subject (such as server 105 shown in FIG. 1) of advisory information in the following manner
Determining:
First, it is determined that whether acquired initial data is compressed, compression advisory information is generated based on judging result.
In this implementation, end can receive first for sending fragment data and compressing the executing subject of advisory information
The initial data that end equipment (such as terminal device shown in FIG. 1 101,102,103) is sent.Herein, initial data can be
Refer to data to be stored.Later, it can be determined that whether acquired initial data is compressed.As an example, can root
According to the content type (Content-Type) of initial data, file name suffix, length, the information such as whether encrypts and judge whether to need
Original document is compressed.For example, if initial data meets one of the following conditions, it can determine and not need to original
Beginning data are compressed:
1) content type is predefined type.For example, content type is application/*, image/*, video/* etc..
Herein, when content type can refer to that terminal device uploads initial data by HTTP request, HTTP Header (HTTP)
In Content-Type.
2) file name suffix is default suffix.For example, file name suffix is .mp4 .mp3 .jpeg .png .tar etc..
3) data length is less than preset threshold.For example, the length of initial data does not have to compression when being less than 100K.
4) initial data is encryption data.
If it is determined that initial data does not need to be compressed, then the compression advisory information generated is not compress instruction information.
If it is determined that initial data is compressed, then further determine that using which kind of compression algorithm to initial data into
Row compression.In practice, the corresponding relationship of content type, data length etc. with compression algorithm can be preset.In this way, can root
It is determined according to information such as the content type of initial data, data lengths and uses that compression algorithm, and generated according to the compression algorithm
Compression algorithm information, and targeted compression length is generated according to the data length of the compression algorithm and initial data.As an example,
Targeted compression length can be generated according to the compression performance of compression algorithm and the data length of initial data.
Then, initial data is subjected to data fragmentation, obtains at least one fragment data.
In this implementation, the executing subject for sending fragment data and compression advisory information can also be to above-mentioned original
Beginning data carry out data fragmentation, to obtain at least one fragment data.As an example, can will be original according to fixed size
Data are divided at least one fragment data.
Step 202, in response to determining that compression advisory information includes compression tutorial message, storing step is executed.
In the present embodiment, whether it includes compression tutorial message that executing subject if may determine that in compression advisory information, such as
It includes compression tutorial message that fruit, which compresses in advisory information, then executing subject can execute storing step.Wherein, above-mentioned storing step
It may comprise steps of 2021~2023.
Step 2021, it is determined whether fragment data is compressed.
In the present embodiment, executing subject can determine whether to compress fragment data by various modes.As
Example needs to occupy CPU (Central Processing Unit, central processing unit), memory etc. and is due to executing squeeze operation
System resource, therefore, executing subject can determine whether to carry out fragment data according to the resource status of own system current time
Compression.For example, can determine if current time CPU usage is larger (for example, being more than preset threshold) not to fragment data
It is compressed;If current time CPU usage is smaller (for example, being less than preset threshold), can determine to fragment data
It is compressed.
In some optional implementations of the present embodiment, step 2021 specific as follows can be carried out:
Firstly, when prediction carries out compressing used using the corresponding compression algorithm of compression algorithm information to fragment data
Between.
In this implementation, executing subject can be predicted to use above-mentioned compression algorithm according to the size of above-mentioned fragment data
The corresponding compression algorithm of information carries out above-mentioned fragment data to compress the used time.As an example, executing subject can
It is time-consuming with the pre- measured compressed of history packed record according to performed mistake.As another example, it can be deposited in advance in executing subject
The mapping table an of size of data and compression algorithm to be compressed and compression time-consuming is contained, and is predicted according to the mapping table
Compression is time-consuming.
Then, in response to determining that the time is greater than or equal to preset threshold, determination is not compressed fragment data.
In this implementation, if executing subject is determined using the corresponding compression algorithm of above-mentioned compression algorithm information to upper
State fragment data compressed used in the time be more than or equal to preset threshold value, then executing subject determine not to upper
Fragment data is stated to be compressed.Here, above-mentioned threshold value can be set according to actual needs.
Finally, in response to determine the time be less than preset threshold, according to running state information determine whether to fragment data into
Row compression.
In this implementation, if executing subject is determined using the corresponding compression algorithm of above-mentioned compression algorithm information to upper
State fragment data compressed used in the time be less than above-mentioned preset threshold, then executing subject can be according to running state information
Determine whether to compress above-mentioned fragment data.Herein, running state information can refer to the operating state of executing subject
Information, including but not limited to: CPU usage, memory consumption etc..For example, when the CPU usage of executing subject is more than setting
When threshold value, it can determine and above-mentioned fragment data not compressed;When the CPU usage of executing subject is less than the threshold value of setting
When, it can determine and above-mentioned fragment data is compressed.By this implementation, time-consuming, operating status can be believed according to compression
The parameters such as breath determine whether to compress fragment data, so that compression time-consuming is pre- when guaranteeing to compress fragment data
In fixed range, and the normal operation that will not influence CPU etc..
Step 2022, fragment data is compressed in response to determination, uses the corresponding compression algorithm of compression algorithm information
Fragment data is compressed, the compressed data of fragment data is obtained.
In the present embodiment, if executing subject compresses fragment data by step 2021 determination, master is executed
The corresponding compression algorithm of compression algorithm information that body can be used in compression tutorial message compresses fragment data, is divided
The compressed data of sheet data.
Step 2023, it in response to determining that the length of compressed data matches with targeted compression length, executes following first and deposits
Storage step: correcting and eleting codes are carried out to compressed data and encode to obtain first coding data, and first coding data, compression algorithm are believed
The mark associated storage of breath and fragment data.
In the present embodiment, executing subject may further determine that the compressed data of fragment data obtained in step 2022
Length whether match with targeted compression length, if the length of the compressed data of fragment data and targeted compression length phase
With (for example, equal or difference is less than predetermined threshold), then executing subject can execute the first storing step.First storing step
It may include: firstly, the compressed data of fragment data can be carried out correcting and eleting codes (Erasure Code, EC) volume by executing subject
Code, obtains first coding data.Later, executing subject can be by first coding data, compression algorithm information and fragment data
Identify associated storage.Herein, the mark of fragment data can be used for the above-mentioned fragment data of unique identification.
Here, correcting and eleting codes are a kind of data guard methods, are mainly compiled original data by correcting and eleting codes algorithm
Code obtains redundancy, and data and redundancy are stored together, fault-tolerant to achieve the purpose that.It should be noted that data into
The technology of row correcting and eleting codes coding is the well-known technique studied and applied extensively at present, therefore details are not described herein again.
In some optional implementations of the present embodiment, above-mentioned method for storing data can also include following
Step:
Step S1 receives data acquisition request.
In this implementation, above-mentioned executing subject can also receive other executing subjects (such as server shown in FIG. 1
105) data acquisition request sent.Wherein, above-mentioned data acquisition request may include target identification.
Step S2 determines target data according to target identification from the data stored.
In this implementation, executing subject can be by the target identification in above-mentioned data acquisition request and the number stored
According to mark matched, if target identification is identical as the mark of a certain data stored, using the data as
Target data.Wherein, target data may include coded data and mark.
Step S3, in response to determining that in target data further include compression algorithm information, to the coded data in target data
Be decoded, and using compression algorithm corresponding with the compression algorithm information in target data to decoded coded data into
Row decompression, the data that decompression obtains are sent.
In this implementation, if it is determined that further include compression algorithm information in target data, then executing subject first may be used
To be decoded to the coded data in target data.Later, executing subject can be used and the compression algorithm in target data
The corresponding compression algorithm of information decompresses decoded coded data.Finally, the data that decompression obtains are sent.Example
Such as, the electronic equipment for sending data acquisition request can be sent to.
Step S4, in response to determining that in target data do not include compression algorithm information, to the coded data in target data
It is decoded, and the data that decoding obtains is sent.
In this implementation, if it is determined that do not include compression algorithm information in target data, then executing subject first may be used
To be decoded to the coded data in target data.Later, the data that decoding obtains can be sent.For example, can be with
It is sent to the executing subject for sending data acquisition request.By this implementation, data that available executing subject is stored.
With continued reference to the signal that Fig. 3, Fig. 3 are according to the application scenarios of the method for storing data of the present embodiment
Figure.In the application scenarios of Fig. 3, after user uploads initial data to server 301, server 301 can be according to original number
According to obtaining at least one fragment data, and generate compression advisory information.Server 301 can be by compression advisory information and each fragment
Data distribution is to memory node 302,303,304.Memory node 302,303,304 receives fragment data and compression advisory information.
In response to determining that compression advisory information includes compression tutorial message, memory node 302,303,304 can execute following storage step
It is rapid: first, it is determined whether fragment data is compressed.Fragment data is compressed in response to determination, compression can be used
The corresponding compression algorithm of algorithm information compresses fragment data, obtains the compressed data of fragment data.Later, in response to true
The length and targeted compression length for determining compressed data match, and execute following first storing step: entangle deleting to compressed data
Code coding obtains first coding data, and by the mark associated storage of first coding data, compression algorithm information and fragment data.
It should be noted that the quantity of memory node is only schematical in Fig. 3, any amount can be set according to actual needs
Memory node.
The method provided by the above embodiment of the disclosure is referred to before carrying out correcting and eleting codes coding to fragment data based on compression
It leads information to compress fragment data, to save data space, reduces data carrying cost.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of method for storing data.The use
In the process 400 of the method for storing data, comprising the following steps:
Step 401, fragment data and compression advisory information are received.
In the present embodiment, compression advisory information may include not compressing instruction information or compression tutorial message, wherein pressure
Contracting tutorial message includes compression algorithm information and targeted compression length.Step 401 is similar with the step 201 of embodiment illustrated in fig. 2,
Details are not described herein again.
Step 402, in response to determining that compression advisory information includes compression tutorial message, storing step is executed.
In the present embodiment, whether it includes compression tutorial message that executing subject if may determine that in compression advisory information, such as
It includes compression tutorial message that fruit, which compresses in advisory information, then executing subject can execute preset storing step.Wherein, above-mentioned pre-
If storing step may comprise steps of 4021~4025.
Step 4021, it is determined whether fragment data is compressed.
In the present embodiment, step 4021 is similar with the step 2021 of embodiment illustrated in fig. 2, and details are not described herein again.
Step 4022, if compressed to fragment data, using the corresponding compression algorithm of compression algorithm information to point
Sheet data is compressed, and the compressed data of fragment data is obtained.Later, step 4023 is executed.If do not carried out to fragment data
Compression, thens follow the steps 4025.
Step 4023, whether the length and targeted compression length for determining compressed data match.
In the present embodiment, executing subject can determine the length of above-mentioned compressed data and targeted compression length whether phase
Match.If the length of compressed data matches (for example, equal or difference is less than predetermined threshold) with targeted compression length, hold
Row step 4024;If the length of compressed data and targeted compression length, which mismatch, (such as differs by more than or is equal to predetermined threshold
Value), then follow the steps 4025.
Step 4024, it executes following first storing step: correcting and eleting codes being carried out to compressed data and encode to obtain the first coded number
According to, and by the mark associated storage of first coding data, compression algorithm information and fragment data.
Step 4025, it executes following second storing step: correcting and eleting codes being carried out to fragment data and encode to obtain the second coded number
According to, and by the mark associated storage of the second coded data and fragment data.
In some optional implementations of the present embodiment, above-mentioned method for storing data can also include following
Step: in response to determining that compression advisory information includes not compressing instruction information, the second storing step is executed.
In this implementation, if executing subject determines that compression advisory information includes not compressing instruction information, execute
Main body can execute above-mentioned second storing step.It is stored after directly carrying out correcting and eleting codes coding to fragment data.
Figure 4, it is seen that the method for storing data compared with the corresponding embodiment of Fig. 2, in the present embodiment
Process 400 highlight determine to fragment data do not carry out compress or determine compressed data length and targeted compression length
In unmatched situation, the process of the second storing step is executed.The method of the present embodiment description can be unsatisfactory for compressing as a result,
In the case that condition or compression effectiveness are not up to target, stored after directly carrying out correcting and eleting codes coding to fragment data.From
And it avoids data compression under above situation and the efficient operation of memory node ensure that the resource occupation of memory node.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, present disclose provides one kind for storing number
According to device one embodiment, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer
For in various electronic equipments.
As shown in figure 5, the device 500 for storing data of the present embodiment includes: receiving unit 501 and execution unit
502.Wherein, receiving unit 501 is configured to receive fragment data and compression advisory information, wherein above-mentioned compression advisory information
Including not compressing instruction information or compression tutorial message, wherein above-mentioned compression tutorial message includes compression algorithm information and target
Reduction length;Execution unit 502 is configured in response to determine that above-mentioned compression advisory information includes compression tutorial message, executes pre-
If storing step, wherein whether above-mentioned execution unit 502 comprises determining that unit 5021, be configured to determine to above-mentioned fragment
Data are compressed;Compression unit 5022 is configured in response to determination and compresses to above-mentioned fragment data, uses above-mentioned pressure
The corresponding compression algorithm of compression algorithm information compresses above-mentioned fragment data, obtains the compressed data of above-mentioned fragment data;The
One storage unit 5023 is configured in response to determine that the length of above-mentioned compressed data matches with above-mentioned targeted compression length,
It executes following first storing step: correcting and eleting codes being carried out to above-mentioned compressed data and encode to obtain first coding data, and will be above-mentioned
The mark associated storage of first coding data, above-mentioned compression algorithm information and above-mentioned fragment data.
In the present embodiment, the specific place of the receiving unit 501 of device 500 for storing data and execution unit 502
Reason and its brought technical effect can refer to the related description of step 201 and step 202 in Fig. 2 corresponding embodiment respectively,
This is repeated no more.
In some optional implementations of the present embodiment, above-mentioned execution unit 502 further include: the second storage unit
(not shown) is configured in response to determination and does not carry out compressing or determining above-mentioned compressed data to above-mentioned fragment data
Length and above-mentioned targeted compression length mismatch, and execute following second storing step: carrying out correcting and eleting codes volume to above-mentioned fragment data
Code obtains the second coded data, and by the mark associated storage of above-mentioned second coded data and above-mentioned fragment data.
In some optional implementations of the present embodiment, above-mentioned apparatus 500 further include: third storage unit is (in figure
It is not shown), it is configured in response to determine that above-mentioned compression advisory information includes not compressing instruction information, executes above-mentioned second storage
Step.
In some optional implementations of the present embodiment, above-mentioned determination unit is further configured to: prediction uses
The corresponding compression algorithm of above-mentioned compression algorithm information carries out above-mentioned fragment data to compress the used time;In response in determination
The time is stated more than or equal to preset threshold, determination is not compressed above-mentioned fragment data;It is less than in response to the determination above-mentioned time
Above-mentioned preset threshold determines whether to compress above-mentioned fragment data according to running state information.
In some optional implementations of the present embodiment, above-mentioned fragment data and above-mentioned compression advisory information are to pass through
What following manner determined: judging whether acquired initial data is compressed, compression advisory information is generated based on judging result;
Above-mentioned initial data is subjected to data fragmentation, obtains at least one fragment data.
In some optional implementations of the present embodiment, above-mentioned apparatus 500 further include: request reception unit is (in figure
It is not shown), it is configured to receive data acquisition request, wherein above-mentioned data acquisition request includes target identification;Data determine single
First (not shown) is configured to determine target data from the data stored according to above-mentioned target identification, wherein target
Data include coded data and mark;First transmission unit (not shown) is configured in response to determine above-mentioned number of targets
Further include compression algorithm information in, the coded data in above-mentioned target data is decoded, and use and above-mentioned target
The corresponding compression algorithm of compression algorithm information in data decompresses decoded coded data, the data that decompression is obtained
It is sent;Second transmission unit (not shown) is configured in response to determine in above-mentioned target data not to include compression
Algorithm information is decoded the coded data in above-mentioned target data, and the data that decoding obtains are sent.
Below with reference to Fig. 6, it illustrates the electronic equipment that is suitable for being used to realize embodiment of the disclosure, (example is as shown in figure 1
Server) 600 structural schematic diagram.Server shown in Fig. 6 is only an example, should not be to the function of embodiment of the disclosure
Any restrictions can be brought with use scope.
As shown in fig. 6, electronic equipment 600 may include processing unit (such as central processing unit, graphics processor etc.)
601, random access can be loaded into according to the program being stored in read-only memory (ROM) 602 or from storage device 608
Program in memory (RAM) 603 and execute various movements appropriate and processing.In RAM 603, it is also stored with electronic equipment
Various programs and data needed for 600 operations.Processing unit 601, ROM 602 and RAM603 are connected with each other by bus 604.
Input/output (I/O) interface 605 is also connected to bus 604.
In general, following device can connect to I/O interface 605: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph
As the input unit 606 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration
The output device 607 of dynamic device etc.;Storage device 608 including such as tape, hard disk etc.;And communication device 609.Communication device
609, which can permit electronic equipment 600, is wirelessly or non-wirelessly communicated with other equipment to exchange data.Although Fig. 6 shows tool
There is the electronic equipment 600 of various devices, it should be understood that being not required for implementing or having all devices shown.It can be with
Alternatively implement or have more or fewer devices.Each box shown in Fig. 6 can represent a device, can also root
According to needing to represent multiple devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communication device 609, or from storage device 608
It is mounted, or is mounted from ROM 602.When the computer program is executed by processing unit 601, the implementation of the disclosure is executed
The above-mentioned function of being limited in the method for example.It should be noted that computer-readable medium described in embodiment of the disclosure can be with
It is computer-readable signal media or computer readable storage medium either the two any combination.It is computer-readable
Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or
Device, or any above combination.The more specific example of computer readable storage medium can include but is not limited to: have
The electrical connection of one or more conducting wires, portable computer diskette, hard disk, random access storage device (RAM), read-only memory
(ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-
ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In embodiment of the disclosure, computer
Readable storage medium storing program for executing can be any tangible medium for including or store program, which can be commanded execution system, device
Either device use or in connection.And in embodiment of the disclosure, computer-readable signal media may include
In a base band or as the data-signal that carrier wave a part is propagated, wherein carrying computer-readable program code.It is this
The data-signal of propagation can take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any appropriate
Combination.Computer-readable signal media can also be any computer-readable medium other than computer readable storage medium, should
Computer-readable signal media can send, propagate or transmit for by instruction execution system, device or device use or
Person's program in connection.The program code for including on computer-readable medium can transmit with any suitable medium,
Including but not limited to: electric wire, optical cable, RF (radio frequency) etc. or above-mentioned any appropriate combination.
Above-mentioned computer-readable medium can be included in above-mentioned electronic equipment;It is also possible to individualism, and not
It is fitted into the electronic equipment.Above-mentioned computer-readable medium carries one or more program, when said one or more
When a program is executed by the electronic equipment, so that the electronic equipment: receiving fragment data and compression advisory information, wherein above-mentioned
Compression advisory information includes not compressing instruction information or compression tutorial message, wherein above-mentioned compression tutorial message includes that compression is calculated
Method information and targeted compression length;Include compression tutorial message in response to the above-mentioned compression advisory information of determination, executes following storage
Step: determine whether to compress above-mentioned fragment data;Above-mentioned fragment data is compressed in response to determination, use is above-mentioned
The corresponding compression algorithm of compression algorithm information compresses above-mentioned fragment data, obtains the compressed data of above-mentioned fragment data;
Match in response to the length and above-mentioned targeted compression length of the above-mentioned compressed data of determination, executes following first storing step: right
Above-mentioned compressed data carries out correcting and eleting codes and encodes to obtain first coding data, and above-mentioned first coding data, above-mentioned compression are calculated
The mark associated storage of method information and above-mentioned fragment data.
The behaviour for executing embodiment of the disclosure can be write with one or more programming languages or combinations thereof
The computer program code of work, described program design language include object oriented program language-such as Java,
Smalltalk, C++ further include conventional procedural programming language-such as " C " language or similar program design language
Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence
Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or
It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet
It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit
It is connected with ISP by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the disclosure, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in embodiment of the disclosure can be realized by way of software, can also be passed through
The mode of hardware is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor
Including receiving unit and execution unit.Wherein, the title of these units is not constituted to the unit itself under certain conditions
It limits, for example, receiving unit is also described as " receive fragment data and compress the unit of advisory information ".
Above description is only the preferred embodiment of the disclosure and the explanation to institute's application technology principle.Those skilled in the art
Member it should be appreciated that embodiment of the disclosure involved in invention scope, however it is not limited to the specific combination of above-mentioned technical characteristic and
At technical solution, while should also cover do not depart from foregoing invention design in the case where, by above-mentioned technical characteristic or its be equal
Feature carries out any combination and other technical solutions for being formed.Such as disclosed in features described above and embodiment of the disclosure (but
It is not limited to) technical characteristic with similar functions is replaced mutually and the technical solution that is formed.