Embodiment
It should be noted that, in the situation that do not conflict, embodiment and the feature in embodiment in the application can combine mutually.Describe below with reference to the accompanying drawings and in conjunction with the embodiments the present invention in detail.
In order to make those skilled in the art better understand the present invention program, below in conjunction with the accompanying drawing in the embodiment of the present invention, to being clearly and completely described in the embodiment of the present invention, obviously, described embodiment is only the embodiment of a part of the present invention, rather than whole embodiment.Embodiment based in the present invention, do not make under the creative work prerequisite the every other embodiment obtained those of ordinary skills, all should belong to protection scope of the present invention.
It should be noted that, the term " first " in instructions of the present invention and claims and above-mentioned accompanying drawing, " second " etc. are for distinguishing similar object, and needn't be for describing specific order or precedence.The data that should be appreciated that such use suitably can exchanged in situation, so as embodiments of the invention described herein can with except diagram here or describe those order enforcement.In addition, term " comprises " and " having " and their any distortion, is intended to be to cover not exclusive comprising.
According to embodiments of the invention, a kind of file storage device is provided, this document memory storage is greater than in a sub spaces of file for a plurality of subspaces that automatically file are stored to disk.
Fig. 1 is the file storage device according to first embodiment of the invention.
As shown in Figure 1, this document memory storage comprises: acquiring unit 10, detecting unit 20, contrast unit 30 and storage unit 40.
Acquiring unit 10 is for the file of the spatial cache that obtains disk, and acquiring unit 10 can obtain one or more file in the spatial cache of disk at every turn.Wherein, disk can be a disk of any hard disk, and each disk comprises spatial cache and storage space.Spatial cache is to have a fixedly logic magnetic disc space of access path.Storage space is the unlimited Virtual Space of store data, this storage space comprises one or more subspace, every sub spaces can have the fixedly physical space of access path for one, like this, in storage during this document, can by one fixedly access path find the sub spaces of storage this document.
It should be noted that, in embodiments of the present invention, above-mentioned file can be for copied files or database file or from the backup file of the Internet download.It should be noted that, in embodiments of the present invention, above-mentioned disk can comprise the disk arbitrarily such as fixed disk, mechanical disk and hybrid magnetic disc.
Detecting unit 20 is for detection of the size of file, and wherein, detecting unit 20 can detect the size of file itself at any time, also can detect at any time the size of the variant of file.Detecting unit 20 can detect the size of the byte number of file with file by employing.In embodiments of the present invention, detect the size of files by detecting unit 20, can predict this document needs great storage space, like this, can find free space to be greater than the subspace of storage space of file with storage this document.
Contrast unit 30 is for carrying out the size contrast by file and a plurality of subspace.The size of the file that contrast unit 30 can detect the size of the free space of any one subspace and detecting unit 20 is contrasted, when the free space of subspace is greater than file big or small, by this subspace of access in the fixedly access path of this subspace, and store this document in this subspace, when the free space of subspace is not more than file big or small, the size that continues file that the size of the free space of next subspace and detecting unit 20 are detected is contrasted, until find free space to be greater than the subspace of this document size.Like this, the contrast effect by contrast unit 30, can filter out free space and be greater than the subspace of file size with storage file.
Storage unit 40 is greater than in a sub spaces of file for file being stored to a plurality of subspaces free space.
Like this, pass through the embodiment of the present invention, adopt detecting unit 20 and contrast unit 30, can obtain free space according to the size of the size of the free space of a plurality of subspaces and file or variant file corresponding to file and be greater than the subspace of file or variant file size with storage this document or this variant file, detecting unit 20 and contrast unit 30 have been avoided so not adopting and the direct problem of the free space deficiency of this subspace when a sub spaces storage file, and then reached the effect of the subspace in automatic document storing is greater than file or variant file size disk to free space.
Fig. 2 is the file storage device according to second embodiment of the invention.
As shown in Figure 2, this embodiment can be used as preferred implementation embodiment illustrated in fig. 1, the file storage device of this embodiment, except the acquiring unit 10, detecting unit 20, contrast unit 30 and the storage unit 40 that comprise the first embodiment, also comprises the first judging unit 50.
Identical with in the first embodiment of the effect of acquiring unit 10 and storage unit 40, do not repeat them here.
In embodiments of the present invention, detecting unit 20 is for detecting the size of the file of spatial cache at interval of Preset Time, wherein, Preset Time can be time span arbitrarily, for example, Preset Time can be 1 hour, and now, detecting unit 20 is for the size at interval of detecting the file of spatial cache in 1 hour.
After the size of the first judging unit 50 for the file detect spatial cache at interval of Preset Time, judge whether the size of file is greater than preset value.Wherein, preset value can be set according to the size of spatial cache or the size of storage space or the size (that is, the size of disk) of spatial cache and storage space, and for example, preset value can be 20% of spatial cache size.
In embodiments of the present invention, when contrast unit 30 is greater than preset value for the size at file, the free space of file and a plurality of subspaces is carried out to the size contrast, when the size of file is not more than preset value, first this document is not done to any processing.
Like this, in embodiments of the present invention, judgement effect by the first judging unit 50, can the file of spatial cache tentatively be filtered, and the file that file size is greater than certain value is carried out to priority processing, that is the file that, file size is greater than to certain value is preferentially contrasted and is stored by storage unit 40 by contrast unit 30.
Fig. 3 is the file storage device according to third embodiment of the invention.
As shown in Figure 3, this embodiment can be used as preferred implementation embodiment illustrated in fig. 2, the file storage device of this embodiment, except the acquiring unit 10 that comprises the second embodiment, detecting unit 20, contrast unit 30, storage unit 40 and the first judging unit 50, also comprises the second judging unit 60.
Identical with in the second embodiment of the effect of acquiring unit 10, detecting unit 20, storage unit 40 and the first judging unit 50, do not repeat them here.
After whether the second judging unit 60 is greater than preset value for the size judging file, when judging file and be not more than preset value, judge whether the creation-time of file surpasses the Preset Time value.Wherein, the Preset Time value is the time value arranged arbitrarily, and for example, the Preset Time value can be 2 hours.The second judging unit 60 can be judged in conjunction with the current time when whether the creation-time that judges file surpasses the Preset Time value.
In embodiments of the present invention, when contrast unit 30 surpasses the Preset Time value for the creation-time at file, the free space of file and a plurality of subspaces is carried out to the size contrast.
Like this, in embodiments of the present invention, excessively overstock at spatial cache and causing the crowded of spatial cache by the file that adopts the second judging unit 60 can prevent that file size is not more than preset value, and then can alleviate the pressure of spatial cache.In addition, can not be contrasted on time and be stored in the subspace of corresponding storage space by the file that adopts the second judging unit 60 also can prevent that file size is not more than preset value, and then reached the effect that is contrasted in time and store this document.
Fig. 4 is the file storage device according to fourth embodiment of the invention.
As shown in Figure 4, this embodiment can be used as preferred implementation embodiment illustrated in fig. 3, the file storage device of this embodiment, except the acquiring unit 10, detecting unit 20, contrast unit 30, storage unit 40, the first judging unit 50 and the second judging unit 60 that comprise the 3rd embodiment, also comprises the 3rd judging unit 70 and compression unit 80.
Identical with in the 3rd embodiment of the effect of acquiring unit 10, detecting unit 20, storage unit 40 and the first judging unit 50, do not repeat them here.
When the 3rd judging unit 70 surpasses the Preset Time value for the creation-time at file, judge whether the form of file meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Preferably, in embodiments of the present invention, after the 3rd judging unit 70 can also be greater than preset value for the size judging file, whether the form that the size that judges file is greater than the file of preset value meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Compression unit 80 meets predetermined compressed format for the form at file, that is, while meeting the text file format such as .log/.txt, file is compressed.The compression that meets the file process compression unit 80 of default compressed format can obtain taking the variant file that storage space diminishes.Preferably, in embodiments of the present invention, compression unit 80 can be encrypted compression to file.
In embodiments of the present invention, contrast unit 30 is for the size of the free space that contrasts a plurality of subspaces with take the size of the variant file (that is, compressed file) of the file that storage space is less.
Like this, in embodiments of the present invention, by adopting the 3rd judging unit 70 and compression unit 80, can automatically obtain taking the compressed file that storage space is less, and then reach the effect of saving storage space.
Fig. 5 is the file storage device according to fifth embodiment of the invention.
As shown in Figure 5, this embodiment can be used as preferred implementation embodiment illustrated in fig. 1, the file storage device of this embodiment comprises acquiring unit 10, detecting unit 20, contrast unit 30 and the storage unit 40 of the first embodiment, wherein, in embodiments of the present invention, contrast unit 30 comprises order module 301 and contrast module 302.
Identical with in the first embodiment of the effect of acquiring unit 10 and detecting unit 20, do not repeat them here.
Order module 301 is for being sorted according to the free space size to a plurality of subspaces, and order module 301 is also for being numbered a plurality of subspaces according to sequence, the mode of this numbering is various, and for example, numbering can be arabic numeral numbering or alpha code etc.In embodiments of the present invention, order module 301 can be for to a plurality of subspaces, according to free space, order is from small to large sorted, also can be for to a plurality of subspaces, according to free space, order is from big to small sorted.Like this, by adopting sequencing unit 301, the order of a plurality of subspaces that contrast module 302 can sequence in advance according to sequencing unit 301 compares the size of the free space of the size of file and a plurality of subspaces successively, realize the problem of orderly comparison, and then reached the effect that improves relative efficiency.
In embodiments of the present invention, contrast module 302 starts for the subspace by file and a plurality of subspaces free space minimum, according to the sequence in advance of order module 301 and the free space of each sub spaces in a plurality of subspace, contrasted one by one, until find the subspace that free space is greater than file size.For example, suppose free space minimum in a plurality of subspaces subspace be numbered 1, the subspace that free space time is minimum be numbered 2, and subspace is numbered according to ascending its of its free space the increasing sequence that tolerance is 1, contrast module 302 can be for starting the size of free space file size and a plurality of subspace is compared from the minimum subspace of numbering, a plurality of subspace, until find free space to be greater than the subspace of file size.
In embodiments of the present invention, storage unit 40 is for being stored to file the subspace found.
Like this, in embodiments of the present invention, by adopting order module 301 and contrast module 302, realized the problem of orderly comparison, and then reached the effect that improves relative efficiency.
It should be noted that, in the of the present invention first to the 5th embodiment, this document memory storage can also comprise updating block.This updating block for upgrading the interval of the date created of whole storage files after storage unit 40 has been stored file.Particularly, in the time of within the interval of date created at date created of this stored file, do not upgrade the interval of this date created; In the time of outside the interval of date created at date created of this stored file, according to the interval of the date created of the interval updating file of the date created of this document and this date created.For example, the interval of supposing the date created of file is on October 1,1 day to 2013 January in 2000, and when the date created of stored file is on October 5th, 2013, the interval of upgrading above-mentioned date created is on October 5,1 day to 2013 January in 2000.
Like this, in the present invention, by adopting updating block, when locating file, can search in the interval of corresponding date created according to the date created of file, reach the effect that improves ff efficiency.
According to embodiments of the invention, a kind of file memory method is provided, this document storage means is greater than in a sub spaces of file for a plurality of subspaces free space that automatically file is stored to disk.This document storage means may operate on computer-processing equipment.It should be noted that, the file memory method that the embodiment of the present invention provides can be carried out by the file storage device of the embodiment of the present invention, and the file storage device of the embodiment of the present invention also can be for carrying out the file memory method of the embodiment of the present invention.
Fig. 6 is the file memory method according to first embodiment of the invention.
As shown in Figure 6, this document storage means comprises that following step S101 is to step S104:
Step S101, obtain the file in the spatial cache of disk.
Obtain one or more file in the spatial cache that file in the spatial cache of disk can obtain disk at every turn.Wherein, disk can be a disk of any hard disk, and each disk comprises spatial cache and storage space.Spatial cache is to have a fixedly logic magnetic disc space of access path.Storage space is the unlimited Virtual Space of store data, this storage space comprises one or more subspace, every sub spaces can have the fixedly physical space of access path for one, like this, in storage during this document, can by one fixedly access path find the sub spaces of storage this document.
It should be noted that, in embodiments of the present invention, above-mentioned file can be for copied files or database file or from the backup file of the Internet download.It should be noted that, in embodiments of the present invention, above-mentioned disk can comprise the disk arbitrarily such as fixed disk, mechanical disk and hybrid magnetic disc.
Step S102, the size of detection file.
The size that detects file can detect the size of file itself at any time, also can detect at any time the size of the variant file of file, for example, can detect at any time the size of compressed file.Detect the size of described file and can pass through to detect the size of the byte number of file with file.Like this, in embodiments of the present invention, by detecting the size of file, can predict this document needs great storage space, thereby can find free space to be greater than the subspace of storage space of file with storage this document.
Step S103, carry out the size contrast by the free space of file and a plurality of subspaces.
Big or small contrast is carried out in file and a plurality of subspace can be contrasted the size of the size of the free space of any one subspace and the file detected, when the free space of subspace is greater than file big or small, by this subspace of access in the fixedly access path of this subspace, and store this document in this subspace, when the free space of subspace is not more than file big or small, continue the size of the free space of next subspace and the size of the file detected are contrasted, until find free space to be greater than the subspace of this document size.Like this, by file and a plurality of subspace are carried out to the size contrast, can filter out free space and be greater than the subspace of file size with storage file.
Step S104, be stored to free space in a plurality of subspaces by file and be greater than in a sub spaces of file.
Like this, pass through the embodiment of the present invention, adopt step S102 and step S103, can obtain free space according to the size of the size of the free space of a plurality of subspaces and file or variant file corresponding to file and be greater than the subspace of file or variant file size with storage this document or this variant file, step S102 and step S103 have been avoided so not adopting and the direct problem of the free space deficiency of this subspace when a sub spaces storage file, and then reached the effect of the subspace in automatic document storing is greater than file or variant file size disk to free space.
In embodiments of the present invention, preferably, step S103 can comprise:
Sorted according to the free space size in a plurality of subspaces.
Sorted according to the free space size in a plurality of subspaces, and according to sequence, a plurality of subspaces are numbered, the mode of this numbering is various, and for example, numbering can be arabic numeral numbering or alpha code etc.In embodiments of the present invention, to a plurality of subspaces, according to free space, order is from small to large sorted, also can be for to a plurality of subspaces, according to free space, order is from big to small sorted.Like this, the order by a plurality of subspaces of sequencing in advance compares the size of the free space of the size of file and a plurality of subspaces successively, has realized the problem of orderly comparison, and then has reached the effect that improves relative efficiency.
Free space according to each sub spaces in sequence and a plurality of subspaces is contrasted one by one.
In embodiments of the present invention, the subspace of free space minimum in file and a plurality of subspace is started, free space according to each sub spaces in pre-sorting and a plurality of subspace is contrasted one by one, until find the subspace that free space is greater than file size.For example, suppose free space minimum in a plurality of subspaces subspace be numbered 1, the subspace that free space time is minimum be numbered 2, and subspace is numbered according to ascending its of its free space the increasing sequence that tolerance is 1, contrast module 302 can be for starting the size of free space file size and a plurality of subspace is compared from the minimum subspace of numbering, a plurality of subspace, until find free space to be greater than the subspace of file size.
Further, in embodiments of the present invention, preferably, step S104 can be for being stored to file in the subspace found.
Like this, in embodiments of the present invention, by being sorted according to the free space size in a plurality of subspaces and being contrasted one by one according to sequence and the free space of each sub spaces in a plurality of subspaces, realized the problem of orderly comparison, and then reached the effect that improves relative efficiency.
Fig. 7 is the file memory method according to second embodiment of the invention.
As shown in Figure 7, this document storage means comprises that following step S201 is to step S205, and this embodiment can be used as preferred implementation embodiment illustrated in fig. 6.
Step S201, the step S101 with embodiment illustrated in fig. 6, do not repeat them here.
Step S202, at interval of the size of the file in Preset Time detection spatial cache.
In embodiments of the present invention, the size that detects file can be for detecting the size of the file in spatial cache at interval of Preset Time, wherein, Preset Time can be time span arbitrarily, for example, Preset Time can be 1 hour, and now, the size that detects file can be the size at interval of detecting the file in spatial cache in 1 hour.
Step S203, judge whether the size of file is greater than preset value.
In embodiments of the present invention, after the size of the file at interval of Preset Time, detecting spatial cache, whether the size that can judge file is greater than preset value, wherein, preset value can be according to the size of the size of the size of spatial cache or storage space or spatial cache and storage space (, the size of disk) set, for example, preset value can be 20% of spatial cache size.After the size of judging file is greater than preset value, execution step S204, otherwise execution step S201.
Step S204, carry out the size contrast by the free space of file and a plurality of subspaces.
In embodiments of the present invention, when the size of judging file is greater than preset value, the free space of file and a plurality of subspaces is carried out to the size contrast, when the size of file is not more than preset value, first this document is not done to any processing.
Step S205, with step S104 embodiment illustrated in fig. 6, do not repeat them here.
Like this, in embodiments of the present invention, by step S203, can the file of spatial cache tentatively be filtered, and the file that file size is greater than certain value is carried out to priority processing, that is, the file that file size is greater than to certain value, preferentially by step S204 and step S205, carries out respectively the free space of file and a plurality of subspaces is carried out to the size contrast and file is stored to free space in a plurality of subspaces being greater than in a sub spaces of file.
Fig. 8 is the file memory method according to third embodiment of the invention.
As shown in Figure 8, this document storage means comprises that following step S301 is to step S303, step S3041 and step S3042 and step S305, and this embodiment can be used as preferred implementation embodiment illustrated in fig. 7.
Step S301, to step S303, with step S201 embodiment illustrated in fig. 7 and step S203, does not repeat them here respectively.
Step S3041, judge whether the creation-time of file surpasses the Preset Time value.
After whether the size that judges file is greater than preset value, that is, when step S303 judges file and is not more than preset value, judge whether the creation-time of file surpasses the Preset Time value.Wherein, the Preset Time value is the time value arranged arbitrarily, and for example, the Preset Time value can be 2 hours.When whether the creation-time that judges file surpasses the Preset Time value, can be judged in conjunction with the current time.
Step S3042, carry out the size contrast by the free space of file and a plurality of subspaces.
In embodiments of the present invention, when the creation-time of judging file at step S3041 surpasses the Preset Time value, the free space of file and a plurality of subspaces is carried out to size and contrast.
Step S305, the step S205 with embodiment illustrated in fig. 7, do not repeat them here.
Like this, in embodiments of the present invention, can prevent by step S3041 that file that file size is not more than preset value from excessively overstocking at spatial cache and cause the crowded of spatial cache, and then can alleviate the pressure of spatial cache.In addition, also can prevent that by step S3041 the file that file size is not more than preset value from can not be contrasted on time and store in the subspace of corresponding storage space, and then reach the effect that is contrasted in time and store this document.
In embodiments of the present invention, preferably, the creation-time of judging file at step S3041 is over after the Preset Time value, and this document storage means can also comprise:
Whether the form that judges file meets predetermined compressed format.
When the creation-time of file surpasses the Preset Time value, judge whether the form of file meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the form that judges file meets whether the form that predetermined compressed format can judge file is the text file format such as .log/.txt.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Further preferably, in embodiments of the present invention, after the size of judging file is greater than preset value, whether the form that the size that also can judge file is greater than the file of preset value meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
File is compressed.
Form at file meets predetermined compressed format, that is, while meeting the text file format such as .log/.txt, file is compressed.The file that meets default compressed format can obtain taking through overcompression the variant file that storage space diminishes.Further preferably, in embodiments of the present invention, can be encrypted compression to file.
Preferably, in embodiments of the present invention, step S3042 can and take the size of the variant file (that is, compressed file) of the file that storage space is less for the size of the free space that contrasts a plurality of subspaces.
Like this, in embodiments of the present invention, by the form that judges file, whether meet predetermined compressed format and file is compressed, can automatically obtain taking the compressed file that storage space is less, and then reaching the effect of saving storage space.
It should be noted that, in the step shown in the process flow diagram of accompanying drawing, can in the computer system such as one group of computer executable instructions, carry out, and, although there is shown logical order in flow process, but in some cases, can carry out step shown or that describe with the order be different from herein.
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with general calculation element, they can concentrate on single calculation element, perhaps be distributed on the network that a plurality of calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in memory storage and be carried out by calculation element, perhaps they are made into respectively to each integrated circuit modules, perhaps a plurality of modules in them or step being made into to the single integrated circuit module realizes.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.