Abstract:
A method to efficiently detect, store, modify, and recreate fully or partially duplicate file forks is described. During archive creation or modification, sets of fully or partially duplicate forks are detected and a reduced number of transformed forks or fork segments are stored. During archive expansion, one or more forks are recreated from each full or partial copy.

Description:
CROSS REFERENCES TO RELATED APPLICATIONS 
       [0001]    Not applicable. 
       STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT 
       [0002]    Not applicable. 
       THE NAMES OR PARTIES TO A JOINT RESEARCH AGREEMENT 
       [0003]    Not applicable. 
       INCORPORATION-BY-REFERENCE OF MATERIAL SUBMITTED ON A COMPACT DISC 
       [0004]    Not applicable. 
       BACKGROUND OF THE INVENTION 
       [0005]    1. Field of the Invention 
         [0006]    The present invention relates generally to data compression and archiving. More particularly the present invention relates to a system and method for efficiently detecting and storing multiple files that contain similar or identical data. Still more particularly, the present invention is a method for detecting and storing full or partial duplicate file forks in an archiving system. 
         [0007]    2. Discussion of Related Art Including Information Disclosed Under 37 CFR §§1.97, 1.98 
         [0008]    Archiving software utilities such as STUFFIT®, PKZIP®, RAR® and similar products provide users with the ability to combine or package multiple files into a single archive for distribution, as well as by compressing and encrypting the files, so that bandwidth costs and storage requirements are minimized when sending the resulting archive across a communication channel or when storing it in a storage medium. [STUFFIT is a registered trademark of Smith Micro Software, Inc., of Aliso Viejo, Calif.; PKZIP is a registered trademark of PKWare, Inc., of Milwaukee, Wis.; and RAR is a registered trademark of Eugene Roshal, an individual from Chelyabinsk, Russian Federation.] 
         [0009]    Quite often the files added to an archive are exact duplicates of one another, or very nearly so. Current archiving software, such as the archiving software utilities mentioned above, compress each data file as a whole, without detecting duplicate or partially duplicate files or file forks. It would be advantageous, therefore, to provide a method for detecting when a subset of files being added to an archive are identical files, or nearly identical. Then, instead of compressing and storing additional copies of the file data, the method could provide means for storing references to compressed data already present in the first archived copy of the file. Moreover, it is desirable that the detection and coding of the identical files be as time efficient as possible. 
         [0010]    Current products use the concept of a “solid archive” or “block mode” to partially solve this problem. In this mode, input files are sorted by file attributes so that potentially identical files are ordered close to each other, and the resulting files are concatenated and compressed as a single large block. In some instances, compressors take advantage of the presence of nearby identical data, but this approach is highly dependent on the window size or the amount of history available to the compression program. Multiple large identical files will not be able to reference the data in the matching files processed previously, if the beginning of the second file is too remote from the beginning of the first file. Additionally, even if the identical files are within the given window size and the history of the first file can be used in compressing the next file that matches, this method does nothing to eliminate processing—the second file or fork data must still be compressed. 
       BRIEF SUMMARY OF THE INVENTION 
       [0011]    Accordingly, the present invention provides a system and method that efficiently detects identical or nearly identical files or forks, and rather than compress the second and subsequent occurrences of the duplicate data, the inventive method simply stores references to the first compressed copy. This process effectively compresses multiple copies of data by nearly 100% (only a small amount of reference information is stored), without repeated compression of the matching data. 
         [0012]    Further, unlike the block or “solid” mode currently used by state of the art archiving products, the method of the present invention is not in any way dependent on the size of the files, the size of the file forks, the compression history, or the window size. 
         [0013]    It must also be emphasized that while decompressing/extracting archived files, the present inventive method of storing references to the original data allows the extraction process to process only the first occurrence of the duplicated data. As matching files are encountered, this method simply copies the already decompressed first occurrences data to the appropriate forks in matching files. 
         [0014]    Other novel features which are characteristic of the invention, as to organization and method of operation, together with further objects and advantages thereof will be better understood from the following description considered in connection with the accompanying drawings, in which preferred embodiments of the invention are illustrated by way of example. It is to be expressly understood, however, that the drawings are for illustration and description only and are not intended as a definition of the limits of the invention. The various features of novelty that characterize the invention are pointed out with particularity in the claims annexed to and forming part of this disclosure. The invention does not reside in any one of these features taken alone, but rather in the particular combination of all of its structures for the functions specified. 
         [0015]    The foregoing summary broadly sets out the more important features of the present invention so that the detailed description that follows may be better understood, and so that the present contributions to the art may be better appreciated. There are additional features of the invention that will be described in the detailed description of the preferred embodiments of the invention which will form the subject matter of the claims appended hereto. 
         [0016]    Accordingly, before explaining the preferred embodiment of the disclosure in detail, it is to be understood that the disclosure is not limited in its application to the details of the method steps set forth in the following description or illustrated in the drawings. The inventive method described herein is capable of other embodiments and of being practiced and carried out in various ways. 
         [0017]    As such, those skilled in the art will appreciate that the conception, upon which this disclosure is based may readily be used as a basis for designing other structures, methods, and systems for carrying out the several purposes of the present invention. It is important, therefore, that the claims are regarded as including such equivalent processes, procedures, and method steps, as far as they do not depart from the spirit and scope of the present invention. Rather, the fundamental aspects of the invention, along with the various features and functionality that characterize the invention, are pointed out with particularity in the claims annexed to and forming a part of this disclosure. 
     
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS 
         [0018]    The invention will be better understood and objects other than those set forth above will become apparent when consideration is given to the following detailed description thereof. Such description makes reference to the annexed drawings wherein: 
           [0019]      FIG. 1  is a schematic flow chart showing an overview of the duplicate detection process employed in the inventive method; 
           [0020]      FIG. 2  is a schematic block diagram showing detection of fully duplicate forks; 
           [0021]      FIG. 3  is a schematic block diagram showing detection of partially duplicate forks in a subset; 
           [0022]      FIG. 4A  is flow chart providing an overview of the fork and segment processing used by the inventive method for archiving storage in a direct comparison case; 
           [0023]      FIG. 4B  shows a hash-based detection method; 
           [0024]      FIG. 4C  shows an alternative method of the hash-based detection method; 
           [0025]      FIG. 5  is a flow diagram showing how the inventive method employs archive expansion with sequential archive consumption; 
           [0026]      FIG. 6  is a flow diagram showing archive expansion with sequential archive consumption and non-sequential fork creation; and 
           [0027]      FIG. 7  is a flow diagram showing archive expansion with sequential archive compution and sequential fork creation. 
       
    
    
     LEGEND: DRAWINGS REFERENCE NUMERALS FIGS.  1 - 7   
       [0028]      100  is the input (incoming fork set or sets) to the first preferred embodiment of the invention 
         [0029]      101  set formation criteria 
         [0030]      102  file attributes 
         [0031]      103  preference for full or partial duplicate detection 
         [0032]      130  direct comparison or hashing 
         [0033]      131  memory available 
         [0034]      132  desired certainty 
         [0035]      133  desired security 
         [0036]      140  sizing strategy 
         [0037]      141  archive creation goals 
         [0038]      142  location and rate of differences 
         [0039]      150  progressive comparison of segments 
         [0040]      160  output fork subsets with segment lists 
         [0041]      200  fork subset  1   
         [0042]      210  fork subset  1 . 1   
         [0043]      220  fork subsets 
         [0044]      230  final fork subsets 
         [0045]      300  partially duplicate forks 
         [0046]      310  segment boundary list 
         [0047]      320  segment lists 
         [0048]      400  forks and segments 
         [0049]      401  forward archive transform 
         [0050]      402  post transform forks and segments 
         [0051]      404  archive 
         [0052]      410  forks and segments 
         [0053]      411  primary designation 
         [0054]      412  primary fork 
         [0055]      413  forward archive transform 
         [0056]      414  other (than primary) forks 
         [0057]      415  compare to primary 
         [0058]      416  repeat detection 
         [0059]      420  forks and segments 
         [0060]      421  forward archive transforms 
         [0061]      422  post transform forks and segments 
         [0062]      423  buffer 
         [0063]      500  sequential archive 
         [0064]      510  forks 
         [0065]      520  segments 
         [0066]      530  inverse transform 
         [0067]      540  post transform forks 
         [0068]      550  post transform segments 
         [0069]      560  routing 
         [0070]      570  concatenation and routing 
         [0071]      590  output forks 
         [0072]      600  archive 
         [0073]      610  forks 
         [0074]      620  segments 
         [0075]      630  inverse transform or transforms 
         [0076]      640  post transform segments 
         [0077]      650  concatenation 
         [0078]      660  output forks 
         [0079]      700  archive 
         [0080]      710  forks and segments 
         [0081]      720  inverse archive transform 
         [0082]      730  post-transform forks and segments 
         [0083]      740  buffer 
         [0084]      750  routing 
         [0085]      760  concatenation 
         [0086]      770  output forks 
       DETAILED DESCRIPTION OF THE INVENTION 
       [0087]    The invention will be better understood and objects other than those set forth will become apparent when consideration is given to the following detailed description thereof. Such description makes reference to the annexed drawings. 
         [0088]    DEFINITIONS: As used herein, the following terms shall have the indicated definitions. 
         [0089]    Fork: any data (a linear series of bytes) of certain size, also possessing a type, and associated with a file system object. 
         [0090]    File: a set of one or more typed forks, also possessing optional attributes (including but not limited to directory, name, extension, type, creator, creation time, modification time, and access time). 
         [0091]    Archive: a collection of files created for the purpose of storage or transmission, usually in compressed and/or otherwise transformed form; an archive consists of structural information and archive data. 
         [0092]    Structural information: parts of an archive that contain information about stored files and forks (attributes, pre- and post-archive transform sizes and fork hash values). 
         [0093]    Archive data: fork data in transformed form. 
         [0094]    Archive creation: the process of combining multiple forks, files, and their attributes into an archive. 
         [0095]    Archive expansion, full archive expansion: the process of recreating forks, files, and their attributes from an archive. 
         [0096]    Partial archive expansion: an archive reading process where the amount of data to be read is limited, commonly including only structural information. 
         [0097]    Fully duplicate forks: two or more forks of identical size and containing identical data. 
         [0098]    Partially duplicate forks: two or more forks containing identical data at the beginning. 
         [0099]    Apparently duplicate forks: forks that appear to be identical based on the result of a hashing transformation, yet containing some different data. 
         [0100]    Difference point: a point, located in the process of partial duplicate detection, where two forks begin to differ. 
         [0101]    Fork segment: a contiguous fork part between the beginning of the fork and the first difference point, or two intermediate difference points, or the last difference point and the end of the fork. 
         [0102]    Archive transform, forward archive transform: transformation of data stored in an archive by application of algorithms including, but not limited to, compression, encryption, cryptographic signing, filtering, format detection, format-specific recompression, hash calculation, error protection, and forward error correction. 
         [0103]    Inverse archive transform: transformation of data that is the inverse of the forward archive transform, by application of algorithms including but not limited to decompression, decryption, verification of cryptographic signatures, inverse filtering, format-specific decompression, hash verification, error detection, and error correction. 
         [0104]    Hash: a deterministic, lossy data transformation that produces a fixed-size digest, or hash, from an arbitrarily long fork. 
         [0105]    Cryptographically secure hash: a uniformly distributed hash transformation that is computationally difficult to reverse (i.e., find a fork with the given hash value). 
         [0106]    Hash collision: a condition where two different forks produce identical results after the hash transformation. 
         [0107]    Segment: part of a fork that is read and hashed in one operation. 
         [0108]    Sizing strategy: an algorithm that determines segment sizes during fork comparison. 
         [0109]    Description of Invention: When creating an archive from a set of forks, a straightforward way to detect full or partial duplicates is to compare all incoming forks. 
         [0110]    Referring first to  FIG. 1 , efficient detection of fully or partially duplicate forks is achieved as follows: The overall set of forks to be stored in an archive is assembled into one set or several sets  100 , divided  110  by a criterion or criteria  101  and fork attributes  102  including but not limited to attributes such as fork type or origin. The initial fork set or sets  100  are then sorted, and divided into subsets of forks  120  of equal size. If preference  103  is given to detecting approximate duplicates, lists are divided into subsets of forks  120  of nearly equal size. 
         [0111]    Forks in each subset  120  are subjected to comparison  150 , directly or by a hash algorithm. 
         [0112]    The choice of whether to compare data directly or by a hash algorithm  130  is based on the sizing strategy  140 , the amount of memory  131  available for the compare operation, the desired certainty of duplicate detection  132 , and the desired protection against intentional injection of apparently duplicate forks  133 . The use of a hashing algorithm permits operation on arbitrarily large segments. 
         [0113]    Referring next to  FIG. 2 , the comparison procedure is seen to be iterative, and direct comparison or hash computation proceeds on all forks of a subset in parallel. If the goal is to detect only fully duplicate forks, subsets  200  are further subdivided into subsets  210 ,  220  when differences in segment data  230  or accumulated hash values are detected. If the goal includes detecting partially duplicate forks  300  as well, a boundary list  310  and segment lists  320  are formed, one per each fork in a subset that includes one or more partially duplicate fork pair(s). Each segment list  320  contains or points to common copies of locations and sizes of fork segments that constitute the fork. This is shown in  FIG. 3 . 
         [0114]    Alternatively, differences between forks or fork segments are encoded by a differencing algorithm (also known as delta encoding) that produces a patch, or a compact description of differences between two forks or fork segments. 
         [0115]    Fork data is processed in segments of equal or variable (typically, increasing) size, determined by a sizing strategy  140 . The sizing strategy is based on (1) a priori knowledge of fork structure and attributes  102 , and/or (2) archive creation goals  141  (which include but are not limited to maximizing creation, modification, or expansion speed, minimizing archive size, or a combination of such goals). 
         [0116]    A sizing strategy with smaller, fixed, or slowly growing segment sizes is best suited for unknown fork data where expected locations of differences are unknown but need to be located in a relatively precise fashion. 
         [0117]    A different sizing strategy may be favored for reading fork data from hard drives where switching between forks during reading leads to a reduction in data throughput and an increase in operational acoustic level. A sizing strategy with fast growing segment sizes may be best suited as a compromise between reading/acoustic efficiency and precision of locating fork differences. 
         [0118]    Additionally, an adaptive sizing strategy may vary the rate of segment growth depending on the detection progress parameters including but not limited to the locations of differences and/or the rate at which differences are found  142 . 
         [0119]    If a hash algorithm is used for detecting differences, and fork data needs to be protected against intentional injection of apparently duplicate forks, then a cryptographically secure hashing algorithm is used. 
         [0120]    When the comparison is complete, the resulting subsets  160 ,  220  and segment lists  320  contain forks and fork segments with identical hash values. At this stage, fork segments within each subset are either certain (when direct comparison of forks was used) or nearly certain (when a hash algorithm was used) to be duplicates. Because the probability of hash collisions can be made arbitrarily small by using longer hash values, the latter may provide a sufficient degree of certainty that forks are indeed identical. 
         [0121]    Fork and segment data is processed by the forward archive transform for addition to the archive. 
         [0122]    Referring next to  FIG. 4A , if direct comparison of forks was used, one of the duplicate forks or segments in each subset  400  is processed by the forward archive transform  401  into post-transform data  402  for immediate or delayed addition to the archive  403 . 
         [0123]    As seen in  FIG. 4B , if a hash algorithm was used and perfectly certain and/or perfectly secure duplicate fork detection is desired, further steps  410 - 416  or  420 - 423  are required. 
         [0124]    One of the forks or segments  410  is given a designation  411  of the primary fork or segment  412  and is processed by the forward archive transform  413 , while other forks  414  from its subset are being read and compared to primary  415 , up to their respective ends or difference points. A sizing strategy identical or similar to the earlier sizing strategy  140  is utilized, with difference points added as additional segment boundaries. If differences are detected, transformed output is discarded, differing forks are separated into new subsets for a repeat duplicate detection  416 . 
         [0125]      FIG. 4C  shows that if enough temporary storage is available, in an alternative method of the hash-based detection method, all forks or segments  420  are processed by the forward archive transform  421  in parallel and post-transform data forks and segments  422  are buffered  423  until all forks or segments are fully transformed. Pre- 420  or post- 422  transform data is compared during this processing. If no differences are detected, a memory-saving strategy may discard multiple copies of matching post-transform data  423 . If differences are detected, more than one buffered post-transform output must be retained for immediate or delayed addition to the archive. If a memory-saving strategy was used, additional copies of the matching (up to the point of each difference) portions of post-transform data are retained. This can be done directly by keeping multiple copies, or indirectly by keeping unique segments of post-transform data and the order in which they appear in each indirectly retained post-transform data stream. 
         [0126]    Structural information that describes sets of unique and duplicate fork segments achieved in stage  3  or  4  of the creation process must be created or updated to reflect the final lists of fork segments. Structural information includes one or more if the following: overall pre-transform and post-transform fork sizes and locations of unique, transformed fork data in archive data. 
         [0127]    Structural information that describes subsets of fully duplicate forks  220  consists of identical size and location data for all forks in a subset. 
         [0128]    Structural information that describes subsets of partially duplicate forks  300  consists of sizes and/or locations  310  for fork segments corresponding to difference points, and lists of segments  320  that, when concatenated in listed order, reconstitute original forks. 
         [0129]    If redundancy is acceptable, structural information is stored separately for each fork. For redundancy reduction, lists are organized hierarchically and/or encoded with a statistical model and an entropy coder. 
         [0130]    If the possibility of sequential whole-archive expansion is a desired property of an archive, all fork structural information must precede fork data it describes. 
         [0131]    Method of handling duplicate forks during archive expansion: Structural information for individual forks must be located and interpreted during expansion. 
         [0132]    In  FIG. 5 , we see that if sequential archive  500  consumption is desired during expansion, pre-inverse transform data consisting of forks  510  and segments  520  is processed by inverse transform or transforms  530 . Post-inverse transform data in the form of fully  540  or partially  550  duplicate forks  540 ,  550  is routed  560  (split into multiple identical data streams) and/or concatenated  570  to form one or more forks consisting of one or more fork segments. This may be achieved by either writing post-inverse transform data in parallel to multiple files, or by writing to one file (corresponding to a full fork or a collection fork segment), and making copies of this file&#39;s contents after its corresponding full fork or fork segments have been fully reconstructed by the inverse transform(s). 
         [0133]    In  FIG. 6 , we see that if sequential fork  660  creation is desired and non-sequential archive  600  consumption is possible or permitted, duplicate forks  660  are reconstituted independently by processing pre-inverse transform data consisting of forks  610  and segments  620  by an inverse transform or transforms  630 . Segments  640  that form partially duplicate forks are concatenated  650  after the inverse transform application. 
         [0134]    Next, referring to  FIG. 7 , when only sequential archive  700  consumption is possible or permitted, and sequential fork  770  creation is desired, pre-inverse transform data  710  is processed by an inverse transform or transforms  720  and post-inverse transform data  730  is retained by a buffer  740  before being routed  750  and concatenated  760  into output forks  770 . 
         [0135]    Alternatively, if the differences between forks or fork segments were encoded by a differencing algorithm, a patch transformation (the inverse of the differencing transformation) is used to produce a new fork or fork segment. 
         [0136]    The above disclosure is sufficient to enable one of ordinary skill in the art to practice the invention, and provides the best mode of practicing the invention presently contemplated by the inventor. While there is provided herein a full and complete disclosure of the preferred embodiments of this invention, it is not desired to limit the invention to the exact construction, dimensional relationships, and operation shown and described. Various modifications, alternative constructions, changes and equivalents will readily occur to those skilled in the art and may be employed, as suitable, without departing from the true spirit and scope of the invention. Such changes might involve alternative materials, components, structural arrangements, sizes, shapes, forms, functions, operational features or the like. 
         [0137]    Therefore, the above description and illustrations should not be construed as limiting the scope of the invention, which is defined by the appended claims.