[Unison-hackers] [unison-svn] r458 - in trunk/src: . ubase

bcpierce@seas.upenn.edu bcpierce at seas.upenn.edu
Wed Jul 21 21:42:07 EDT 2010


Author: bcpierce
Date: 2010-07-21 21:42:07 -0400 (Wed, 21 Jul 2010)
New Revision: 458

Modified:
   trunk/src/RECENTNEWS
   trunk/src/fingerprint.ml
   trunk/src/fingerprint.mli
   trunk/src/fpcache.ml
   trunk/src/mkProjectInfo.ml
   trunk/src/os.ml
   trunk/src/os.mli
   trunk/src/ubase/util.mli
   trunk/src/update.ml
Log:
* Added support for "pseudo-fingerprints", as a first step to
  implementing super-fast initial scans, following recent discussion
  on the unison-hackers list


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/RECENTNEWS	2010-07-22 01:42:07 UTC (rev 458)
@@ -1,3 +1,10 @@
+CHANGES FROM VERSION 2.43.-29
+
+* Added support for "pseudo-fingerprints", as a first step to
+  implementing super-fast initial scans, following recent discussion
+  on the unison-hackers list
+
+-------------------------------
 CHANGES FROM VERSION 2.42.-29
 
 * Small patch from Stephane Glondu to make Unison compile with Ocaml 3.12.

Modified: trunk/src/fingerprint.ml
===================================================================
--- trunk/src/fingerprint.ml	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/fingerprint.ml	2010-07-22 01:42:07 UTC (rev 458)
@@ -15,7 +15,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *)
 
-
 (* NOTE: IF YOU CHANGE TYPE "FINGERPRINT", THE ARCHIVE FORMAT CHANGES;       *)
 (* INCREMENT "UPDATE.ARCHIVEFORMAT"                                          *)
 type t = string
@@ -92,3 +91,9 @@
   end
 
 let equal (d : string) d' = d = d'
+
+let pseudo_prefix = "LEN" 
+
+let pseudo len = pseudo_prefix ^ (Uutil.Filesize.toString len)
+                                    
+let ispseudo f = Util.startswith f pseudo_prefix 

Modified: trunk/src/fingerprint.mli
===================================================================
--- trunk/src/fingerprint.mli	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/fingerprint.mli	2010-07-22 01:42:07 UTC (rev 458)
@@ -17,3 +17,9 @@
 
 val hash : t -> int
 val equal : t -> t -> bool
+
+(* A pseudo-fingerprint has the same type as a real one (so it can
+   be stored in the archive, etc.), but it is computed just from the
+   size of the file, ignoring the contents *)
+val pseudo : Uutil.Filesize.t -> t
+val ispseudo : t -> bool

Modified: trunk/src/fpcache.ml
===================================================================
--- trunk/src/fpcache.ml	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/fpcache.ml	2010-07-22 01:42:07 UTC (rev 458)
@@ -239,7 +239,7 @@
   let res =
     try
       let (oldDesc, oldDig, oldStamp, oldRess) as res =
-        PathTbl.find tbl (Path.toString path) in
+            PathTbl.find tbl (Path.toString path) in
       if
         not (clearlyUnchanged fastCheck path info oldDesc oldStamp oldRess)
       then

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/mkProjectInfo.ml	2010-07-22 01:42:07 UTC (rev 458)
@@ -5,7 +5,7 @@
 
 let projectName = "unison"
 let majorVersion = 2
-let minorVersion = 42
+let minorVersion = 43
 let pointVersionOrigin = 454 (* Revision that corresponds to point version 0 *)
 
 (* Documentation:
@@ -58,3 +58,4 @@
 
 
 
+

Modified: trunk/src/os.ml
===================================================================
--- trunk/src/os.ml	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/os.ml	2010-07-22 01:42:07 UTC (rev 458)
@@ -274,6 +274,13 @@
 let fullfingerprintEqual (fp, rfp) (fp', rfp') =
   Fingerprint.equal fp fp' && Fingerprint.equal rfp rfp'
 
+let pseudoFingerprint size =
+  (Fingerprint.pseudo size, Fingerprint.dummy)
+
+let isPseudoFingerprint (fp,rfp) =
+  Fingerprint.ispseudo fp
+
+
 (*****************************************************************************)
 (*                           UNISON DIRECTORY                                *)
 (*****************************************************************************)

Modified: trunk/src/os.mli
===================================================================
--- trunk/src/os.mli	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/os.mli	2010-07-22 01:42:07 UTC (rev 458)
@@ -45,3 +45,11 @@
   Fspath.t -> Path.local -> (* coordinates of file to fingerprint *)
   Fileinfo.t ->             (* old fileinfo *)
   fullfingerprint           (* current fingerprint *)
+
+val pseudoFingerprint :
+  Uutil.Filesize.t       -> (* size of file to "fingerprint" *)
+  fullfingerprint           (* pseudo-fingerprint of this file (containing just
+                               the file's length) *)
+
+val isPseudoFingerprint :
+  fullfingerprint -> bool

Modified: trunk/src/ubase/util.mli
===================================================================
--- trunk/src/ubase/util.mli	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/ubase/util.mli	2010-07-22 01:42:07 UTC (rev 458)
@@ -47,7 +47,7 @@
 
 (* String manipulation *)
 val truncateString : string -> int -> string
-val startswith : string -> string -> bool
+val startswith : string -> string -> bool  (* STR,PREFIX *)
 val endswith : string -> string -> bool
 val findsubstring : string -> string -> int option
 val replacesubstring : string -> string -> string -> string (* IN,FROM,TO *)

Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml	2010-07-19 13:05:04 UTC (rev 457)
+++ trunk/src/update.ml	2010-07-22 01:42:07 UTC (rev 458)
@@ -15,7 +15,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *)
 
-
 open Common
 let (>>=)  = Lwt.(>>=)
 



More information about the Unison-hackers mailing list