Hex Artifact Content
Not logged in

Artifact ca710f907d71442884616a34ce8afa7314540349:

File www/sync.html part of check-in [26131cfcc5] - Add a first draft of the synchronization protocol document. Unproofed. by drh on 2007-09-10 00:39:28.

0000: 3c 68 74 6d 6c 3e 0a 3c 68 65 61 64 3e 0a 3c 74  <html>.<head>.<t
0010: 69 74 6c 65 3e 54 68 65 20 46 6f 73 73 69 6c 20  itle>The Fossil 
0020: 53 79 6e 63 20 50 72 6f 74 6f 63 6f 6c 3c 2f 74  Sync Protocol</t
0030: 69 74 6c 65 3e 0a 3c 2f 68 65 61 64 3e 0a 3c 62  itle>.</head>.<b
0040: 6f 64 79 20 62 67 63 6f 6c 6f 72 3d 22 77 68 69  ody bgcolor="whi
0050: 74 65 22 3e 0a 3c 68 31 20 61 6c 69 67 6e 3d 22  te">.<h1 align="
0060: 63 65 6e 74 65 72 22 3e 54 68 65 20 46 6f 73 73  center">The Foss
0070: 69 6c 20 53 79 6e 63 20 50 72 6f 74 6f 63 6f 6c  il Sync Protocol
0080: 3c 2f 68 31 3e 0a 0a 3c 70 3e 46 6f 73 73 69 6c  </h1>..<p>Fossil
0090: 20 73 75 70 70 6f 72 74 73 20 63 6f 6d 6d 61 6e   supports comman
00a0: 64 73 20 3c 62 3e 70 75 73 68 3c 2f 62 3e 2c 20  ds <b>push</b>, 
00b0: 3c 62 3e 70 75 6c 6c 3c 2f 62 3e 2c 20 61 6e 64  <b>pull</b>, and
00c0: 20 3c 62 3e 73 79 6e 63 3c 2f 62 3e 0a 66 6f 72   <b>sync</b>.for
00d0: 20 74 72 61 6e 73 66 65 72 72 69 6e 67 20 69 6e   transferring in
00e0: 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 6f  formation from o
00f0: 6e 65 20 72 65 70 6f 73 69 74 6f 72 79 20 74 6f  ne repository to
0100: 20 61 6e 6f 74 68 65 72 2e 20 20 54 68 65 0a 63   another.  The.c
0110: 6f 6d 6d 61 6e 64 20 69 73 20 72 75 6e 20 6f 6e  ommand is run on
0120: 20 74 68 65 20 63 6c 69 65 6e 74 20 72 65 70 6f   the client repo
0130: 73 69 74 6f 72 79 2e 20 20 41 20 55 52 4c 20 66  sitory.  A URL f
0140: 6f 72 20 74 68 65 20 73 65 72 76 65 72 20 72 65  or the server re
0150: 70 6f 73 69 74 6f 72 79 0a 69 73 20 73 70 65 63  pository.is spec
0160: 69 66 69 65 64 20 61 73 20 70 61 72 74 20 6f 66  ified as part of
0170: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 20 54   the command.  T
0180: 68 69 73 20 64 6f 63 75 6d 65 6e 74 20 64 65 73  his document des
0190: 63 72 69 62 65 73 20 77 68 61 74 20 68 61 70 70  cribes what happ
01a0: 65 6e 73 0a 62 65 68 69 6e 64 20 74 68 65 20 73  ens.behind the s
01b0: 63 65 6e 65 73 20 69 6e 20 6f 72 64 65 72 20 74  cenes in order t
01c0: 6f 20 73 79 6e 63 68 72 6f 6e 69 7a 65 20 74 68  o synchronize th
01d0: 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e  e information on
01e0: 20 74 68 65 20 74 77 6f 0a 72 65 70 6f 73 69 74   the two.reposit
01f0: 6f 72 69 65 73 2e 3c 2f 70 3e 0a 0a 3c 68 32 3e  ories.</p>..<h2>
0200: 31 2e 30 20 54 72 61 6e 73 70 6f 72 74 3c 2f 68  1.0 Transport</h
0210: 32 3e 0a 0a 3c 70 3e 41 6c 6c 20 63 6f 6d 6d 75  2>..<p>All commu
0220: 6e 69 63 61 74 69 6f 6e 20 62 65 74 77 65 65 6e  nication between
0230: 20 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76   client and serv
0240: 65 72 20 69 73 20 76 69 61 20 48 54 54 50 20 72  er is via HTTP r
0250: 65 71 75 65 73 74 73 2e 0a 54 68 65 20 73 65 72  equests..The ser
0260: 76 65 72 20 69 73 20 6c 69 73 74 65 6e 69 6e 67  ver is listening
0270: 20 66 6f 72 20 69 6e 63 6f 6d 69 6e 67 20 48 54   for incoming HT
0280: 54 50 20 72 65 71 75 65 73 74 73 2e 20 20 54 68  TP requests.  Th
0290: 65 20 63 6c 69 65 6e 74 0a 69 73 73 75 65 73 20  e client.issues 
02a0: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 48 54 54 50  one or more HTTP
02b0: 20 72 65 71 75 65 73 74 73 20 61 6e 64 20 72 65   requests and re
02c0: 63 65 69 76 65 73 20 72 65 70 6c 69 65 73 20 66  ceives replies f
02d0: 6f 72 20 65 61 63 68 0a 72 65 71 75 65 73 74 2e  or each.request.
02e0: 3c 2f 70 3e 0a 0a 3c 70 3e 54 68 65 20 73 65 72  </p>..<p>The ser
02f0: 76 65 72 20 6d 69 67 68 74 20 62 65 20 72 75 6e  ver might be run
0300: 6e 69 6e 67 20 61 73 20 61 6e 20 69 6e 64 65 70  ning as an indep
0310: 65 6e 64 65 6e 74 20 73 65 72 76 65 72 0a 75 73  endent server.us
0320: 69 6e 67 20 74 68 65 20 3c 62 3e 73 65 72 76 65  ing the <b>serve
0330: 72 3c 2f 62 3e 20 63 6f 6d 6d 61 6e 64 2c 20 6f  r</b> command, o
0340: 72 20 69 74 20 6d 69 67 68 74 20 62 65 20 6c 61  r it might be la
0350: 75 6e 63 68 65 64 20 66 72 6f 6d 0a 69 6e 65 74  unched from.inet
0360: 64 20 6f 72 20 78 69 6e 65 74 64 20 75 73 69 6e  d or xinetd usin
0370: 67 20 74 68 65 20 3c 62 3e 68 74 74 70 3c 2f 62  g the <b>http</b
0380: 3e 20 63 6f 6d 6d 61 6e 64 2e 20 20 4f 72 20 74  > command.  Or t
0390: 68 65 20 73 65 72 76 65 72 20 6d 69 67 68 74 0a  he server might.
03a0: 62 65 20 6c 61 75 6e 63 68 65 64 20 66 72 6f 6d  be launched from
03b0: 20 43 47 49 2e 20 20 54 68 65 20 64 65 74 61 69   CGI.  The detai
03c0: 6c 73 20 6f 66 20 68 6f 77 20 74 68 65 20 73 65  ls of how the se
03d0: 72 76 65 72 20 69 73 20 63 6f 6e 66 69 67 75 72  rver is configur
03e0: 65 64 0a 74 6f 20 22 6c 69 73 74 65 6e 22 20 66  ed.to "listen" f
03f0: 6f 72 20 69 6e 63 6f 6d 69 6e 67 20 48 54 54 50  or incoming HTTP
0400: 20 72 65 71 75 65 73 74 73 20 69 73 20 69 6d 6d   requests is imm
0410: 61 74 65 72 69 61 6c 2e 20 20 54 68 65 20 69 6d  aterial.  The im
0420: 70 6f 72 74 61 6e 74 0a 70 6f 69 6e 74 20 69 73  portant.point is
0430: 20 74 68 61 74 20 74 68 65 20 73 65 72 76 65 72   that the server
0440: 20 69 73 20 6c 69 73 74 65 6e 69 6e 67 20 66 6f   is listening fo
0450: 72 20 72 65 71 75 65 73 74 73 20 61 6e 64 20 74  r requests and t
0460: 68 65 20 63 6c 69 65 6e 74 0a 69 73 20 74 68 65  he client.is the
0470: 20 69 73 73 75 65 72 20 6f 66 20 74 68 65 20 72   issuer of the r
0480: 65 71 75 65 73 74 73 2e 3c 2f 70 3e 0a 0a 3c 70  equests.</p>..<p
0490: 3e 41 20 73 69 6e 67 6c 65 20 70 75 73 68 2c 20  >A single push, 
04a0: 70 75 6c 6c 2c 20 6f 72 20 73 79 6e 63 20 6d 69  pull, or sync mi
04b0: 67 68 74 20 69 6e 76 6f 6c 76 65 20 6d 75 6c 74  ght involve mult
04c0: 69 70 6c 65 20 48 54 54 50 20 72 65 71 75 65 73  iple HTTP reques
04d0: 74 73 2e 0a 54 68 65 20 63 6c 69 65 6e 74 20 6d  ts..The client m
04e0: 61 69 6e 74 61 69 6e 73 20 73 74 61 74 65 20 62  aintains state b
04f0: 65 74 77 65 65 6e 20 61 6c 6c 20 72 65 71 75 65  etween all reque
0500: 73 74 73 2e 20 20 42 75 74 20 6f 6e 20 74 68 65  sts.  But on the
0510: 20 73 65 72 76 65 72 0a 73 69 64 65 2c 20 65 61   server.side, ea
0520: 63 68 20 72 65 71 75 65 73 74 20 69 73 20 69 6e  ch request is in
0530: 64 65 70 65 6e 64 65 6e 74 2e 20 20 54 68 65 20  dependent.  The 
0540: 73 65 72 76 65 72 20 64 6f 65 73 20 6e 6f 74 20  server does not 
0550: 70 72 65 73 65 72 76 65 0a 61 6e 79 20 69 6e 66  preserve.any inf
0560: 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 74  ormation about t
0570: 68 65 20 63 6c 69 65 6e 74 20 66 72 6f 6d 20 6f  he client from o
0580: 6e 65 20 72 65 71 75 65 73 74 20 74 6f 20 74 68  ne request to th
0590: 65 20 6e 65 78 74 2e 3c 2f 70 3e 0a 0a 3c 68 33  e next.</p>..<h3
05a0: 3e 31 2e 31 20 53 65 72 76 65 72 20 49 64 65 6e  >1.1 Server Iden
05b0: 74 69 66 69 63 61 74 69 6f 6e 3c 2f 68 33 3e 0a  tification</h3>.
05c0: 0a 3c 70 3e 54 68 65 20 73 65 72 76 65 72 20 69  .<p>The server i
05d0: 73 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20  s identified by 
05e0: 61 20 55 52 4c 20 61 72 67 75 6d 65 6e 74 20 74  a URL argument t
05f0: 68 61 74 20 61 63 63 6f 6d 70 61 6e 69 65 73 20  hat accompanies 
0600: 74 68 65 0a 70 75 73 68 2c 20 70 75 6c 6c 2c 20  the.push, pull, 
0610: 6f 72 20 73 79 6e 63 20 63 6f 6d 6d 61 6e 64 20  or sync command 
0620: 6f 6e 20 74 68 65 20 63 6c 69 65 6e 74 2e 20 20  on the client.  
0630: 28 41 73 20 61 20 63 6f 6e 76 65 6e 69 65 6e 63  (As a convenienc
0640: 65 20 74 6f 0a 75 73 65 72 73 2c 20 74 68 65 20  e to.users, the 
0650: 55 52 4c 20 63 61 6e 20 62 65 20 6f 6d 69 74 74  URL can be omitt
0660: 65 64 20 6f 6e 20 74 68 65 20 63 6c 69 65 6e 74  ed on the client
0670: 20 63 6f 6d 6d 61 6e 64 20 61 6e 64 20 74 68 65   command and the
0680: 20 73 61 6d 65 20 55 52 4c 0a 66 72 6f 6d 20 74   same URL.from t
0690: 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 70  he most recent p
06a0: 75 73 68 2c 20 70 75 6c 6c 2c 20 6f 72 20 73 79  ush, pull, or sy
06b0: 6e 63 20 77 69 6c 6c 20 62 65 20 72 65 75 73 65  nc will be reuse
06c0: 64 2e 20 20 54 68 69 73 20 73 61 76 65 73 0a 74  d.  This saves.t
06d0: 79 70 69 6e 67 20 69 6e 20 74 68 65 20 63 6f 6d  yping in the com
06e0: 6d 6f 6e 20 63 61 73 65 20 77 68 65 72 65 20 74  mon case where t
06f0: 68 65 20 63 6c 69 65 6e 74 20 64 6f 65 73 20 6d  he client does m
0700: 75 6c 74 69 70 6c 65 20 73 79 6e 63 73 20 74 6f  ultiple syncs to
0710: 0a 74 68 65 20 73 61 6d 65 20 73 65 72 76 65 72  .the same server
0720: 2e 29 3c 2f 70 3e 0a 0a 3c 70 3e 54 68 65 20 63  .)</p>..<p>The c
0730: 6c 69 65 6e 74 20 6d 6f 64 69 66 69 65 73 20 74  lient modifies t
0740: 68 65 20 55 52 4c 20 62 79 20 61 70 70 65 6e 64  he URL by append
0750: 69 6e 67 20 74 68 65 20 6d 65 74 68 6f 64 20 6e  ing the method n
0760: 61 6d 65 20 22 3c 62 3e 2f 78 66 65 72 3c 2f 62  ame "<b>/xfer</b
0770: 3e 22 0a 74 6f 20 74 68 65 20 65 6e 64 2e 20 20  >".to the end.  
0780: 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20  For example, if 
0790: 74 68 65 20 55 52 4c 20 73 70 65 63 69 66 69 65  the URL specifie
07a0: 64 20 6f 6e 20 74 68 65 20 63 6c 69 65 6e 74 20  d on the client 
07b0: 63 6f 6d 6d 61 6e 64 0a 6c 69 6e 65 20 69 73 3c  command.line is<
07c0: 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  /p>..<blockquote
07d0: 3e 0a 68 74 74 70 3a 2f 2f 66 6f 73 73 69 6c 2d  >.http://fossil-
07e0: 73 63 6d 2e 68 77 61 63 69 2e 63 6f 6d 2f 66 6f  scm.hwaci.com/fo
07f0: 73 73 69 6c 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  ssil.</blockquot
0800: 65 3e 0a 0a 3c 70 3e 54 68 65 6e 20 74 68 65 20  e>..<p>Then the 
0810: 55 52 4c 20 74 68 61 74 20 69 73 20 72 65 61 6c  URL that is real
0820: 6c 79 20 75 73 65 64 20 74 6f 20 64 6f 20 74 68  ly used to do th
0830: 65 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f  e synchronizatio
0840: 6e 20 77 69 6c 6c 0a 62 65 3a 3c 2f 70 3e 0a 0a  n will.be:</p>..
0850: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 68 74 74  <blockquote>.htt
0860: 70 3a 2f 2f 66 6f 73 73 69 6c 2d 73 63 6d 2e 68  p://fossil-scm.h
0870: 77 61 63 69 2e 63 6f 6d 2f 66 6f 73 73 69 6c 2f  waci.com/fossil/
0880: 78 66 65 72 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  xfer.</blockquot
0890: 65 3e 0a 0a 3c 68 33 3e 31 2e 32 20 48 54 54 50  e>..<h3>1.2 HTTP
08a0: 20 52 65 71 75 65 73 74 20 46 6f 72 6d 61 74 3c   Request Format<
08b0: 2f 68 33 3e 0a 0a 3c 70 3e 54 68 65 20 63 6c 69  /h3>..<p>The cli
08c0: 65 6e 74 20 61 6c 77 61 79 73 20 73 65 6e 64 73  ent always sends
08d0: 20 61 20 50 4f 53 54 20 72 65 71 75 65 73 74 20   a POST request 
08e0: 74 6f 20 74 68 65 20 73 65 72 76 65 72 2e 20 20  to the server.  
08f0: 54 68 65 0a 67 65 6e 65 72 61 6c 20 66 6f 72 6d  The.general form
0900: 61 74 20 6f 66 20 74 68 65 20 50 4f 53 54 20 72  at of the POST r
0910: 65 71 75 65 73 74 20 69 73 20 61 73 20 66 6f 6c  equest is as fol
0920: 6c 6f 77 73 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63  lows:</p>..<bloc
0930: 6b 71 75 6f 74 65 3e 3c 70 72 65 3e 0a 50 4f 53  kquote><pre>.POS
0940: 54 20 2f 66 6f 73 73 69 6c 2f 78 66 65 72 20 48  T /fossil/xfer H
0950: 54 54 50 2f 31 2e 30 0a 48 6f 73 74 3a 20 66 6f  TTP/1.0.Host: fo
0960: 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e 63  ssil-scm.hwaci.c
0970: 6f 6d 3a 38 30 0a 43 6f 6e 74 65 6e 74 2d 54 79  om:80.Content-Ty
0980: 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f  pe: application/
0990: 78 2d 66 6f 73 73 69 6c 0a 43 6f 6e 74 65 6e 74  x-fossil.Content
09a0: 2d 4c 65 6e 67 74 68 3a 20 34 32 31 36 0a 0a 3c  -Length: 4216..<
09b0: 69 3e 63 6f 6e 74 65 6e 74 2e 2e 2e 3c 2f 69 3e  i>content...</i>
09c0: 0a 3c 2f 70 72 65 3e 3c 2f 62 6c 6f 63 6b 71 75  .</pre></blockqu
09d0: 6f 74 65 3e 0a 0a 3c 70 3e 49 6e 20 74 68 65 20  ote>..<p>In the 
09e0: 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 2c 20 74  example above, t
09f0: 68 65 20 70 61 74 68 6e 61 6d 65 20 67 69 76 65  he pathname give
0a00: 6e 20 61 66 74 65 72 20 74 68 65 20 50 4f 53 54  n after the POST
0a10: 20 6b 65 79 77 6f 72 64 0a 6f 6e 20 74 68 65 20   keyword.on the 
0a20: 66 69 72 73 74 20 6c 69 6e 65 20 69 73 20 61 20  first line is a 
0a30: 63 6f 70 79 20 6f 66 20 74 68 65 20 55 52 4c 20  copy of the URL 
0a40: 70 61 74 68 6e 61 6d 65 2e 20 20 54 68 65 20 48  pathname.  The H
0a50: 6f 73 74 3a 20 70 61 72 61 6d 65 74 65 72 0a 69  ost: parameter.i
0a60: 73 20 61 6c 73 6f 20 74 61 6b 65 6e 20 66 72 6f  s also taken fro
0a70: 6d 20 74 68 65 20 55 52 4c 2e 20 20 54 68 65 20  m the URL.  The 
0a80: 63 6f 6e 74 65 6e 74 20 74 79 70 65 20 69 73 20  content type is 
0a90: 61 6c 77 61 79 73 20 65 69 74 68 65 72 0a 22 61  always either."a
0aa0: 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 6f 73  pplication/x-fos
0ab0: 73 69 6c 22 20 6f 72 20 22 61 70 70 6c 69 63 61  sil" or "applica
0ac0: 74 69 6f 6e 2f 78 2d 66 6f 73 73 69 6c 2d 64 65  tion/x-fossil-de
0ad0: 62 75 67 22 2e 20 20 54 68 65 20 22 78 2d 66 6f  bug".  The "x-fo
0ae0: 73 73 69 6c 22 0a 63 6f 6e 74 65 6e 74 20 74 79  ssil".content ty
0af0: 70 65 20 69 73 20 74 68 65 20 64 65 66 61 75 6c  pe is the defaul
0b00: 74 2e 20 20 54 68 65 20 6f 6e 6c 79 20 64 69 66  t.  The only dif
0b10: 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 74 20  ference is that 
0b20: 22 78 2d 66 6f 73 73 69 6c 22 0a 63 6f 6e 74 65  "x-fossil".conte
0b30: 6e 74 20 69 73 20 63 6f 6d 70 72 65 73 73 65 64  nt is compressed
0b40: 20 75 73 69 6e 67 20 7a 6c 69 62 20 77 68 65 72   using zlib wher
0b50: 65 61 73 20 22 78 2d 66 6f 73 73 69 6c 2d 64 65  eas "x-fossil-de
0b60: 62 75 67 22 20 69 73 20 73 65 6e 74 0a 75 6e 63  bug" is sent.unc
0b70: 6f 6d 70 72 65 73 73 65 64 2e 3c 2f 70 3e 0a 0a  ompressed.</p>..
0b80: 3c 70 3e 41 20 74 79 70 69 63 61 6c 20 72 65 70  <p>A typical rep
0b90: 6c 79 20 66 72 6f 6d 20 74 68 65 20 73 65 72 76  ly from the serv
0ba0: 65 72 20 6d 69 67 68 74 20 6c 6f 6f 6b 20 73 6f  er might look so
0bb0: 6d 65 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69  mething like thi
0bc0: 73 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75  s:</p>..<blockqu
0bd0: 6f 74 65 3e 3c 70 72 65 3e 0a 48 54 54 50 2f 31  ote><pre>.HTTP/1
0be0: 2e 30 20 32 30 30 20 4f 4b 0a 44 61 74 65 3a 20  .0 200 OK.Date: 
0bf0: 4d 6f 6e 2c 20 31 30 20 53 65 70 20 32 30 30 37  Mon, 10 Sep 2007
0c00: 20 31 32 3a 32 31 3a 30 31 20 47 4d 54 0a 43 6f   12:21:01 GMT.Co
0c10: 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0a  nnection: close.
0c20: 43 61 63 68 65 2d 63 6f 6e 74 72 6f 6c 3a 20 70  Cache-control: p
0c30: 72 69 76 61 74 65 0a 43 6f 6e 74 65 6e 74 2d 54  rivate.Content-T
0c40: 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e  ype: application
0c50: 2f 78 2d 66 6f 73 73 69 6c 3b 20 63 68 61 72 73  /x-fossil; chars
0c60: 65 74 3d 55 53 2d 41 53 43 49 49 0a 43 6f 6e 74  et=US-ASCII.Cont
0c70: 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 32 36 35 0a  ent-Length: 265.
0c80: 0a 3c 69 3e 63 6f 6e 74 65 6e 74 2e 2e 2e 3c 2f  .<i>content...</
0c90: 69 3e 0a 3c 2f 70 72 65 3e 3c 2f 62 6c 6f 63 6b  i>.</pre></block
0ca0: 71 75 6f 74 65 3e 0a 0a 3c 70 3e 54 68 65 20 63  quote>..<p>The c
0cb0: 6f 6e 74 65 6e 74 20 74 79 70 65 20 6f 66 20 74  ontent type of t
0cc0: 68 65 20 72 65 70 6c 79 20 69 73 20 61 6c 77 61  he reply is alwa
0cd0: 79 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74  ys the same as t
0ce0: 68 65 20 63 6f 6e 74 65 6e 74 20 74 79 70 65 0a  he content type.
0cf0: 6f 66 20 74 68 65 20 72 65 71 75 65 73 74 2e 3c  of the request.<
0d00: 2f 70 3e 0a 0a 3c 68 32 3e 32 2e 30 20 46 6f 73  /p>..<h2>2.0 Fos
0d10: 73 69 6c 20 53 79 6e 63 68 72 6f 6e 69 7a 61 74  sil Synchronizat
0d20: 69 6f 6e 20 43 6f 6e 74 65 6e 74 3c 2f 68 32 3e  ion Content</h2>
0d30: 0a 0a 3c 70 3e 41 20 73 79 6e 63 68 72 6f 6e 69  ..<p>A synchroni
0d40: 7a 61 74 69 6f 6e 20 72 65 71 75 65 73 74 20 62  zation request b
0d50: 65 74 77 65 65 6e 20 61 20 63 6c 69 65 6e 74 20  etween a client 
0d60: 61 6e 64 20 73 65 72 76 65 72 20 63 6f 6e 73 69  and server consi
0d70: 73 74 73 20 6f 66 0a 6f 6e 65 20 6f 72 20 6d 6f  sts of.one or mo
0d80: 72 65 20 48 54 54 50 20 72 65 71 75 65 73 74 73  re HTTP requests
0d90: 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e   as described in
0da0: 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 73 65   the previous se
0db0: 63 74 69 6f 6e 2e 20 20 54 68 69 73 0a 73 65 63  ction.  This.sec
0dc0: 74 69 6f 6e 20 64 65 74 61 69 6c 73 20 74 68 65  tion details the
0dd0: 20 22 78 2d 66 6f 73 73 69 6c 22 20 63 6f 6e 74   "x-fossil" cont
0de0: 65 6e 74 20 74 79 70 65 2e 3c 2f 70 3e 0a 0a 3c  ent type.</p>..<
0df0: 68 33 3e 32 2e 31 20 4c 69 6e 65 2d 6f 72 69 65  h3>2.1 Line-orie
0e00: 6e 74 65 64 20 46 6f 72 6d 61 74 3c 2f 68 33 3e  nted Format</h3>
0e10: 0a 0a 3c 70 3e 54 68 65 20 78 2d 66 6f 73 73 69  ..<p>The x-fossi
0e20: 6c 20 63 6f 6e 74 65 6e 74 20 74 79 70 65 20 63  l content type c
0e30: 6f 6e 73 69 73 74 73 20 6f 66 20 7a 65 72 6f 20  onsists of zero 
0e40: 6f 72 20 6d 6f 72 65 20 22 63 61 72 64 73 22 2e  or more "cards".
0e50: 20 20 43 61 72 64 73 0a 61 72 65 20 73 65 70 61    Cards.are sepa
0e60: 72 61 74 65 20 62 79 20 74 68 65 20 6e 65 77 6c  rate by the newl
0e70: 69 6e 65 20 63 68 61 72 61 63 74 65 72 20 28 22  ine character ("
0e80: 5c 6e 22 29 2e 20 20 4c 65 61 64 69 6e 67 20 61  \n").  Leading a
0e90: 6e 64 20 74 72 61 69 6c 69 6e 67 0a 77 68 69 74  nd trailing.whit
0ea0: 65 73 70 61 63 65 20 6f 6e 20 61 20 63 61 72 64  espace on a card
0eb0: 20 69 73 20 69 67 6e 6f 72 65 2e 20 20 42 6c 61   is ignore.  Bla
0ec0: 6e 6b 20 63 61 72 64 73 20 61 72 65 20 69 67 6e  nk cards are ign
0ed0: 6f 72 65 64 2e 3c 2f 70 3e 0a 0a 3c 70 3e 45 61  ored.</p>..<p>Ea
0ee0: 63 68 20 63 61 72 64 20 69 73 20 64 69 76 69 64  ch card is divid
0ef0: 65 64 20 69 6e 74 6f 20 7a 65 72 6f 20 6f 72 20  ed into zero or 
0f00: 6d 6f 72 65 20 73 70 61 63 65 20 73 65 70 61 72  more space separ
0f10: 61 74 65 64 20 74 6f 6b 65 6e 73 2e 0a 54 68 65  ated tokens..The
0f20: 20 66 69 72 73 74 20 74 6f 6b 65 6e 20 6f 6e 20   first token on 
0f30: 65 61 63 68 20 63 61 72 64 20 69 73 20 74 68 65  each card is the
0f40: 20 6f 70 65 72 61 74 6f 72 2e 20 20 53 75 62 73   operator.  Subs
0f50: 65 71 75 65 6e 74 20 74 6f 6b 65 6e 73 0a 61 72  equent tokens.ar
0f60: 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 54 68  e arguments.  Th
0f70: 65 20 73 65 74 20 6f 66 20 6f 70 65 72 61 74 6f  e set of operato
0f80: 72 73 20 75 6e 64 65 72 73 74 6f 6f 64 20 62 79  rs understood by
0f90: 20 73 65 72 76 65 72 73 20 69 73 20 73 6c 69 67   servers is slig
0fa0: 68 74 6c 79 0a 64 69 66 66 65 72 65 6e 74 20 66  htly.different f
0fb0: 72 6f 6d 20 74 68 65 20 6f 70 65 72 61 74 6f 72  rom the operator
0fc0: 73 20 75 6e 64 65 72 73 74 6f 6f 64 20 62 79 20  s understood by 
0fd0: 63 6c 69 65 6e 74 73 2c 20 74 68 6f 75 67 68 20  clients, though 
0fe0: 74 68 65 20 74 77 6f 0a 61 72 65 20 76 65 72 79  the two.are very
0ff0: 20 73 69 6d 69 6c 61 72 2e 3c 2f 70 3e 0a 0a 3c   similar.</p>..<
1000: 68 33 3e 32 2e 32 20 4c 6f 67 69 6e 20 43 61 72  h3>2.2 Login Car
1010: 64 73 3c 2f 68 33 3e 0a 0a 3c 70 3e 45 76 65 72  ds</h3>..<p>Ever
1020: 79 20 6d 65 73 73 61 67 65 20 66 72 6f 6d 20 63  y message from c
1030: 6c 69 65 6e 74 20 74 6f 20 73 65 72 76 65 72 20  lient to server 
1040: 62 65 67 69 6e 73 20 77 69 74 68 20 6f 6e 65 20  begins with one 
1050: 6d 6f 72 65 20 6c 6f 67 69 6e 0a 63 61 72 64 73  more login.cards
1060: 2e 20 20 45 61 63 68 20 6c 6f 67 69 6e 20 63 61  .  Each login ca
1070: 72 64 20 68 61 73 20 74 68 65 20 66 6f 6c 6c 6f  rd has the follo
1080: 77 69 6e 67 20 66 6f 72 6d 61 74 3a 3c 2f 70 3e  wing format:</p>
1090: 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c  ..<blockquote>.<
10a0: 62 3e 6c 6f 67 69 6e 3c 2f 62 3e 20 20 3c 69 3e  b>login</b>  <i>
10b0: 75 73 65 72 69 64 20 20 6e 6f 6e 63 65 20 20 73  userid  nonce  s
10c0: 69 67 6e 61 74 75 72 65 3c 2f 69 3e 0a 3c 2f 62  ignature</i>.</b
10d0: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70 3e 54  lockquote>..<p>T
10e0: 68 65 20 75 73 65 72 69 64 20 69 73 20 74 68 65  he userid is the
10f0: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 75 73 65   name of the use
1100: 72 20 74 68 61 74 20 69 73 20 72 65 71 75 65 73  r that is reques
1110: 74 69 6e 67 20 73 65 72 76 69 63 65 0a 66 72 6f  ting service.fro
1120: 6d 20 74 68 65 20 73 65 72 76 65 72 2e 20 20 54  m the server.  T
1130: 68 65 20 6e 6f 6e 63 65 20 69 73 20 61 20 72 61  he nonce is a ra
1140: 6e 64 6f 6d 20 6f 6e 65 2d 75 73 65 20 68 65 78  ndom one-use hex
1150: 61 64 65 63 69 6d 61 6c 20 6e 75 6d 62 65 72 2e  adecimal number.
1160: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 69  .The signature i
1170: 73 20 74 68 65 20 53 48 41 31 20 68 61 73 68 20  s the SHA1 hash 
1180: 6f 66 20 74 68 65 20 75 73 65 72 73 20 70 61 73  of the users pas
1190: 73 77 6f 72 64 2e 3c 2f 70 3e 0a 0a 3c 70 3e 46  sword.</p>..<p>F
11a0: 6f 72 20 65 61 63 68 20 6c 6f 67 69 6e 20 63 61  or each login ca
11b0: 72 64 2c 20 74 68 65 20 73 65 72 76 65 72 20 6c  rd, the server l
11c0: 6f 6f 6b 73 20 75 70 20 74 68 65 20 75 73 65 72  ooks up the user
11d0: 20 61 6e 64 20 76 65 72 69 66 69 65 73 0a 74 68   and verifies.th
11e0: 61 74 20 74 68 65 20 6e 6f 6e 63 65 20 68 61 73  at the nonce has
11f0: 20 6e 65 76 65 72 20 62 65 66 6f 72 65 20 62 65   never before be
1200: 65 6e 20 75 73 65 64 2e 20 20 49 74 20 74 68 65  en used.  It the
1210: 6e 20 63 68 65 63 6b 73 20 74 68 65 0a 73 69 67  n checks the.sig
1220: 6e 61 74 75 72 65 20 68 61 73 68 20 74 6f 20 6d  nature hash to m
1230: 61 6b 65 20 73 75 72 65 20 74 68 65 20 73 69 67  ake sure the sig
1240: 6e 61 74 75 72 65 20 6d 61 74 63 68 65 73 2e 20  nature matches. 
1250: 20 49 66 20 65 76 65 72 79 74 68 69 6e 67 0a 63   If everything.c
1260: 68 65 63 6b 73 20 6f 75 74 2c 20 74 68 65 6e 20  hecks out, then 
1270: 74 68 65 20 63 6c 69 65 6e 74 20 69 73 20 67 72  the client is gr
1280: 61 6e 74 65 64 20 61 6c 6c 20 70 72 69 76 69 6c  anted all privil
1290: 65 67 65 73 20 6f 66 20 74 68 65 0a 73 70 65 63  eges of the.spec
12a0: 69 66 69 65 64 20 75 73 65 72 2e 3c 2f 70 3e 0a  ified user.</p>.
12b0: 0a 3c 70 3e 50 72 69 76 69 6c 65 67 65 73 20 61  .<p>Privileges a
12c0: 72 65 20 63 75 6d 75 6c 61 74 69 76 65 2e 20 20  re cumulative.  
12d0: 54 68 65 72 65 20 63 61 6e 20 62 65 20 6d 75 6c  There can be mul
12e0: 74 69 70 6c 65 20 73 75 63 63 65 73 73 66 75 6c  tiple successful
12f0: 0a 6c 6f 67 69 6e 20 63 61 72 64 73 2e 20 20 54  .login cards.  T
1300: 68 65 20 73 65 73 73 69 6f 6e 20 70 72 69 76 69  he session privi
1310: 6c 65 67 65 73 20 61 72 65 20 74 68 65 20 62 69  leges are the bi
1320: 74 2d 77 69 73 65 20 4f 52 20 6f 66 20 74 68 65  t-wise OR of the
1330: 0a 70 72 69 76 69 6c 65 67 65 73 20 6f 66 20 65  .privileges of e
1340: 61 63 68 20 69 6e 64 69 76 69 64 75 61 6c 20 6c  ach individual l
1350: 6f 67 69 6e 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32  ogin.</p>..<h3>2
1360: 2e 33 20 46 69 6c 65 20 43 61 72 64 73 3c 2f 68  .3 File Cards</h
1370: 33 3e 0a 0a 3c 70 3e 52 65 70 6f 73 69 74 6f 72  3>..<p>Repositor
1380: 79 20 63 6f 6e 74 65 6e 74 20 72 65 63 6f 72 64  y content record
1390: 73 20 6f 72 20 66 69 6c 65 73 20 61 72 65 20 74  s or files are t
13a0: 72 61 6e 73 66 65 72 72 65 64 20 75 73 69 6e 67  ransferred using
13b0: 0a 61 20 22 66 69 6c 65 22 20 63 61 72 64 2e 20  .a "file" card. 
13c0: 20 46 69 6c 65 20 63 61 72 64 73 20 63 6f 6d 65   File cards come
13d0: 20 69 6e 20 74 77 6f 20 64 69 66 66 65 72 65 6e   in two differen
13e0: 74 20 66 6f 72 6d 61 74 73 20 64 65 70 65 6e 64  t formats depend
13f0: 69 6e 67 0a 6f 6e 20 77 68 65 74 68 65 72 20 74  ing.on whether t
1400: 68 65 20 66 69 6c 65 20 69 73 20 73 65 6e 74 20  he file is sent 
1410: 64 69 72 65 63 74 6c 79 20 6f 72 20 61 73 20 61  directly or as a
1420: 20 64 65 6c 74 61 20 66 72 6f 6d 20 73 6f 6d 65   delta from some
1430: 0a 6f 74 68 65 72 20 66 69 6c 65 2e 3c 2f 70 3e  .other file.</p>
1440: 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c  ..<blockquote>.<
1450: 62 3e 66 69 6c 65 3c 2f 62 3e 20 3c 69 3e 75 75  b>file</b> <i>uu
1460: 69 64 20 73 69 7a 65 3c 2f 69 3e 20 3c 62 3e 5c  id size</i> <b>\
1470: 6e 3c 2f 62 3e 20 3c 69 3e 63 6f 6e 74 65 6e 74  n</b> <i>content
1480: 3c 2f 69 3e 3c 62 72 3e 0a 3c 62 3e 66 69 6c 65  </i><br>.<b>file
1490: 3c 2f 62 3e 20 3c 69 3e 75 75 69 64 20 64 65 6c  </b> <i>uuid del
14a0: 74 61 2d 75 75 69 64 20 73 69 7a 65 3c 2f 69 3e  ta-uuid size</i>
14b0: 20 3c 62 3e 5c 6e 3c 2f 62 3e 20 3c 69 3e 63 6f   <b>\n</b> <i>co
14c0: 6e 74 65 6e 74 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63  ntent</i>.</bloc
14d0: 6b 71 75 6f 74 65 3e 0a 0a 3c 70 3e 46 69 6c 65  kquote>..<p>File
14e0: 20 63 61 72 64 73 20 61 72 65 20 64 69 66 66 65   cards are diffe
14f0: 72 65 6e 74 20 66 72 6f 6d 20 61 6c 6c 20 6f 74  rent from all ot
1500: 68 65 72 20 63 61 72 64 73 20 69 6e 20 74 68 61  her cards in tha
1510: 74 20 74 68 65 79 0a 66 6f 6c 6c 6f 77 65 64 20  t they.followed 
1520: 62 79 20 69 6e 2d 6c 69 6e 65 20 22 70 61 79 6c  by in-line "payl
1530: 6f 61 64 22 20 64 61 74 61 2e 20 20 54 68 65 20  oad" data.  The 
1540: 63 6f 6e 74 65 6e 74 20 6f 66 20 74 68 65 20 66  content of the f
1550: 69 6c 65 0a 6f 72 20 74 68 65 20 66 69 6c 65 20  ile.or the file 
1560: 64 65 6c 74 61 20 63 6f 6e 73 69 73 74 73 20 6f  delta consists o
1570: 66 20 66 69 72 73 74 20 3c 69 3e 73 69 7a 65 3c  f first <i>size<
1580: 2f 69 3e 20 62 79 74 65 73 20 6f 66 20 74 68 65  /i> bytes of the
1590: 0a 78 2d 66 6f 73 73 69 6c 20 63 6f 6e 74 65 6e  .x-fossil conten
15a0: 74 20 74 68 61 74 20 69 6d 6d 65 64 69 61 74 65  t that immediate
15b0: 6c 79 20 66 6f 6c 6c 6f 77 20 74 68 65 20 6e 65  ly follow the ne
15c0: 77 6c 69 6e 65 20 74 68 61 74 0a 74 65 72 6d 69  wline that.termi
15d0: 6e 61 74 65 73 20 74 68 65 20 66 69 6c 65 20 63  nates the file c
15e0: 61 72 64 2e 20 20 4e 6f 20 6f 74 68 65 72 20 63  ard.  No other c
15f0: 61 72 64 73 20 68 61 76 65 20 74 68 69 73 20 63  ards have this c
1600: 68 61 72 61 63 74 65 72 69 73 74 69 63 2e 0a 3c  haracteristic..<
1610: 2f 70 3e 0a 0a 3c 70 3e 54 68 65 20 66 69 72 73  /p>..<p>The firs
1620: 74 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 61 20  t argument of a 
1630: 66 69 6c 65 20 63 61 72 64 20 69 73 20 74 68 65  file card is the
1640: 20 55 55 49 44 20 6f 66 20 74 68 65 20 66 69 6c   UUID of the fil
1650: 65 20 74 68 61 74 0a 69 73 20 62 65 69 6e 67 20  e that.is being 
1660: 74 72 61 6e 73 66 65 72 72 65 64 2e 20 20 54 68  transferred.  Th
1670: 65 20 55 55 49 44 20 69 73 20 74 68 65 20 6c 6f  e UUID is the lo
1680: 77 65 72 2d 63 61 73 65 20 68 65 78 61 64 65 63  wer-case hexadec
1690: 69 6d 61 6c 0a 72 65 70 72 65 73 65 6e 74 61 74  imal.representat
16a0: 69 6f 6e 20 6f 66 20 74 68 65 20 53 48 41 31 20  ion of the SHA1 
16b0: 68 61 73 68 20 6f 66 20 74 68 65 20 65 6e 74 69  hash of the enti
16c0: 72 65 20 66 69 6c 65 20 63 6f 6e 74 65 6e 74 2e  re file content.
16d0: 0a 54 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65  .The last argume
16e0: 6e 74 20 6f 66 20 74 68 65 20 66 69 6c 65 20 63  nt of the file c
16f0: 61 72 64 20 69 73 20 74 68 65 20 6e 75 6d 62 65  ard is the numbe
1700: 72 20 6f 66 20 62 79 74 65 73 20 6f 66 0a 70 61  r of bytes of.pa
1710: 79 6c 6f 61 64 20 74 68 61 74 20 69 6d 6d 65 64  yload that immed
1720: 69 61 74 65 6c 79 20 66 6f 6c 6c 6f 77 20 74 68  iately follow th
1730: 65 20 66 69 6c 65 20 63 61 72 64 2e 20 20 49 66  e file card.  If
1740: 20 74 68 65 20 66 69 6c 65 0a 63 61 72 64 20 68   the file.card h
1750: 61 73 20 6f 6e 6c 79 20 74 77 6f 20 61 72 67 75  as only two argu
1760: 6d 65 6e 74 73 2c 20 74 68 61 74 20 6d 65 61 6e  ments, that mean
1770: 73 20 74 68 65 20 70 61 79 6c 6f 61 64 20 69 73  s the payload is
1780: 20 74 68 65 0a 63 6f 6d 70 6c 65 74 65 20 63 6f   the.complete co
1790: 6e 74 65 6e 74 20 6f 66 20 74 68 65 20 66 69 6c  ntent of the fil
17a0: 65 2e 20 20 49 66 20 74 68 65 20 66 69 6c 65 20  e.  If the file 
17b0: 63 61 72 64 20 68 61 73 20 74 68 72 65 65 0a 61  card has three.a
17c0: 72 67 75 6d 65 6e 74 73 2c 20 74 68 65 6e 20 74  rguments, then t
17d0: 68 65 20 70 61 79 6c 6f 61 64 20 69 73 20 61 20  he payload is a 
17e0: 64 65 6c 74 61 20 61 6e 64 20 73 65 63 6f 6e 64  delta and second
17f0: 20 61 72 67 75 6d 65 6e 74 20 69 73 0a 74 68 65   argument is.the
1800: 20 55 55 49 44 20 6f 66 20 61 6e 6f 74 68 65 72   UUID of another
1810: 20 66 69 6c 65 20 74 68 61 74 20 69 73 20 74 68   file that is th
1820: 65 20 73 6f 75 72 63 65 20 6f 66 20 74 68 65 20  e source of the 
1830: 64 65 6c 74 61 2e 3c 2f 70 3e 0a 0a 3c 70 3e 46  delta.</p>..<p>F
1840: 69 6c 65 20 63 61 72 64 73 20 61 72 65 20 73 65  ile cards are se
1850: 6e 74 20 69 6e 20 62 6f 74 68 20 64 69 72 65 63  nt in both direc
1860: 74 69 6f 6e 73 3a 20 63 6c 69 65 6e 74 20 74 6f  tions: client to
1870: 20 73 65 72 76 65 72 20 61 6e 64 0a 73 65 72 76   server and.serv
1880: 65 72 20 74 6f 20 63 6c 69 65 6e 74 2e 20 20 41  er to client.  A
1890: 20 64 65 6c 74 61 20 6d 69 67 68 74 20 62 65 20   delta might be 
18a0: 73 65 6e 74 20 62 65 66 6f 72 65 20 74 68 65 20  sent before the 
18b0: 73 6f 75 72 63 65 20 6f 66 0a 74 68 65 20 64 65  source of.the de
18c0: 6c 74 61 2c 20 73 6f 20 62 6f 74 68 20 63 6c 69  lta, so both cli
18d0: 65 6e 74 20 61 6e 64 20 73 65 72 76 65 72 20 73  ent and server s
18e0: 68 6f 75 6c 64 20 72 65 6d 65 6d 62 65 72 20 64  hould remember d
18f0: 65 6c 74 61 73 0a 61 6e 64 20 62 65 20 61 62 6c  eltas.and be abl
1900: 65 20 74 6f 20 61 70 70 6c 79 20 74 68 65 6d 20  e to apply them 
1910: 77 68 65 6e 20 74 68 65 69 72 20 73 6f 75 72 63  when their sourc
1920: 65 20 61 72 72 69 76 65 73 2e 3c 2f 70 3e 0a 0a  e arrives.</p>..
1930: 3c 68 33 3e 32 2e 34 20 50 75 73 68 20 61 6e 64  <h3>2.4 Push and
1940: 20 50 75 6c 6c 20 43 61 72 64 73 3c 2f 68 33 3e   Pull Cards</h3>
1950: 0a 0a 3c 70 3e 41 6d 6f 6e 67 20 6f 66 20 74 68  ..<p>Among of th
1960: 65 20 66 69 72 73 74 20 63 61 72 64 73 20 69 6e  e first cards in
1970: 20 61 20 63 6c 69 65 6e 74 2d 74 6f 2d 73 65 72   a client-to-ser
1980: 76 65 72 20 6d 65 73 73 61 67 65 20 61 72 65 0a  ver message are.
1990: 74 68 65 20 70 75 73 68 20 61 6e 64 20 70 75 6c  the push and pul
19a0: 6c 20 63 61 72 64 73 2e 20 20 54 68 65 20 70 75  l cards.  The pu
19b0: 73 68 20 63 61 72 64 20 74 65 6c 6c 20 74 68 65  sh card tell the
19c0: 20 73 65 72 76 65 72 20 74 68 61 74 0a 74 68 65   server that.the
19d0: 20 63 6c 69 65 6e 74 20 69 73 20 70 75 73 68 69   client is pushi
19e0: 6e 67 20 63 6f 6e 74 65 6e 74 2e 20 20 54 68 65  ng content.  The
19f0: 20 70 75 6c 6c 20 63 61 72 64 20 74 65 6c 6c 20   pull card tell 
1a00: 74 68 65 20 73 65 72 76 65 72 0a 74 68 61 74 20  the server.that 
1a10: 74 68 65 20 63 6c 69 65 6e 74 20 77 61 6e 74 73  the client wants
1a20: 20 74 6f 20 70 75 6c 6c 20 63 6f 6e 74 65 6e 74   to pull content
1a30: 2e 20 20 49 6e 20 74 68 65 20 65 76 65 6e 74 20  .  In the event 
1a40: 6f 66 20 61 20 73 79 6e 63 2c 0a 62 6f 74 68 20  of a sync,.both 
1a50: 63 61 72 64 73 20 61 72 65 20 73 65 6e 74 2e 20  cards are sent. 
1a60: 20 54 68 65 20 66 6f 72 6d 61 74 20 69 73 20 61   The format is a
1a70: 73 20 66 6f 6c 6c 6f 77 73 3a 3c 2f 70 3e 0a 0a  s follows:</p>..
1a80: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e  <blockquote>.<b>
1a90: 70 75 73 68 3c 2f 62 3e 20 3c 69 3e 73 65 72 76  push</b> <i>serv
1aa0: 65 72 63 6f 64 65 20 70 72 6f 6a 65 63 74 63 6f  ercode projectco
1ab0: 64 65 3c 2f 69 3e 3c 62 72 3e 0a 3c 62 3e 70 75  de</i><br>.<b>pu
1ac0: 6c 6c 3c 2f 62 3e 20 3c 69 3e 73 65 72 76 65 72  ll</b> <i>server
1ad0: 63 6f 64 65 20 70 72 6f 6a 65 63 74 63 6f 64 65  code projectcode
1ae0: 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  </i>.</blockquot
1af0: 65 3e 0a 0a 3c 70 3e 54 68 65 20 3c 69 3e 73 65  e>..<p>The <i>se
1b00: 72 76 65 72 63 6f 64 65 3c 2f 69 3e 20 61 72 67  rvercode</i> arg
1b10: 75 6d 65 6e 74 20 69 73 20 74 68 65 20 72 65 70  ument is the rep
1b20: 6f 73 69 74 6f 72 79 20 49 44 20 66 6f 72 20 74  ository ID for t
1b30: 68 65 0a 63 6c 69 65 6e 74 2e 20 20 54 68 65 20  he.client.  The 
1b40: 73 65 72 76 65 72 20 77 69 6c 6c 20 6f 6e 6c 79  server will only
1b50: 20 61 6c 6c 6f 77 20 74 68 65 20 74 72 61 6e 73   allow the trans
1b60: 61 63 74 69 6f 6e 20 74 6f 20 70 72 6f 63 65 65  action to procee
1b70: 64 0a 69 66 20 74 68 65 20 73 65 72 76 65 72 63  d.if the serverc
1b80: 6f 64 65 20 69 73 20 64 69 66 66 65 72 65 6e 74  ode is different
1b90: 20 66 72 6f 6d 20 69 74 73 20 6f 77 6e 20 73 65   from its own se
1ba0: 72 76 65 72 63 6f 64 65 2e 20 20 54 68 69 73 0a  rvercode.  This.
1bb0: 70 72 65 76 65 6e 74 73 20 61 20 73 79 6e 63 2d  prevents a sync-
1bc0: 6c 6f 6f 70 2e 20 20 54 68 65 20 3c 69 3e 70 72  loop.  The <i>pr
1bd0: 6f 6a 65 63 74 63 6f 64 65 3c 2f 69 3e 20 69 73  ojectcode</i> is
1be0: 20 74 68 65 20 69 64 65 6e 74 69 66 69 65 72 0a   the identifier.
1bf0: 6f 66 20 74 68 65 20 73 6f 66 74 77 61 72 65 20  of the software 
1c00: 70 72 6f 6a 65 63 74 20 74 68 61 74 20 74 68 65  project that the
1c10: 20 63 6c 69 65 6e 74 20 72 65 70 6f 73 69 74 6f   client reposito
1c20: 72 79 20 63 6f 6e 74 61 69 6e 73 2e 0a 54 68 65  ry contains..The
1c30: 20 70 72 6f 6a 65 63 74 63 6f 64 65 20 66 6f 72   projectcode for
1c40: 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20   the client and 
1c50: 73 65 72 76 65 72 20 6d 75 73 74 20 6d 61 74 63  server must matc
1c60: 68 20 69 6e 20 6f 72 64 65 72 0a 66 6f 72 20 74  h in order.for t
1c70: 68 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 74  he transaction t
1c80: 6f 20 70 72 6f 63 65 65 64 2e 3c 2f 70 3e 0a 0a  o proceed.</p>..
1c90: 3c 70 3e 54 68 65 20 73 65 72 76 65 72 20 77 69  <p>The server wi
1ca0: 6c 6c 20 61 6c 73 6f 20 73 65 6e 64 20 61 20 70  ll also send a p
1cb0: 75 73 68 20 63 61 72 64 20 62 61 63 6b 20 74 6f  ush card back to
1cc0: 20 74 68 65 20 63 6c 69 65 6e 74 0a 64 75 72 69   the client.duri
1cd0: 6e 67 20 61 20 63 6c 6f 6e 65 2e 20 20 54 68 69  ng a clone.  Thi
1ce0: 73 20 69 73 20 68 6f 77 20 74 68 65 20 63 6c 69  s is how the cli
1cf0: 65 6e 74 20 64 65 74 65 72 6d 69 6e 65 73 20 77  ent determines w
1d00: 68 61 74 20 70 72 6f 6a 65 63 74 0a 63 6f 64 65  hat project.code
1d10: 20 74 6f 20 70 75 74 20 69 6e 20 74 68 65 20 6e   to put in the n
1d20: 65 77 20 72 65 70 6f 73 69 74 6f 72 79 20 69 74  ew repository it
1d30: 20 69 73 20 63 6f 6e 73 74 72 75 63 74 69 6e 67   is constructing
1d40: 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 35 20 43  .</p>..<h3>2.5 C
1d50: 6c 6f 6e 65 20 43 61 72 64 73 3c 2f 68 33 3e 0a  lone Cards</h3>.
1d60: 0a 3c 70 3e 41 20 63 6c 6f 6e 65 20 63 61 72 64  .<p>A clone card
1d70: 20 77 6f 72 6b 73 20 6c 69 6b 65 20 61 20 70 75   works like a pu
1d80: 6c 6c 20 63 61 72 64 20 69 6e 20 74 68 61 74 20  ll card in that 
1d90: 69 74 20 69 73 20 73 65 6e 74 20 66 72 6f 6d 0a  it is sent from.
1da0: 63 6c 69 65 6e 74 20 74 6f 20 73 65 72 76 65 72  client to server
1db0: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 74 65 6c   in order to tel
1dc0: 6c 20 74 68 65 20 73 65 72 76 65 72 20 74 68 61  l the server tha
1dd0: 74 20 74 68 65 20 63 6c 69 65 6e 74 0a 77 61 6e  t the client.wan
1de0: 74 73 20 74 6f 20 70 75 6c 6c 20 63 6f 6e 74 65  ts to pull conte
1df0: 6e 74 2e 20 20 42 75 74 20 75 6e 6c 69 6b 65 20  nt.  But unlike 
1e00: 74 68 65 20 70 75 6c 6c 20 63 61 72 64 2c 20 74  the pull card, t
1e10: 68 65 20 63 6c 6f 6e 65 0a 63 61 72 64 20 68 61  he clone.card ha
1e20: 73 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 2e 3c  s no arguments.<
1e30: 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  /p>..<blockquote
1e40: 3e 0a 3c 62 3e 63 6c 6f 6e 65 3c 2f 62 3e 0a 3c  >.<b>clone</b>.<
1e50: 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70  /blockquote>..<p
1e60: 3e 49 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20  >In response to 
1e70: 61 20 63 6c 6f 6e 65 20 6d 65 73 73 61 67 65 2c  a clone message,
1e80: 20 74 68 65 20 73 65 72 76 65 72 20 61 6c 73 6f   the server also
1e90: 20 73 65 6e 64 73 20 74 68 65 20 63 6c 69 65 6e   sends the clien
1ea0: 74 0a 61 20 70 75 73 68 20 6d 65 73 73 61 67 65  t.a push message
1eb0: 20 73 6f 20 74 68 61 74 20 74 68 65 20 63 6c 69   so that the cli
1ec0: 65 6e 74 20 63 61 6e 20 64 69 73 63 6f 76 65 72  ent can discover
1ed0: 20 74 68 65 20 70 72 6f 6a 65 63 74 63 6f 64 65   the projectcode
1ee0: 20 66 6f 72 0a 74 68 69 73 20 70 72 6f 6a 65 63   for.this projec
1ef0: 74 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 36 20  t.</p>..<h3>2.6 
1f00: 49 67 6f 74 20 43 61 72 64 73 3c 2f 68 33 3e 0a  Igot Cards</h3>.
1f10: 0a 3c 70 3e 41 6e 20 69 67 6f 74 20 63 61 72 64  .<p>An igot card
1f20: 20 63 61 6e 20 62 65 20 73 65 6e 74 20 66 72 6f   can be sent fro
1f30: 6d 20 65 69 74 68 65 72 20 63 6c 69 65 6e 74 20  m either client 
1f40: 74 6f 20 73 65 72 76 65 72 20 6f 72 20 66 72 6f  to server or fro
1f50: 6d 0a 73 65 72 76 65 72 20 74 6f 20 63 6c 69 65  m.server to clie
1f60: 6e 74 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 69  nt in order to i
1f70: 6e 64 69 63 61 74 65 20 74 68 61 74 20 74 68 65  ndicate that the
1f80: 20 73 65 6e 64 65 72 20 68 6f 6c 64 73 20 61 20   sender holds a 
1f90: 63 6f 70 79 0a 6f 66 20 61 20 70 61 72 74 69 63  copy.of a partic
1fa0: 75 6c 61 72 20 66 69 6c 65 2e 20 20 54 68 65 20  ular file.  The 
1fb0: 66 6f 72 6d 61 74 20 69 73 3a 3c 2f 70 3e 0a 0a  format is:</p>..
1fc0: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e  <blockquote>.<b>
1fd0: 69 67 6f 74 3c 2f 62 3e 20 3c 69 3e 75 75 69 64  igot</b> <i>uuid
1fe0: 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  </i>.</blockquot
1ff0: 65 3e 0a 0a 3c 70 3e 54 68 65 20 61 72 67 75 6d  e>..<p>The argum
2000: 65 6e 74 20 6f 66 20 74 68 65 20 69 67 6f 74 20  ent of the igot 
2010: 63 61 72 64 20 69 73 20 74 68 65 20 55 55 49 44  card is the UUID
2020: 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 68 61   of the file tha
2030: 74 0a 74 68 65 20 73 65 6e 64 65 72 20 70 6f 73  t.the sender pos
2040: 73 65 73 73 65 73 2e 0a 54 68 65 20 72 65 63 65  sesses..The rece
2050: 69 76 65 72 20 6f 66 20 61 6e 20 69 67 6f 74 20  iver of an igot 
2060: 63 61 72 64 20 77 69 6c 6c 20 74 79 70 69 63 61  card will typica
2070: 6c 6c 79 20 63 68 65 63 6b 20 74 6f 20 73 65 65  lly check to see
2080: 20 69 66 0a 69 74 20 61 6c 73 6f 20 68 6f 6c 64   if.it also hold
2090: 73 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 20  s the same file 
20a0: 61 6e 64 20 69 66 20 6e 6f 74 20 69 74 20 77 69  and if not it wi
20b0: 6c 6c 20 72 65 71 75 65 73 74 20 74 68 65 20 66  ll request the f
20c0: 69 6c 65 0a 75 73 69 6e 67 20 61 20 67 69 6d 6d  ile.using a gimm
20d0: 65 20 63 61 72 64 20 69 6e 20 65 69 74 68 65 72  e card in either
20e0: 20 74 68 65 20 72 65 70 6c 79 20 6f 72 20 69 6e   the reply or in
20f0: 20 74 68 65 20 6e 65 78 74 20 6d 65 73 73 61 67   the next messag
2100: 65 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 37 20  e.</p>..<h3>2.7 
2110: 47 69 6d 6d 65 20 43 61 72 64 73 3c 2f 68 33 3e  Gimme Cards</h3>
2120: 0a 0a 3c 70 3e 41 20 67 69 6d 6d 65 20 63 61 72  ..<p>A gimme car
2130: 64 20 69 73 20 73 65 6e 74 20 66 72 6f 6d 20 65  d is sent from e
2140: 69 74 68 65 72 20 63 6c 69 65 6e 74 20 74 6f 20  ither client to 
2150: 73 65 72 76 65 72 20 6f 72 20 66 72 6f 6d 20 73  server or from s
2160: 65 72 76 65 72 0a 74 6f 20 63 6c 69 65 6e 74 2e  erver.to client.
2170: 20 20 54 68 65 20 67 69 6d 6d 65 20 63 61 72 64    The gimme card
2180: 20 61 73 6b 73 20 74 68 65 20 72 65 63 65 69 76   asks the receiv
2190: 65 72 20 74 6f 20 73 65 6e 64 20 61 20 70 61 72  er to send a par
21a0: 74 69 63 75 6c 61 72 0a 66 69 6c 65 20 62 61 63  ticular.file bac
21b0: 6b 20 74 6f 20 74 68 65 20 73 65 6e 64 65 72 2e  k to the sender.
21c0: 20 20 54 68 65 20 66 6f 72 6d 61 74 20 6f 66 20    The format of 
21d0: 61 20 67 69 6d 6d 65 20 63 61 72 64 20 69 73 20  a gimme card is 
21e0: 74 68 69 73 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63  this:</p>..<bloc
21f0: 6b 71 75 6f 74 65 3e 0a 3c 62 3e 67 69 6d 6d 65  kquote>.<b>gimme
2200: 3c 2f 62 3e 20 3c 69 3e 75 75 69 64 3c 2f 69 3e  </b> <i>uuid</i>
2210: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  .</blockquote>..
2220: 3c 70 3e 54 68 65 20 61 72 67 75 6d 65 6e 74 20  <p>The argument 
2230: 74 6f 20 74 68 65 20 67 69 6d 6d 65 20 63 61 72  to the gimme car
2240: 64 20 69 73 20 74 68 65 20 55 55 49 44 20 6f 66  d is the UUID of
2250: 20 74 68 65 20 66 69 6c 65 20 74 68 61 74 0a 74   the file that.t
2260: 68 65 20 73 65 6e 64 65 72 20 77 61 6e 74 73 2e  he sender wants.
2270: 20 20 54 68 65 20 72 65 63 65 69 76 65 72 20 77    The receiver w
2280: 69 6c 6c 20 74 79 70 69 63 61 6c 6c 79 20 72 65  ill typically re
2290: 73 70 6f 6e 64 20 74 6f 20 61 0a 67 69 6d 6d 65  spond to a.gimme
22a0: 20 63 61 72 64 20 62 79 20 73 65 6e 64 69 6e 67   card by sending
22b0: 20 61 20 66 69 6c 65 20 63 61 72 64 20 69 6e 20   a file card in 
22c0: 69 74 73 20 72 65 70 6c 79 20 6f 72 20 69 6e 20  its reply or in 
22d0: 74 68 65 20 6e 65 78 74 0a 6d 65 73 73 61 67 65  the next.message
22e0: 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 38 20 43  .</p>..<h3>2.8 C
22f0: 6f 6f 6b 69 65 20 43 61 72 64 73 3c 2f 68 33 3e  ookie Cards</h3>
2300: 0a 0a 3c 70 3e 41 20 63 6f 6f 6b 69 65 20 63 61  ..<p>A cookie ca
2310: 72 64 20 63 61 6e 20 62 65 20 75 73 65 64 20 62  rd can be used b
2320: 79 20 61 20 73 65 72 76 65 72 20 74 6f 20 72 65  y a server to re
2330: 63 6f 72 64 20 61 20 73 6d 61 6c 6c 20 61 6d 6f  cord a small amo
2340: 75 6e 74 0a 6f 66 20 73 74 61 74 65 20 69 6e 66  unt.of state inf
2350: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 61 20 63 6c  ormation on a cl
2360: 69 65 6e 74 2e 20 20 54 68 65 20 73 65 72 76 65  ient.  The serve
2370: 72 20 73 65 6e 64 73 20 61 20 63 6f 6f 6b 69 65  r sends a cookie
2380: 20 74 6f 20 74 68 65 0a 63 6c 69 65 6e 74 2e 20   to the.client. 
2390: 20 54 68 65 20 63 6c 69 65 6e 74 20 73 65 6e 64   The client send
23a0: 73 20 74 68 65 20 73 61 6d 65 20 63 6f 6f 6b 69  s the same cooki
23b0: 65 20 62 61 63 6b 20 74 6f 20 74 68 65 20 73 65  e back to the se
23c0: 72 76 65 72 20 6f 6e 0a 69 74 73 20 6e 65 78 74  rver on.its next
23d0: 20 72 65 71 75 65 73 74 2e 20 20 54 68 65 20 63   request.  The c
23e0: 6f 6f 6b 69 65 20 63 61 72 64 20 68 61 73 20 61  ookie card has a
23f0: 20 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74   single argument
2400: 20 77 68 69 63 68 0a 69 73 20 69 74 73 20 70 61   which.is its pa
2410: 79 6c 6f 61 64 2e 3c 2f 70 3e 0a 0a 3c 62 6c 6f  yload.</p>..<blo
2420: 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 63 6f 6f 6b  ckquote>.<b>cook
2430: 69 65 3c 2f 62 3e 20 3c 69 3e 70 61 79 6c 6f 61  ie</b> <i>payloa
2440: 64 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f  d</i>.</blockquo
2450: 74 65 3e 0a 0a 3c 70 3e 54 68 65 20 63 6c 69 65  te>..<p>The clie
2460: 6e 74 20 69 73 20 6e 6f 74 20 72 65 71 75 69 72  nt is not requir
2470: 65 64 20 74 6f 20 72 65 74 75 72 6e 20 74 68 65  ed to return the
2480: 20 63 6f 6f 6b 69 65 20 74 6f 20 74 68 65 20 73   cookie to the s
2490: 65 72 76 65 72 20 6f 6e 0a 69 74 73 20 6e 65 78  erver on.its nex
24a0: 74 20 72 65 71 75 65 73 74 2e 20 20 4f 72 20 74  t request.  Or t
24b0: 68 65 20 63 6c 69 65 6e 74 20 6d 69 67 68 74 20  he client might 
24c0: 73 65 6e 64 20 61 20 63 6f 6f 6b 69 65 20 66 72  send a cookie fr
24d0: 6f 6d 20 61 20 64 69 66 66 65 72 65 6e 74 0a 73  om a different.s
24e0: 65 72 76 65 72 20 6f 6e 20 74 68 65 20 6e 65 78  erver on the nex
24f0: 74 20 72 65 71 75 65 73 74 2e 20 20 53 6f 20 74  t request.  So t
2500: 68 65 20 73 65 72 76 65 72 20 6d 75 73 74 20 6e  he server must n
2510: 6f 74 20 64 65 70 65 6e 64 20 6f 6e 20 74 68 65  ot depend on the
2520: 0a 63 6f 6f 6b 69 65 20 61 6e 64 20 74 68 65 20  .cookie and the 
2530: 73 65 72 76 65 72 20 6d 75 73 74 20 73 74 72 75  server must stru
2540: 63 74 75 72 65 20 74 68 65 20 63 6f 6f 6b 69 65  cture the cookie
2550: 20 70 61 79 6c 6f 61 64 20 69 6e 20 73 75 63 68   payload in such
2560: 0a 61 20 77 61 79 20 74 68 61 74 20 69 74 20 63  .a way that it c
2570: 61 6e 20 74 65 6c 6c 20 69 66 20 74 68 65 20 63  an tell if the c
2580: 6f 6f 6b 69 65 20 69 74 20 73 65 65 73 20 69 73  ookie it sees is
2590: 20 69 74 73 20 6f 77 6e 20 63 6f 6f 6b 69 65 20   its own cookie 
25a0: 6f 72 0a 61 20 63 6f 6f 6b 69 65 20 66 72 6f 6d  or.a cookie from
25b0: 20 61 6e 6f 74 68 65 72 20 73 65 72 76 65 72 2e   another server.
25c0: 20 20 28 54 79 70 69 63 61 6c 6c 79 20 74 68 65    (Typically the
25d0: 20 73 65 72 76 65 72 20 77 69 6c 6c 20 65 6d 62   server will emb
25e0: 65 64 0a 69 74 73 20 73 65 72 76 65 72 63 6f 64  ed.its servercod
25f0: 65 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65  e as part of the
2600: 20 63 6f 6f 6b 69 65 2e 29 3c 2f 70 3e 0a 0a 3c   cookie.)</p>..<
2610: 68 33 3e 32 2e 39 20 45 72 72 6f 72 20 43 61 72  h3>2.9 Error Car
2620: 64 73 3c 2f 68 33 3e 0a 0a 3c 70 3e 49 66 20 74  ds</h3>..<p>If t
2630: 68 65 20 73 65 72 76 65 72 20 64 69 73 63 6f 76  he server discov
2640: 65 72 73 20 61 6e 79 74 68 69 6e 67 20 77 72 6f  ers anything wro
2650: 6e 67 20 77 69 74 68 20 61 20 72 65 71 75 65 73  ng with a reques
2660: 74 2c 20 69 74 20 67 65 6e 65 72 61 74 65 73 0a  t, it generates.
2670: 61 6e 20 65 72 72 6f 72 20 63 61 72 64 20 69 6e  an error card in
2680: 20 69 74 73 20 72 65 70 6c 79 2e 20 20 57 68 65   its reply.  Whe
2690: 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 73 65 65  n the client see
26a0: 73 20 74 68 65 20 65 72 72 6f 72 20 63 61 72 64  s the error card
26b0: 2c 0a 69 74 20 64 69 73 70 6c 61 79 73 20 61 6e  ,.it displays an
26c0: 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 74   error message t
26d0: 6f 20 74 68 65 20 75 73 65 72 20 61 6e 64 20 61  o the user and a
26e0: 62 6f 72 74 73 20 74 68 65 20 73 79 6e 63 0a 6f  borts the sync.o
26f0: 70 65 72 61 74 69 6f 6e 2e 20 20 41 6e 20 65 72  peration.  An er
2700: 72 6f 72 20 63 61 72 64 20 6c 6f 6f 6b 73 20 6c  ror card looks l
2710: 69 6b 65 20 74 68 69 73 3a 3c 2f 70 3e 0a 0a 3c  ike this:</p>..<
2720: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 65  blockquote>.<b>e
2730: 72 72 6f 72 3c 2f 62 3e 20 3c 69 3e 65 72 72 6f  rror</b> <i>erro
2740: 72 2d 6d 65 73 73 61 67 65 3c 2f 69 3e 0a 3c 2f  r-message</i>.</
2750: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70 3e  blockquote>..<p>
2760: 54 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67  The error messag
2770: 65 20 69 73 20 45 6e 67 6c 69 73 68 20 74 65 78  e is English tex
2780: 74 20 74 68 61 74 20 69 73 20 65 6e 63 6f 64 65  t that is encode
2790: 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 0a 62 65  d in order to.be
27a0: 20 61 20 73 69 6e 67 6c 65 20 74 6f 6b 65 6e 2e   a single token.
27b0: 0a 41 20 73 70 61 63 65 20 28 41 53 43 49 49 20  .A space (ASCII 
27c0: 30 78 32 30 29 20 69 73 20 72 65 70 72 65 73 65  0x20) is represe
27d0: 6e 74 65 64 20 61 73 20 22 5c 73 22 20 28 41 53  nted as "\s" (AS
27e0: 43 49 49 20 30 78 35 43 2c 20 30 78 37 33 29 2e  CII 0x5C, 0x73).
27f0: 20 20 41 0a 6e 65 77 6c 69 6e 65 20 28 41 53 43    A.newline (ASC
2800: 49 49 20 30 78 30 61 29 20 69 73 20 22 5c 6e 22  II 0x0a) is "\n"
2810: 20 28 41 53 43 49 49 20 30 78 36 43 2c 20 78 36   (ASCII 0x6C, x6
2820: 45 29 2e 20 20 41 20 62 61 63 6b 73 6c 61 73 68  E).  A backslash
2830: 20 0a 28 41 53 43 49 49 20 30 78 35 43 29 20 69   .(ASCII 0x5C) i
2840: 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73  s represented as
2850: 20 74 77 6f 20 62 61 63 6b 73 6c 61 73 68 65 73   two backslashes
2860: 20 22 5c 5c 22 2e 20 20 41 70 61 72 74 20 66 72   "\\".  Apart fr
2870: 6f 6d 0a 73 70 61 63 65 20 61 6e 64 20 6e 65 77  om.space and new
2880: 6c 69 6e 65 2c 20 6e 6f 20 6f 74 68 65 72 20 77  line, no other w
2890: 68 69 74 65 73 70 61 63 65 20 63 68 61 72 61 63  hitespace charac
28a0: 74 65 72 73 20 6e 6f 72 20 61 6e 79 0a 75 6e 70  ters nor any.unp
28b0: 72 69 6e 74 61 62 6c 65 20 63 68 61 72 61 63 74  rintable charact
28c0: 65 72 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20  ers are allowed 
28d0: 69 6e 0a 74 68 65 20 65 72 72 6f 72 20 6d 65 73  in.the error mes
28e0: 73 61 67 65 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32  sage.</p>..<h3>2
28f0: 2e 31 30 20 55 6e 6b 6e 6f 77 6e 20 43 61 72 64  .10 Unknown Card
2900: 73 3c 2f 68 33 3e 0a 0a 3c 70 3e 49 66 20 65 69  s</h3>..<p>If ei
2910: 74 68 65 72 20 74 68 65 20 63 6c 69 65 6e 74 20  ther the client 
2920: 6f 72 20 74 68 65 20 73 65 72 76 65 72 20 73 65  or the server se
2930: 65 73 20 61 20 63 61 72 64 20 74 68 61 74 20 69  es a card that i
2940: 73 20 6e 6f 74 0a 64 65 73 63 72 69 62 65 64 20  s not.described 
2950: 61 62 6f 76 65 2c 20 74 68 65 6e 20 69 74 20 67  above, then it g
2960: 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f  enerates an erro
2970: 72 20 61 6e 64 20 61 62 6f 72 74 73 2e 3c 2f 70  r and aborts.</p
2980: 3e 0a 0a 3c 68 32 3e 33 2e 30 20 50 68 61 6e 74  >..<h2>3.0 Phant
2990: 6f 6d 73 20 41 6e 64 20 43 6c 75 73 74 65 72 73  oms And Clusters
29a0: 3c 2f 68 32 3e 0a 0a 3c 70 3e 57 68 65 6e 20 61  </h2>..<p>When a
29b0: 20 72 65 70 6f 73 69 74 6f 72 79 20 6b 6e 6f 77   repository know
29c0: 73 20 74 68 61 74 20 61 20 66 69 6c 65 20 65 78  s that a file ex
29d0: 69 73 74 73 20 61 6e 64 20 6b 6e 6f 77 73 20 74  ists and knows t
29e0: 68 65 20 55 55 49 44 20 6f 66 0a 74 68 61 74 20  he UUID of.that 
29f0: 66 69 6c 65 2c 20 62 75 74 20 69 74 20 64 6f 65  file, but it doe
2a00: 73 20 6e 6f 74 20 6b 6e 6f 77 20 74 68 65 20 66  s not know the f
2a10: 69 6c 65 20 63 6f 6e 74 65 6e 74 2c 20 74 68 65  ile content, the
2a20: 6e 20 69 74 20 73 74 6f 72 65 73 20 74 68 61 74  n it stores that
2a30: 0a 66 69 6c 65 20 61 73 20 61 20 22 70 68 61 6e  .file as a "phan
2a40: 74 6f 6d 22 2e 20 20 41 20 72 65 70 6f 73 69 74  tom".  A reposit
2a50: 6f 72 79 20 77 69 6c 6c 20 74 79 70 69 63 61 6c  ory will typical
2a60: 6c 79 20 63 72 65 61 74 65 20 61 20 70 68 61 6e  ly create a phan
2a70: 74 6f 6d 20 77 68 65 6e 0a 69 74 20 72 65 63 65  tom when.it rece
2a80: 69 76 65 73 20 61 6e 20 69 67 6f 74 20 63 61 72  ives an igot car
2a90: 64 20 66 6f 72 20 61 20 66 69 6c 65 20 74 68 61  d for a file tha
2aa0: 74 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 68 6f  t it does not ho
2ab0: 6c 64 20 6f 72 20 77 68 65 6e 20 69 74 0a 72 65  ld or when it.re
2ac0: 63 65 69 76 65 73 20 61 20 66 69 6c 65 20 63 61  ceives a file ca
2ad0: 72 64 20 74 68 61 74 20 72 65 66 65 72 65 6e 63  rd that referenc
2ae0: 65 73 20 61 20 64 65 6c 74 61 20 73 6f 75 72 63  es a delta sourc
2af0: 65 20 74 68 61 74 20 69 74 20 64 6f 65 73 20 6e  e that it does n
2b00: 6f 74 0a 68 6f 6c 64 2e 20 20 57 68 65 6e 20 61  ot.hold.  When a
2b10: 20 73 65 72 76 65 72 20 69 73 20 67 65 6e 65 72   server is gener
2b20: 61 74 69 6e 67 20 69 74 73 20 72 65 70 6c 79 20  ating its reply 
2b30: 6f 72 20 77 68 65 6e 20 61 20 63 6c 69 65 6e 74  or when a client
2b40: 20 69 73 0a 67 65 6e 65 72 61 74 69 6e 67 20 61   is.generating a
2b50: 20 6e 65 77 20 72 65 71 75 65 73 74 2c 20 69 74   new request, it
2b60: 20 77 69 6c 6c 20 75 73 75 61 6c 6c 79 20 73 65   will usually se
2b70: 6e 64 20 67 69 6d 6d 65 20 63 61 72 64 73 20 66  nd gimme cards f
2b80: 6f 72 20 65 76 65 72 79 0a 70 68 61 6e 74 6f 6d  or every.phantom
2b90: 20 74 68 61 74 20 69 74 20 68 6f 6c 64 73 2e 3c   that it holds.<
2ba0: 2f 70 3e 0a 0a 3c 70 3e 41 20 63 6c 75 73 74 65  /p>..<p>A cluste
2bb0: 72 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 66  r is a special f
2bc0: 69 6c 65 20 74 68 61 74 20 74 65 6c 6c 73 20 6f  ile that tells o
2bd0: 66 20 74 68 65 20 65 78 69 73 74 61 6e 63 65 20  f the existance 
2be0: 6f 66 20 6f 74 68 65 72 0a 66 69 6c 65 73 2e 20  of other.files. 
2bf0: 20 41 6e 79 20 66 69 6c 65 20 69 6e 20 74 68 65   Any file in the
2c00: 20 72 65 70 6f 73 69 74 6f 72 79 20 74 68 61 74   repository that
2c10: 20 66 6f 6c 6c 6f 77 73 20 74 68 65 20 73 79 6e   follows the syn
2c20: 74 61 63 74 69 63 20 72 75 6c 65 73 0a 6f 66 20  tactic rules.of 
2c30: 61 20 63 6c 75 73 74 65 72 20 69 73 20 63 6f 6e  a cluster is con
2c40: 73 69 64 65 72 65 64 20 61 20 63 6c 75 73 74 65  sidered a cluste
2c50: 72 2e 3c 2f 70 3e 0a 0a 3c 70 3e 41 20 63 6c 75  r.</p>..<p>A clu
2c60: 73 74 65 72 20 63 6f 6e 73 69 73 74 73 20 69 73  ster consists is
2c70: 20 61 20 6c 69 6e 65 20 6f 72 69 65 6e 74 65 64   a line oriented
2c80: 20 66 69 6c 65 2e 20 20 45 61 63 68 20 6c 69 6e   file.  Each lin
2c90: 65 20 6f 66 20 61 20 63 6c 75 73 74 65 72 0a 69  e of a cluster.i
2ca0: 73 20 61 20 63 61 72 64 2e 20 20 54 68 65 20 63  s a card.  The c
2cb0: 61 72 64 73 20 61 72 65 20 73 65 70 61 72 61 74  ards are separat
2cc0: 65 64 20 62 79 20 74 68 65 20 6e 65 77 6c 69 6e  ed by the newlin
2cd0: 65 20 28 22 5c 6e 22 29 20 63 68 61 72 61 63 74  e ("\n") charact
2ce0: 65 72 2e 0a 45 61 63 68 20 63 61 72 64 20 63 6f  er..Each card co
2cf0: 6e 73 69 73 74 73 20 6f 66 20 61 20 73 69 6e 67  nsists of a sing
2d00: 6c 65 20 63 68 61 72 61 63 74 65 72 20 63 61 72  le character car
2d10: 64 20 74 79 70 65 2c 20 61 20 73 70 61 63 65 2c  d type, a space,
2d20: 20 61 6e 64 20 61 0a 73 69 6e 67 6c 65 20 61 72   and a.single ar
2d30: 67 75 6d 65 6e 74 2e 20 20 4e 6f 20 65 78 74 72  gument.  No extr
2d40: 61 20 77 68 69 74 65 73 70 61 63 65 20 61 6e 64  a whitespace and
2d50: 20 6e 6f 20 74 72 61 69 6c 69 6e 67 20 6f 72 20   no trailing or 
2d60: 6c 65 61 64 69 6e 67 0a 77 68 69 74 65 73 70 61  leading.whitespa
2d70: 63 65 20 69 73 20 61 6c 6c 6f 77 65 64 2e 20 20  ce is allowed.  
2d80: 41 6c 6c 20 63 61 72 64 73 20 69 6e 20 74 68 65  All cards in the
2d90: 20 63 6c 75 73 74 65 72 20 6d 75 73 74 20 6f 63   cluster must oc
2da0: 63 75 72 20 69 6e 0a 73 74 72 69 63 74 20 6c 65  cur in.strict le
2db0: 78 69 67 72 61 70 68 69 63 61 6c 20 6f 72 64 65  xigraphical orde
2dc0: 72 2e 3c 2f 70 3e 0a 0a 3c 70 3e 41 20 63 6c 75  r.</p>..<p>A clu
2dd0: 73 74 65 72 20 63 6f 6e 73 69 73 74 73 20 6f 66  ster consists of
2de0: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 22 4d 22   one or more "M"
2df0: 20 63 61 72 64 73 20 66 6f 6c 6c 6f 77 65 64 20   cards followed 
2e00: 62 79 20 61 20 73 69 6e 67 6c 65 0a 22 5a 22 20  by a single."Z" 
2e10: 63 61 72 64 2e 20 20 45 61 63 68 20 4d 20 63 61  card.  Each M ca
2e20: 72 64 20 68 6f 6c 64 73 20 61 6e 20 61 72 67 75  rd holds an argu
2e30: 6d 65 6e 74 20 77 68 69 63 68 20 69 73 20 61 20  ment which is a 
2e40: 55 55 49 44 20 66 6f 72 20 61 20 66 69 6c 65 0a  UUID for a file.
2e50: 69 6e 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72  in the repositor
2e60: 79 2e 20 20 54 68 65 20 5a 20 63 61 72 64 20 68  y.  The Z card h
2e70: 61 73 20 61 20 73 69 6e 67 6c 65 20 61 72 67 75  as a single argu
2e80: 6d 65 6e 74 20 77 68 69 63 68 20 69 73 20 74 68  ment which is th
2e90: 65 0a 6c 6f 77 65 72 2d 63 61 73 65 20 68 65 78  e.lower-case hex
2ea0: 61 64 65 63 69 6d 61 6c 20 72 65 70 72 65 73 65  adecimal represe
2eb0: 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 4d  ntation of the M
2ec0: 44 35 20 63 68 65 63 6b 73 75 6d 20 6f 66 20 61  D5 checksum of a
2ed0: 6c 6c 0a 70 72 65 63 65 65 64 69 6e 67 20 4d 20  ll.preceeding M 
2ee0: 63 61 72 64 73 20 75 70 20 74 6f 20 61 6e 64 20  cards up to and 
2ef0: 69 6e 63 6c 75 64 65 64 20 74 68 65 20 6e 65 77  included the new
2f00: 6c 69 6e 65 20 63 68 61 72 61 63 74 65 72 20 74  line character t
2f10: 68 61 74 0a 6f 63 63 75 72 72 65 64 20 6a 75 73  hat.occurred jus
2f20: 74 20 62 65 66 6f 72 65 20 74 68 65 20 5a 20 74  t before the Z t
2f30: 68 61 74 20 73 74 61 72 74 73 20 74 68 65 20 5a  hat starts the Z
2f40: 20 63 61 72 64 2e 3c 2f 70 3e 0a 0a 3c 70 3e 41   card.</p>..<p>A
2f50: 6e 79 20 66 69 6c 65 20 74 68 61 74 20 64 6f 65  ny file that doe
2f60: 73 20 6e 6f 74 20 6d 61 74 63 68 20 74 68 65 20  s not match the 
2f70: 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 6f  specifications o
2f80: 66 20 61 20 63 6c 75 73 74 65 72 0a 65 78 61 63  f a cluster.exac
2f90: 74 6c 79 20 69 73 20 6e 6f 74 20 61 20 63 6c 75  tly is not a clu
2fa0: 73 74 65 72 2e 20 20 54 68 65 72 65 20 6d 75 73  ster.  There mus
2fb0: 74 20 62 65 20 6e 6f 20 65 78 74 72 61 20 77 68  t be no extra wh
2fc0: 69 74 65 73 70 61 63 65 20 69 6e 0a 74 68 65 20  itespace in.the 
2fd0: 66 69 6c 65 2e 20 20 54 68 65 72 65 20 6d 75 73  file.  There mus
2fe0: 74 20 62 65 20 6f 6e 65 20 6f 72 20 6d 6f 72 65  t be one or more
2ff0: 20 4d 20 63 61 72 64 73 2e 20 20 54 68 65 72 65   M cards.  There
3000: 20 6d 75 73 74 20 62 65 20 61 0a 73 69 6e 67 6c   must be a.singl
3010: 65 20 5a 20 63 61 72 64 20 77 69 74 68 20 61 20  e Z card with a 
3020: 63 6f 72 72 65 63 74 20 4d 44 35 20 63 68 65 63  correct MD5 chec
3030: 6b 73 75 6d 2e 20 20 41 6e 64 20 61 6c 6c 20 63  ksum.  And all c
3040: 61 72 64 73 20 6d 75 73 74 0a 62 65 20 69 6e 20  ards must.be in 
3050: 73 74 72 69 63 74 20 6c 65 78 69 67 72 61 70 68  strict lexigraph
3060: 69 63 61 6c 20 6f 72 64 65 72 2e 3c 2f 70 3e 0a  ical order.</p>.
3070: 0a 3c 68 33 3e 33 2e 31 20 54 68 65 20 55 6e 63  .<h3>3.1 The Unc
3080: 6c 75 73 74 65 72 65 64 20 54 61 62 6c 65 3c 2f  lustered Table</
3090: 68 33 3e 0a 0a 3c 70 3e 45 76 65 72 79 20 72 65  h3>..<p>Every re
30a0: 70 6f 73 69 74 6f 72 79 20 6d 61 69 6e 74 61 69  pository maintai
30b0: 6e 73 20 61 20 74 61 62 6c 65 20 6e 61 6d 65 64  ns a table named
30c0: 20 22 3c 62 3e 75 6e 63 6c 75 73 74 65 72 65 64   "<b>unclustered
30d0: 3c 2f 62 3e 22 0a 77 68 69 63 68 20 72 65 63 6f  </b>".which reco
30e0: 72 64 73 20 74 68 65 20 69 64 65 6e 74 69 66 79  rds the identify
30f0: 20 6f 66 20 65 76 65 72 79 20 66 69 6c 65 20 61   of every file a
3100: 6e 64 20 70 68 61 6e 74 6f 6d 20 69 74 20 68 6f  nd phantom it ho
3110: 6c 64 73 20 74 68 61 74 20 69 73 20 6e 6f 74 0a  lds that is not.
3120: 6d 65 6e 74 69 6f 6e 65 64 20 69 6e 20 61 20 63  mentioned in a c
3130: 6c 75 73 74 65 72 2e 20 20 54 68 65 20 65 6e 74  luster.  The ent
3140: 72 69 65 73 20 69 6e 20 74 68 65 20 75 6e 63 6c  ries in the uncl
3150: 75 73 74 65 72 65 64 20 74 61 62 6c 65 20 63 61  ustered table ca
3160: 6e 0a 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20  n.be thought of 
3170: 61 73 20 6c 65 61 76 65 73 20 6f 6e 20 61 20 74  as leaves on a t
3180: 72 65 65 20 6f 66 20 66 69 6c 65 73 2e 20 20 53  ree of files.  S
3190: 6f 6d 65 20 6f 66 20 74 68 65 20 75 6e 63 6c 75  ome of the unclu
31a0: 73 74 65 72 65 64 0a 66 69 6c 65 73 20 77 69 6c  stered.files wil
31b0: 6c 20 62 65 20 63 6c 75 73 74 65 72 73 2e 20 20  l be clusters.  
31c0: 54 68 6f 73 65 20 63 6c 75 73 74 65 72 73 20 6d  Those clusters m
31d0: 61 79 20 63 6f 6e 74 61 69 6e 20 6f 74 68 65 72  ay contain other
31e0: 20 63 6c 75 73 74 65 72 73 2c 0a 77 68 69 63 68   clusters,.which
31f0: 20 6d 69 67 68 74 20 63 6f 6e 74 61 69 6e 20 73   might contain s
3200: 74 69 6c 6c 20 6d 6f 72 65 20 63 6c 75 73 74 65  till more cluste
3210: 72 73 2c 20 61 6e 64 20 73 6f 20 66 6f 72 74 68  rs, and so forth
3220: 2e 20 20 42 65 67 69 6e 6e 69 6e 67 0a 77 69 74  .  Beginning.wit
3230: 68 20 74 68 65 20 66 69 6c 65 73 20 69 6e 20 74  h the files in t
3240: 68 65 20 75 6e 63 6c 75 73 74 65 72 65 64 20 74  he unclustered t
3250: 61 62 6c 65 2c 20 6f 6e 65 20 63 61 6e 20 66 6f  able, one can fo
3260: 6c 6c 6f 77 20 74 68 65 20 63 68 61 69 6e 0a 6f  llow the chain.o
3270: 66 20 63 6c 75 73 74 65 72 73 20 74 6f 20 66 69  f clusters to fi
3280: 6e 64 20 65 76 65 72 79 20 66 69 6c 65 20 69 6e  nd every file in
3290: 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72 79 2e   the repository.
32a0: 3c 2f 70 3e 0a 0a 3c 68 32 3e 34 2e 30 20 53 79  </p>..<h2>4.0 Sy
32b0: 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 20 53 74  nchronization St
32c0: 72 61 74 65 67 69 65 73 3c 2f 68 32 3e 0a 0a 3c  rategies</h2>..<
32d0: 68 33 3e 34 2e 31 20 50 75 6c 6c 3c 2f 68 33 3e  h3>4.1 Pull</h3>
32e0: 0a 0a 3c 70 3e 41 20 74 79 70 69 63 61 6c 20 70  ..<p>A typical p
32f0: 75 6c 6c 20 6f 70 65 72 61 74 69 6f 6e 20 70 72  ull operation pr
3300: 6f 63 65 65 64 73 20 61 73 20 73 68 6f 77 6e 20  oceeds as shown 
3310: 62 65 6c 6f 77 2e 20 20 44 65 74 61 69 6c 73 0a  below.  Details.
3320: 6f 66 20 74 68 65 20 61 63 74 75 61 6c 20 69 6d  of the actual im
3330: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6d 61 79  plementation may
3340: 20 76 65 72 79 20 73 6c 69 67 68 74 6c 79 20 62   very slightly b
3350: 75 74 20 74 68 65 20 67 69 73 74 20 6f 66 0a 61  ut the gist of.a
3360: 20 70 75 6c 6c 20 69 73 20 63 61 70 74 75 72 65   pull is capture
3370: 64 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69  d in the followi
3380: 6e 67 20 73 74 65 70 73 3a 3c 2f 70 3e 0a 0a 3c  ng steps:</p>..<
3390: 6f 6c 3e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65  ol>.<li>The clie
33a0: 6e 74 20 73 65 6e 64 73 20 6c 6f 67 69 6e 20 61  nt sends login a
33b0: 6e 64 20 70 75 6c 6c 20 63 61 72 64 73 2e 0a 3c  nd pull cards..<
33c0: 6c 69 3e 54 68 65 20 63 6c 69 65 6e 74 20 73 65  li>The client se
33d0: 6e 64 73 20 61 20 63 6f 6f 6b 69 65 20 63 61 72  nds a cookie car
33e0: 64 20 69 66 20 69 74 20 68 61 73 20 70 72 65 76  d if it has prev
33f0: 69 6f 75 73 6c 79 20 72 65 63 65 69 76 65 64 20  iously received 
3400: 61 20 63 6f 6f 6b 69 65 2e 0a 3c 6c 69 3e 54 68  a cookie..<li>Th
3410: 65 20 63 6c 69 65 6e 74 20 73 65 6e 64 73 20 67  e client sends g
3420: 69 6d 6d 65 20 63 61 72 64 73 20 66 6f 72 20 65  imme cards for e
3430: 76 65 72 79 20 70 68 61 6e 74 6f 6d 20 74 68 61  very phantom tha
3440: 74 20 69 74 20 68 6f 6c 64 73 2e 0a 3c 68 72 3e  t it holds..<hr>
3450: 0a 3c 6c 69 3e 54 68 65 20 73 65 72 76 65 72 20  .<li>The server 
3460: 63 68 65 63 6b 73 20 74 68 65 20 6c 6f 67 69 6e  checks the login
3470: 20 70 61 73 73 77 6f 72 64 20 61 6e 64 20 72 65   password and re
3480: 6a 65 63 74 73 20 74 68 65 20 73 65 73 73 69 6f  jects the sessio
3490: 6e 20 69 66 0a 74 68 65 20 75 73 65 72 20 64 6f  n if.the user do
34a0: 65 73 20 6e 6f 74 20 68 61 76 65 20 70 65 72 6d  es not have perm
34b0: 69 73 73 69 6f 6e 20 74 6f 20 70 75 6c 6c 2e 0a  ission to pull..
34c0: 3c 6c 69 3e 49 66 20 74 68 65 20 6e 75 6d 62 65  <li>If the numbe
34d0: 72 20 65 6e 74 72 69 65 73 20 69 6e 20 74 68 65  r entries in the
34e0: 20 75 6e 63 6c 75 73 74 65 72 65 64 20 74 61 62   unclustered tab
34f0: 6c 65 20 6f 6e 20 74 68 65 20 73 65 72 76 65 72  le on the server
3500: 20 69 73 0a 67 72 65 61 74 65 72 20 74 68 61 6e   is.greater than
3510: 20 31 30 30 2c 20 74 68 65 6e 20 74 68 65 20 73   100, then the s
3520: 65 72 76 65 72 20 63 6f 6e 73 74 72 75 63 74 73  erver constructs
3530: 20 61 20 6e 65 77 20 63 6c 75 73 74 65 72 20 66   a new cluster f
3540: 69 6c 65 20 74 6f 0a 63 6f 76 65 72 20 61 6c 6c  ile to.cover all
3550: 20 74 68 6f 73 65 20 75 6e 63 6c 75 73 74 65 72   those uncluster
3560: 65 64 20 65 6e 74 72 69 65 73 2e 0a 3c 6c 69 3e  ed entries..<li>
3570: 54 68 65 20 73 65 72 76 65 72 20 73 65 6e 64 73  The server sends
3580: 20 66 69 6c 65 20 63 61 72 64 73 20 66 6f 72 20   file cards for 
3590: 65 76 65 72 79 20 67 69 6d 6d 65 20 63 61 72 64  every gimme card
35a0: 20 69 74 20 72 65 63 65 69 76 65 64 0a 66 72 6f   it received.fro
35b0: 6d 20 74 68 65 20 63 6c 69 65 6e 74 2e 0a 3c 6c  m the client..<l
35c0: 69 3e 54 68 65 20 73 65 72 76 65 72 20 73 65 6e  i>The server sen
35d0: 64 73 20 69 68 61 76 65 20 63 61 72 64 73 20 66  ds ihave cards f
35e0: 6f 72 20 65 76 65 72 79 20 66 69 6c 65 20 69 6e  or every file in
35f0: 20 69 74 73 20 75 6e 63 6c 75 73 74 65 72 65 64   its unclustered
3600: 0a 74 61 62 6c 65 20 74 68 61 74 20 69 73 20 6e  .table that is n
3610: 6f 74 20 61 20 70 68 61 6e 74 6f 6d 2e 0a 3c 68  ot a phantom..<h
3620: 72 3e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65 6e  r>.<li>The clien
3630: 74 20 61 64 64 73 20 74 68 65 20 63 6f 6e 74 65  t adds the conte
3640: 6e 74 20 6f 66 20 66 69 6c 65 20 63 61 72 64 73  nt of file cards
3650: 20 74 6f 20 69 74 73 20 72 65 70 6f 73 69 74 6f   to its reposito
3660: 72 79 2e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65  ry..<li>The clie
3670: 6e 74 20 63 72 65 61 74 65 73 20 61 20 70 68 61  nt creates a pha
3680: 6e 74 6f 6d 20 66 6f 72 20 65 76 65 72 79 20 69  ntom for every i
3690: 68 61 76 65 20 63 61 72 64 20 69 6e 20 74 68 65  have card in the
36a0: 20 73 65 72 76 65 72 20 72 65 70 6c 79 0a 74 68   server reply.th
36b0: 61 74 20 6d 65 6e 74 69 6f 6e 73 20 61 20 66 69  at mentions a fi
36c0: 6c 65 20 74 68 61 74 20 74 68 65 20 63 6c 69 65  le that the clie
36d0: 6e 74 20 64 6f 65 73 20 6e 6f 74 20 70 6f 73 73  nt does not poss
36e0: 65 73 73 2e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69  ess..<li>The cli
36f0: 65 6e 74 20 63 72 65 61 74 65 73 20 61 20 70 68  ent creates a ph
3700: 61 6e 74 6f 6d 20 66 6f 72 20 74 68 65 20 64 65  antom for the de
3710: 6c 74 61 20 73 6f 75 72 63 65 20 6f 66 20 66 69  lta source of fi
3720: 6c 65 20 63 61 72 64 73 20 77 68 65 6e 0a 74 68  le cards when.th
3730: 65 20 64 65 6c 74 61 20 73 6f 75 72 63 65 20 69  e delta source i
3740: 73 20 61 20 66 69 6c 65 20 74 68 61 74 20 74 68  s a file that th
3750: 65 20 63 6c 69 65 6e 74 20 64 6f 65 73 20 6e 6f  e client does no
3760: 74 20 70 6f 73 73 65 73 73 2e 0a 3c 2f 6f 6c 3e  t possess..</ol>
3770: 0a 0a 3c 70 3e 54 68 65 73 65 20 74 65 6e 20 73  ..<p>These ten s
3780: 74 65 70 73 20 72 65 70 72 65 73 65 6e 74 20 61  teps represent a
3790: 20 73 69 6e 67 6c 65 20 48 54 54 50 20 72 6f 75   single HTTP rou
37a0: 6e 64 2d 74 72 69 70 20 72 65 71 75 65 73 74 2e  nd-trip request.
37b0: 0a 54 68 65 20 66 69 72 73 74 20 74 68 72 65 65  .The first three
37c0: 20 73 74 65 70 73 20 61 72 65 20 74 68 65 20 70   steps are the p
37d0: 72 6f 63 65 73 73 69 6e 67 20 74 68 61 74 20 6f  rocessing that o
37e0: 63 63 75 72 73 20 6f 6e 20 74 68 65 20 63 6c 69  ccurs on the cli
37f0: 65 6e 74 0a 74 6f 20 67 65 6e 65 72 61 74 65 20  ent.to generate 
3800: 74 68 65 20 72 65 71 75 65 73 74 2e 20 20 54 68  the request.  Th
3810: 65 20 6d 69 64 64 6c 65 20 66 6f 75 72 20 73 74  e middle four st
3820: 65 70 73 20 61 72 65 20 70 72 6f 63 65 73 73 69  eps are processi
3830: 6e 67 0a 74 68 61 74 20 6f 63 63 75 72 73 20 6f  ng.that occurs o
3840: 6e 20 74 68 65 20 73 65 72 76 65 72 20 74 6f 20  n the server to 
3850: 69 6e 74 65 72 70 72 65 74 20 74 68 65 20 72 65  interpret the re
3860: 71 75 65 73 74 20 61 6e 64 20 67 65 6e 65 72 61  quest and genera
3870: 74 65 20 61 0a 72 65 70 6c 79 2e 20 20 41 6e 64  te a.reply.  And
3880: 20 74 68 65 20 6c 61 73 74 20 74 68 72 65 65 20   the last three 
3890: 73 74 65 70 73 20 61 72 65 20 74 68 65 20 70 72  steps are the pr
38a0: 6f 63 65 73 73 69 6e 67 20 74 68 61 74 20 74 68  ocessing that th
38b0: 65 0a 63 6c 69 65 6e 74 20 64 6f 65 73 20 74 6f  e.client does to
38c0: 20 69 6e 74 65 72 70 72 65 74 20 74 68 65 20 72   interpret the r
38d0: 65 70 6c 79 2e 3c 2f 70 3e 0a 0a 3c 70 3e 44 75  eply.</p>..<p>Du
38e0: 72 69 6e 67 20 61 20 70 75 6c 6c 2c 20 74 68 65  ring a pull, the
38f0: 20 63 6c 69 65 6e 74 20 77 69 6c 6c 20 6b 65 65   client will kee
3900: 70 20 73 65 6e 64 69 6e 67 20 48 54 54 50 20 72  p sending HTTP r
3910: 65 71 75 65 73 74 73 0a 75 6e 74 69 6c 20 69 74  equests.until it
3920: 20 68 6f 6c 64 73 20 61 6c 6c 20 66 69 6c 65 73   holds all files
3930: 20 74 68 61 74 20 65 78 69 73 74 20 6f 6e 20 74   that exist on t
3940: 68 65 20 73 65 72 76 65 72 2e 3c 2f 70 3e 0a 0a  he server.</p>..
3950: 3c 70 3e 4e 6f 74 65 20 74 68 61 74 20 74 68 65  <p>Note that the
3960: 20 73 65 72 76 65 72 20 74 72 69 65 73 0a 74 6f   server tries.to
3970: 20 6c 69 6d 69 74 20 74 68 65 20 73 69 7a 65 20   limit the size 
3980: 6f 66 20 69 74 73 20 72 65 70 6c 79 20 6d 65 73  of its reply mes
3990: 73 61 67 65 20 74 6f 20 73 6f 6d 65 74 68 69 6e  sage to somethin
39a0: 67 20 72 65 61 73 6f 6e 61 62 6c 65 0a 28 75 73  g reasonable.(us
39b0: 75 61 6c 6c 79 20 61 62 6f 75 74 20 31 4d 42 29  ually about 1MB)
39c0: 20 73 6f 20 74 68 61 74 20 69 74 20 6d 69 67 68   so that it migh
39d0: 74 20 73 74 6f 70 20 73 65 6e 64 69 6e 67 20 66  t stop sending f
39e0: 69 6c 65 20 63 61 72 64 73 20 61 73 0a 64 65 73  ile cards as.des
39f0: 63 72 69 62 65 64 20 69 6e 20 73 74 65 70 20 28  cribed in step (
3a00: 36 29 20 69 66 20 74 68 65 20 72 65 70 6c 79 20  6) if the reply 
3a10: 62 65 63 6f 6d 65 73 20 74 6f 6f 20 6c 61 72 67  becomes too larg
3a20: 65 2e 3c 2f 70 3e 0a 0a 3c 70 3e 53 74 65 70 20  e.</p>..<p>Step 
3a30: 28 35 29 20 69 73 20 74 68 65 20 6f 6e 6c 79 20  (5) is the only 
3a40: 77 61 79 20 69 6e 20 77 68 69 63 68 20 6e 65 77  way in which new
3a50: 20 63 6c 75 73 74 65 72 73 20 63 61 6e 20 62 65   clusters can be
3a60: 20 63 72 65 61 74 65 64 2e 0a 42 79 20 6f 6e 6c   created..By onl
3a70: 79 20 63 72 65 61 74 69 6e 67 20 63 6c 75 73 74  y creating clust
3a80: 65 72 73 20 6f 6e 20 74 68 65 20 73 65 72 76 65  ers on the serve
3a90: 72 2c 20 77 65 20 68 6f 70 65 20 74 6f 20 6d 69  r, we hope to mi
3aa0: 6e 69 6d 69 7a 65 20 74 68 65 0a 61 6d 6f 75 6e  nimize the.amoun
3ab0: 74 20 6f 66 20 6f 76 65 72 6c 61 70 20 62 65 74  t of overlap bet
3ac0: 77 65 65 6e 20 63 6c 75 73 74 65 72 73 20 69 6e  ween clusters in
3ad0: 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 63 6f 6e 66   the common conf
3ae0: 69 67 75 72 61 74 69 6f 6e 20 77 68 65 72 65 0a  iguration where.
3af0: 74 68 65 72 65 20 69 73 20 61 20 73 69 6e 67 6c  there is a singl
3b00: 65 20 73 65 72 76 65 72 20 61 6e 64 20 6d 61 6e  e server and man
3b10: 79 20 63 6c 69 65 6e 74 73 2e 20 20 54 68 65 20  y clients.  The 
3b20: 73 61 6d 65 20 73 79 6e 63 68 72 6f 6e 69 7a 61  same synchroniza
3b30: 74 69 6f 6e 0a 70 72 6f 74 6f 63 6f 6c 20 77 69  tion.protocol wi
3b40: 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74 6f 20 77  ll continue to w
3b50: 6f 72 6b 20 65 76 65 6e 20 69 66 20 74 68 65 72  ork even if ther
3b60: 65 20 61 72 65 20 6d 75 6c 74 69 70 6c 65 20 73  e are multiple s
3b70: 65 72 76 65 72 73 0a 6f 72 20 69 66 20 73 65 72  ervers.or if ser
3b80: 76 65 72 73 20 61 6e 64 20 63 6c 69 65 6e 74 73  vers and clients
3b90: 20 73 6f 6d 65 74 69 6d 65 73 20 63 68 61 6e 67   sometimes chang
3ba0: 65 20 72 6f 6c 65 73 2e 20 20 54 68 65 20 6f 6e  e roles.  The on
3bb0: 6c 79 20 6e 65 67 61 74 69 76 65 0a 65 66 66 65  ly negative.effe
3bc0: 63 74 73 20 6f 66 20 74 68 65 73 65 20 75 6e 75  cts of these unu
3bd0: 73 75 61 6c 20 61 72 72 61 6e 67 65 6d 65 6e 74  sual arrangement
3be0: 73 20 69 73 20 74 68 61 74 20 6d 6f 72 65 20 74  s is that more t
3bf0: 68 61 6e 20 74 68 65 20 6d 69 6e 69 6d 75 6d 0a  han the minimum.
3c00: 6e 75 6d 62 65 72 20 6f 66 20 63 6c 75 73 74 65  number of cluste
3c10: 72 73 20 6d 69 67 68 74 20 62 65 20 67 65 6e 65  rs might be gene
3c20: 72 61 74 65 64 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e  rated.</p>..<h3>
3c30: 34 2e 32 20 50 75 73 68 3c 2f 68 33 3e 0a 0a 3c  4.2 Push</h3>..<
3c40: 70 3e 41 20 74 79 70 69 63 61 6c 20 70 75 73 68  p>A typical push
3c50: 20 6f 70 65 72 61 74 69 6f 6e 20 70 72 6f 63 65   operation proce
3c60: 65 64 73 20 72 6f 75 67 68 6c 79 20 61 73 20 73  eds roughly as s
3c70: 68 6f 77 6e 20 62 65 6c 6f 77 2e 20 20 41 73 0a  hown below.  As.
3c80: 77 69 74 68 20 61 20 70 75 6c 6c 2c 20 74 68 65  with a pull, the
3c90: 20 61 63 74 75 61 6c 20 69 6d 70 6c 65 6d 65 6e   actual implemen
3ca0: 74 61 74 69 6f 6e 20 6d 61 79 20 76 61 72 79 20  tation may vary 
3cb0: 73 6c 69 67 68 74 6c 79 2e 3c 2f 70 3e 0a 0a 3c  slightly.</p>..<
3cc0: 6f 6c 3e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65  ol>.<li>The clie
3cd0: 6e 74 20 73 65 6e 64 73 20 6c 6f 67 69 6e 20 61  nt sends login a
3ce0: 6e 64 20 70 75 73 68 20 63 61 72 64 73 2e 0a 3c  nd push cards..<
3cf0: 6c 69 3e 54 68 65 20 63 6c 69 65 6e 74 20 73 65  li>The client se
3d00: 6e 64 73 20 66 69 6c 65 20 63 61 72 64 73 20 66  nds file cards f
3d10: 6f 72 20 61 6e 79 20 66 69 6c 65 73 20 74 68 61  or any files tha
3d20: 74 20 69 74 20 68 6f 6c 64 73 20 74 68 61 74 20  t it holds that 
3d30: 68 61 76 65 0a 6e 65 76 65 72 20 62 65 66 6f 72  have.never befor
3d40: 65 20 62 65 65 6e 20 70 75 73 68 65 64 20 2d 20  e been pushed - 
3d50: 66 69 6c 65 73 20 74 68 61 74 20 63 6f 6d 65 20  files that come 
3d60: 66 72 6f 6d 20 6c 6f 63 61 6c 20 63 68 65 63 6b  from local check
3d70: 2d 69 6e 73 2e 0a 3c 6c 69 3e 49 66 20 74 68 69  -ins..<li>If thi
3d80: 73 20 69 73 20 74 68 65 20 73 65 63 6f 6e 64 20  s is the second 
3d90: 6f 72 20 6c 61 74 65 72 20 63 79 63 6c 65 20 69  or later cycle i
3da0: 6e 20 61 20 70 75 73 68 2c 20 74 68 65 6e 20 74  n a push, then t
3db0: 68 65 0a 63 6c 69 65 6e 74 20 73 65 6e 64 73 20  he.client sends 
3dc0: 66 69 6c 65 20 63 61 72 64 73 20 66 6f 72 20 61  file cards for a
3dd0: 6e 79 20 67 69 6d 6d 65 20 63 61 72 64 73 20 74  ny gimme cards t
3de0: 68 61 74 20 74 68 65 20 73 65 72 76 65 72 20 73  hat the server s
3df0: 65 6e 74 0a 69 6e 20 74 68 65 20 70 72 65 76 69  ent.in the previ
3e00: 6f 75 73 20 63 79 63 6c 65 2e 0a 3c 6c 69 3e 54  ous cycle..<li>T
3e10: 68 65 20 63 6c 69 65 6e 74 20 73 65 6e 64 73 20  he client sends 
3e20: 69 67 6f 74 20 63 61 72 64 73 20 66 6f 72 20 65  igot cards for e
3e30: 76 65 72 79 20 66 69 6c 65 20 69 6e 20 69 74 73  very file in its
3e40: 20 75 6e 63 6c 75 73 74 65 72 65 64 20 74 61 62   unclustered tab
3e50: 6c 65 0a 74 68 61 74 20 69 73 20 6e 6f 74 20 61  le.that is not a
3e60: 20 70 68 61 6e 74 6f 6d 2e 0a 3c 68 72 3e 0a 3c   phantom..<hr>.<
3e70: 6c 69 3e 54 68 65 20 73 65 72 76 65 72 20 63 68  li>The server ch
3e80: 65 63 6b 73 20 74 68 65 20 6c 6f 67 69 6e 20 61  ecks the login a
3e90: 6e 64 20 70 75 73 68 20 63 61 72 64 73 20 61 6e  nd push cards an
3ea0: 64 20 69 73 73 75 65 73 20 61 6e 20 65 72 72 6f  d issues an erro
3eb0: 72 20 69 66 0a 61 6e 79 74 68 69 6e 67 20 69 73  r if.anything is
3ec0: 20 61 6d 69 73 73 2e 0a 3c 6c 69 3e 54 68 65 20   amiss..<li>The 
3ed0: 73 65 72 76 65 72 20 61 63 63 65 70 74 73 20 66  server accepts f
3ee0: 69 6c 65 20 63 61 72 64 73 20 66 72 6f 6d 20 74  ile cards from t
3ef0: 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20 61 64  he client and ad
3f00: 64 73 20 74 68 6f 73 65 20 66 69 6c 65 73 0a 74  ds those files.t
3f10: 6f 20 69 74 73 20 72 65 70 6f 73 69 74 6f 72 79  o its repository
3f20: 2e 0a 3c 6c 69 3e 54 68 65 20 73 65 72 76 65 72  ..<li>The server
3f30: 20 63 72 65 61 74 65 73 20 70 68 61 6e 74 6f 6d   creates phantom
3f40: 73 20 66 6f 72 20 69 67 6f 74 20 63 61 72 64 73  s for igot cards
3f50: 20 74 68 61 74 20 6d 65 6e 74 69 6f 6e 20 66 69   that mention fi
3f60: 6c 65 73 20 69 74 0a 64 6f 65 73 20 6e 6f 74 20  les it.does not 
3f70: 70 6f 73 73 65 73 73 20 6f 72 20 66 6f 72 20 66  possess or for f
3f80: 69 6c 65 20 63 61 72 64 73 20 74 68 61 74 20 6d  ile cards that m
3f90: 65 6e 74 69 6f 6e 20 64 65 6c 74 61 20 73 6f 75  ention delta sou
3fa0: 72 63 65 20 66 69 6c 65 73 20 74 68 61 74 0a 69  rce files that.i
3fb0: 74 20 64 6f 65 73 20 6e 6f 74 20 70 6f 73 73 65  t does not posse
3fc0: 73 73 2e 0a 3c 6c 69 3e 54 68 65 20 73 65 72 76  ss..<li>The serv
3fd0: 65 72 20 69 73 73 75 65 73 20 67 69 6d 6d 65 20  er issues gimme 
3fe0: 63 61 72 64 73 20 66 6f 72 20 61 6c 6c 20 70 68  cards for all ph
3ff0: 61 6e 74 6f 6d 73 2e 0a 3c 68 72 3e 0a 3c 6c 69  antoms..<hr>.<li
4000: 3e 54 68 65 20 63 6c 69 65 6e 74 20 72 65 6d 65  >The client reme
4010: 6d 62 65 72 73 20 74 68 65 20 67 69 6d 6d 65 20  mbers the gimme 
4020: 63 61 72 64 73 20 66 72 6f 6d 20 74 68 65 20 73  cards from the s
4030: 65 72 76 65 72 20 73 6f 20 74 68 61 74 20 69 74  erver so that it
4040: 0a 63 61 6e 20 67 65 6e 65 72 61 74 65 20 66 69  .can generate fi
4050: 6c 65 20 63 61 72 64 73 20 69 6e 20 72 65 70 6c  le cards in repl
4060: 79 20 6f 6e 20 74 68 65 20 6e 65 78 74 20 63 79  y on the next cy
4070: 63 6c 65 2e 0a 3c 2f 6f 6c 3e 0a 0a 3c 70 3e 41  cle..</ol>..<p>A
4080: 73 20 77 69 74 68 20 61 20 70 75 6c 6c 2c 20 74  s with a pull, t
4090: 68 65 20 73 74 65 70 73 20 6f 66 20 61 20 70 75  he steps of a pu
40a0: 73 68 20 6f 70 65 72 61 74 69 6f 6e 20 72 65 70  sh operation rep
40b0: 65 61 74 20 75 6e 74 69 6c 20 74 68 65 0a 73 65  eat until the.se
40c0: 72 76 65 72 20 6b 6e 6f 77 73 20 61 6c 6c 20 66  rver knows all f
40d0: 69 6c 65 73 20 74 68 61 74 20 65 78 69 73 74 20  iles that exist 
40e0: 6f 6e 20 74 68 65 20 63 6c 69 65 6e 74 2e 20 20  on the client.  
40f0: 41 6c 73 6f 2c 20 61 73 20 77 69 74 68 0a 70 75  Also, as with.pu
4100: 6c 6c 2c 20 74 68 65 20 63 6c 69 65 6e 74 20 61  ll, the client a
4110: 74 74 65 6d 70 74 73 20 74 6f 20 6b 65 65 70 20  ttempts to keep 
4120: 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20  the size of the 
4130: 72 65 71 75 65 73 74 20 66 72 6f 6d 0a 67 72 6f  request from.gro
4140: 77 69 6e 67 20 74 6f 6f 20 6c 61 72 67 65 20 62  wing too large b
4150: 79 20 73 75 70 70 72 65 73 73 69 6e 67 20 66 69  y suppressing fi
4160: 6c 65 20 63 61 72 64 73 20 6f 6e 63 65 20 74 68  le cards once th
4170: 65 0a 73 69 7a 65 20 6f 66 20 74 68 65 20 72 65  e.size of the re
4180: 71 75 65 73 74 20 72 65 61 63 68 65 73 20 31 4d  quest reaches 1M
4190: 42 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 34 2e 33 20  B.</p>..<h3>4.3 
41a0: 53 79 6e 63 3c 2f 68 33 3e 0a 0a 3c 70 3e 41 20  Sync</h3>..<p>A 
41b0: 73 79 6e 63 20 69 73 20 6a 75 73 74 20 61 20 70  sync is just a p
41c0: 75 6c 6c 20 61 6e 64 20 61 20 70 75 73 68 20 74  ull and a push t
41d0: 68 61 74 20 68 61 70 70 65 6e 20 61 74 20 74 68  hat happen at th
41e0: 65 20 73 61 6d 65 20 74 69 6d 65 2e 0a 54 68 65  e same time..The
41f0: 20 66 69 72 73 74 20 74 68 72 65 65 20 73 74 65   first three ste
4200: 70 73 20 6f 66 20 61 20 70 75 6c 6c 20 61 72 65  ps of a pull are
4210: 20 63 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 74   combined with t
4220: 68 65 20 66 69 72 73 74 20 66 69 76 65 20 73 74  he first five st
4230: 65 70 73 0a 6f 66 20 61 20 70 75 73 68 2e 20 20  eps.of a push.  
4240: 53 74 65 70 73 20 28 34 29 20 74 68 72 6f 75 67  Steps (4) throug
4250: 68 20 28 37 29 20 6f 66 20 61 20 70 75 6c 6c 20  h (7) of a pull 
4260: 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 77 69 74  are combined wit
4270: 68 20 73 74 65 70 73 0a 28 35 29 20 74 68 72 6f  h steps.(5) thro
4280: 75 67 68 20 28 38 29 20 6f 66 20 61 20 70 75 73  ugh (8) of a pus
4290: 68 2e 20 20 41 6e 64 20 73 74 65 70 73 20 28 38  h.  And steps (8
42a0: 29 20 74 68 72 6f 75 67 68 20 28 31 30 29 20 6f  ) through (10) o
42b0: 66 20 61 20 70 75 6c 6c 0a 61 72 65 20 63 6f 6d  f a pull.are com
42c0: 62 69 6e 65 64 20 77 69 74 68 20 73 74 65 70 20  bined with step 
42d0: 28 39 29 20 6f 66 20 61 20 70 75 73 68 2e 3c 2f  (9) of a push.</
42e0: 70 3e 0a 0a 3c 68 32 3e 35 2e 30 20 53 75 6d 6d  p>..<h2>5.0 Summ
42f0: 61 72 79 3c 2f 68 32 3e 0a 0a 3c 70 3e 48 65 72  ary</h2>..<p>Her
4300: 65 20 61 72 65 20 74 68 65 20 6b 65 79 20 70 6f  e are the key po
4310: 69 6e 74 73 20 6f 66 20 74 68 65 20 73 79 6e 63  ints of the sync
4320: 68 72 6f 6e 69 7a 61 74 69 6f 6e 20 70 72 6f 74  hronization prot
4330: 6f 63 6f 6c 3a 3c 2f 70 3e 0a 0a 3c 6f 6c 3e 0a  ocol:</p>..<ol>.
4340: 3c 6c 69 3e 54 68 65 20 63 6c 69 65 6e 74 20 73  <li>The client s
4350: 65 6e 64 73 20 6f 6e 65 20 6f 72 20 6d 6f 72 65  ends one or more
4360: 20 50 55 53 48 20 48 54 54 50 20 72 65 71 75 65   PUSH HTTP reque
4370: 73 74 73 20 74 6f 20 74 68 65 20 73 65 72 76 65  sts to the serve
4380: 72 2e 0a 20 20 20 20 54 68 65 20 72 65 71 75 65  r..    The reque
4390: 73 74 20 61 6e 64 20 72 65 70 6c 79 20 63 6f 6e  st and reply con
43a0: 74 65 6e 74 20 74 79 70 65 20 69 73 20 22 61 70  tent type is "ap
43b0: 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 66 6f 73 73  plication/x-foss
43c0: 69 6c 22 2e 0a 3c 6c 69 3e 48 54 54 50 20 72 65  il"..<li>HTTP re
43d0: 71 75 65 73 74 20 63 6f 6e 74 65 6e 74 20 69 73  quest content is
43e0: 20 63 6f 6d 70 72 65 73 73 65 64 20 75 73 69 6e   compressed usin
43f0: 67 20 7a 6c 69 62 2e 0a 3c 6c 69 3e 54 68 65 20  g zlib..<li>The 
4400: 63 6f 6e 74 65 6e 74 20 6f 66 20 72 65 71 75 65  content of reque
4410: 73 74 20 61 6e 64 20 72 65 70 6c 79 20 63 6f 6e  st and reply con
4420: 73 69 73 74 73 20 6f 66 20 63 61 72 64 73 20 77  sists of cards w
4430: 69 74 68 20 6f 6e 65 0a 20 20 20 20 63 61 72 64  ith one.    card
4440: 20 70 65 72 20 6c 69 6e 65 2e 20 20 0a 3c 6c 69   per line.  .<li
4450: 3e 43 61 72 64 20 66 6f 72 6d 61 74 73 20 61 72  >Card formats ar
4460: 65 3a 0a 20 20 20 20 3c 75 6c 3e 0a 20 20 20 20  e:.    <ul>.    
4470: 3c 6c 69 3e 20 3c 62 3e 6c 6f 67 69 6e 3c 2f 62  <li> <b>login</b
4480: 3e 20 3c 69 3e 75 73 65 72 69 64 20 6e 6f 6e 63  > <i>userid nonc
4490: 65 20 73 69 67 6e 61 74 75 72 65 3c 2f 69 3e 0a  e signature</i>.
44a0: 20 20 20 20 3c 6c 69 3e 20 3c 62 3e 70 75 73 68      <li> <b>push
44b0: 3c 2f 62 3e 20 3c 69 3e 73 65 72 76 65 72 63 6f  </b> <i>serverco
44c0: 64 65 20 70 72 6f 6a 65 63 74 63 6f 64 65 3c 2f  de projectcode</
44d0: 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62 3e 70  i>.    <li> <b>p
44e0: 75 6c 6c 3c 2f 62 3e 20 3c 69 3e 73 65 72 76 65  ull</b> <i>serve
44f0: 72 63 6f 64 65 20 70 72 6f 6a 65 63 74 63 6f 64  rcode projectcod
4500: 65 3c 2f 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c  e</i>.    <li> <
4510: 62 3e 63 6c 6f 6e 65 3c 2f 62 3e 0a 20 20 20 20  b>clone</b>.    
4520: 3c 6c 69 3e 20 3c 62 3e 66 69 6c 65 3c 2f 62 3e  <li> <b>file</b>
4530: 20 3c 69 3e 75 75 69 64 20 73 69 7a 65 3c 2f 69   <i>uuid size</i
4540: 3e 20 3c 62 3e 5c 6e 3c 2f 62 3e 20 3c 69 3e 63  > <b>\n</b> <i>c
4550: 6f 6e 74 65 6e 74 3c 2f 69 3e 0a 20 20 20 20 3c  ontent</i>.    <
4560: 6c 69 3e 20 3c 62 3e 66 69 6c 65 3c 2f 62 3e 20  li> <b>file</b> 
4570: 3c 69 3e 75 75 69 64 20 64 65 6c 74 61 2d 75 75  <i>uuid delta-uu
4580: 69 64 20 73 69 7a 65 3c 2f 69 3e 20 3c 62 3e 5c  id size</i> <b>\
4590: 6e 3c 2f 62 3e 20 3c 69 3e 63 6f 6e 74 65 6e 74  n</b> <i>content
45a0: 3c 2f 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62  </i>.    <li> <b
45b0: 3e 69 67 6f 74 3c 2f 62 3e 20 3c 69 3e 75 75 69  >igot</b> <i>uui
45c0: 64 3c 2f 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c  d</i>.    <li> <
45d0: 62 3e 67 69 6d 6d 65 3c 2f 62 3e 20 3c 69 3e 75  b>gimme</b> <i>u
45e0: 75 69 64 3c 2f 69 3e 0a 20 20 20 20 3c 6c 69 3e  uid</i>.    <li>
45f0: 20 3c 62 3e 63 6f 6f 6b 69 65 3c 2f 62 3e 20 20   <b>cookie</b>  
4600: 3c 69 3e 63 6f 6f 6b 69 65 2d 74 65 78 74 3c 2f  <i>cookie-text</
4610: 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62 3e 65  i>.    <li> <b>e
4620: 72 72 6f 72 3c 2f 62 3e 20 3c 69 3e 65 72 72 6f  rror</b> <i>erro
4630: 72 2d 6d 65 73 73 61 67 65 3c 2f 69 3e 0a 20 20  r-message</i>.  
4640: 20 20 3c 2f 75 6c 3e 0a 3c 6c 69 3e 50 68 61 6e    </ul>.<li>Phan
4650: 74 6f 6d 73 20 61 72 65 20 66 69 6c 65 73 20 74  toms are files t
4660: 68 61 74 20 61 20 72 65 70 6f 73 69 74 6f 72 79  hat a repository
4670: 20 6b 6e 6f 77 73 20 65 78 69 73 74 20 62 75 74   knows exist but
4680: 20 64 6f 65 73 20 6e 6f 74 20 70 6f 73 73 65 73   does not posses
4690: 73 2e 0a 3c 6c 69 3e 43 6c 75 73 74 65 72 73 20  s..<li>Clusters 
46a0: 61 72 65 20 66 69 6c 65 73 20 74 68 61 74 20 63  are files that c
46b0: 6f 6e 74 61 69 6e 20 74 68 65 20 55 55 49 44 73  ontain the UUIDs
46c0: 20 6f 66 20 6f 74 68 65 72 20 66 69 6c 65 73 2e   of other files.
46d0: 0a 3c 6c 69 3e 43 6c 75 73 74 65 72 73 20 61 72  .<li>Clusters ar
46e0: 65 20 63 72 65 61 74 65 64 20 61 75 74 6f 6d 61  e created automa
46f0: 74 69 63 61 6c 6c 79 20 6f 6e 20 74 68 65 20 73  tically on the s
4700: 65 72 76 65 72 20 64 75 72 69 6e 67 20 61 20 70  erver during a p
4710: 75 6c 6c 2e 0a 3c 6c 69 3e 52 65 70 6f 73 69 74  ull..<li>Reposit
4720: 6f 72 69 65 73 20 6b 65 65 70 20 74 72 61 63 6b  ories keep track
4730: 20 6f 66 20 61 6c 6c 20 66 69 6c 65 73 20 74 68   of all files th
4740: 61 74 20 61 72 65 20 6e 6f 74 20 6e 61 6d 65 64  at are not named
4750: 20 69 6e 20 61 6e 79 0a 63 6c 75 73 74 65 72 20   in any.cluster 
4760: 61 6e 64 20 73 65 6e 64 20 69 67 6f 74 20 6d 65  and send igot me
4770: 73 73 61 67 65 73 20 66 6f 72 20 74 68 6f 73 65  ssages for those
4780: 20 66 69 6c 65 73 2e 0a 3c 6c 69 3e 52 65 70 6f   files..<li>Repo
4790: 73 69 74 6f 72 69 65 73 20 6b 65 65 70 20 74 72  sitories keep tr
47a0: 61 63 6b 20 6f 66 20 61 6c 6c 20 74 68 65 20 70  ack of all the p
47b0: 68 61 6e 74 6f 6d 73 20 74 68 65 79 20 68 6f 6c  hantoms they hol
47c0: 64 20 61 6e 64 20 73 65 6e 64 0a 67 69 6d 6d 65  d and send.gimme
47d0: 20 6d 65 73 73 61 67 65 73 20 66 6f 72 20 74 68   messages for th
47e0: 6f 73 65 20 66 69 6c 65 73 2e 0a 3c 2f 6f 6c 3e  ose files..</ol>
47f0: 0a 0a 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74 6d 6c  ..</body>.</html
4800: 3e 0a                                            >.