Hex Artifact Content
Not logged in

Artifact 4b94620e2465084bcd81479925282ab4cce6e66d:

File www/sync.html part of check-in [776753118f] - The nonce of a login card in the sync protocol is now the SHA1 hash of the remainder of the sync message. The signature is the SHA1 hash of the concatenation of the nonce and the users password. by drh on 2007-09-12 02:25:37.

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 64 2e 20 20 42 6c   is ignored.  Bl
0ec0: 61 6e 6b 20 63 61 72 64 73 20 61 72 65 20 69 67  ank cards are ig
0ed0: 6e 6f 72 65 64 2e 3c 2f 70 3e 0a 0a 3c 70 3e 45  nored.</p>..<p>E
0ee0: 61 63 68 20 63 61 72 64 20 69 73 20 64 69 76 69  ach card is divi
0ef0: 64 65 64 20 69 6e 74 6f 20 7a 65 72 6f 20 6f 72  ded into zero or
0f00: 20 6d 6f 72 65 20 73 70 61 63 65 20 73 65 70 61   more space sepa
0f10: 72 61 74 65 64 20 74 6f 6b 65 6e 73 2e 0a 54 68  rated tokens..Th
0f20: 65 20 66 69 72 73 74 20 74 6f 6b 65 6e 20 6f 6e  e first token on
0f30: 20 65 61 63 68 20 63 61 72 64 20 69 73 20 74 68   each card is th
0f40: 65 20 6f 70 65 72 61 74 6f 72 2e 20 20 53 75 62  e operator.  Sub
0f50: 73 65 71 75 65 6e 74 20 74 6f 6b 65 6e 73 0a 61  sequent tokens.a
0f60: 72 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 54  re arguments.  T
0f70: 68 65 20 73 65 74 20 6f 66 20 6f 70 65 72 61 74  he set of operat
0f80: 6f 72 73 20 75 6e 64 65 72 73 74 6f 6f 64 20 62  ors understood b
0f90: 79 20 73 65 72 76 65 72 73 20 69 73 20 73 6c 69  y servers is sli
0fa0: 67 68 74 6c 79 0a 64 69 66 66 65 72 65 6e 74 20  ghtly.different 
0fb0: 66 72 6f 6d 20 74 68 65 20 6f 70 65 72 61 74 6f  from the operato
0fc0: 72 73 20 75 6e 64 65 72 73 74 6f 6f 64 20 62 79  rs understood by
0fd0: 20 63 6c 69 65 6e 74 73 2c 20 74 68 6f 75 67 68   clients, though
0fe0: 20 74 68 65 20 74 77 6f 0a 61 72 65 20 76 65 72   the two.are ver
0ff0: 79 20 73 69 6d 69 6c 61 72 2e 3c 2f 70 3e 0a 0a  y similar.</p>..
1000: 3c 68 33 3e 32 2e 32 20 4c 6f 67 69 6e 20 43 61  <h3>2.2 Login Ca
1010: 72 64 73 3c 2f 68 33 3e 0a 0a 3c 70 3e 45 76 65  rds</h3>..<p>Eve
1020: 72 79 20 6d 65 73 73 61 67 65 20 66 72 6f 6d 20  ry message from 
1030: 63 6c 69 65 6e 74 20 74 6f 20 73 65 72 76 65 72  client to server
1040: 20 62 65 67 69 6e 73 20 77 69 74 68 20 6f 6e 65   begins with one
1050: 20 6f 72 20 6d 6f 72 65 20 6c 6f 67 69 6e 0a 63   or more login.c
1060: 61 72 64 73 2e 20 20 45 61 63 68 20 6c 6f 67 69  ards.  Each logi
1070: 6e 20 63 61 72 64 20 68 61 73 20 74 68 65 20 66  n card has the f
1080: 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 61 74 3a  ollowing format:
1090: 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74  </p>..<blockquot
10a0: 65 3e 0a 3c 62 3e 6c 6f 67 69 6e 3c 2f 62 3e 20  e>.<b>login</b> 
10b0: 20 3c 69 3e 75 73 65 72 69 64 20 20 6e 6f 6e 63   <i>userid  nonc
10c0: 65 20 20 73 69 67 6e 61 74 75 72 65 3c 2f 69 3e  e  signature</i>
10d0: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  .</blockquote>..
10e0: 3c 70 3e 54 68 65 20 75 73 65 72 69 64 20 69 73  <p>The userid is
10f0: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65   the name of the
1100: 20 75 73 65 72 20 74 68 61 74 20 69 73 20 72 65   user that is re
1110: 71 75 65 73 74 69 6e 67 20 73 65 72 76 69 63 65  questing service
1120: 0a 66 72 6f 6d 20 74 68 65 20 73 65 72 76 65 72  .from the server
1130: 2e 20 20 54 68 65 20 6e 6f 6e 63 65 20 69 73 20  .  The nonce is 
1140: 74 68 65 20 53 48 41 31 20 68 61 73 68 20 6f 66  the SHA1 hash of
1150: 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f   the remainder o
1160: 66 0a 74 68 65 20 6d 65 73 73 61 67 65 20 2d 20  f.the message - 
1170: 61 6c 6c 20 74 65 78 74 20 74 68 61 74 20 66 6f  all text that fo
1180: 6c 6c 6f 77 73 20 74 68 65 20 6e 65 77 6c 69 6e  llows the newlin
1190: 65 20 63 68 61 72 61 63 74 65 72 20 74 68 61 74  e character that
11a0: 0a 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 20  .terminates the 
11b0: 6c 6f 67 69 6e 20 63 61 72 64 2e 20 20 54 68 65  login card.  The
11c0: 20 73 69 67 6e 61 74 75 72 65 20 69 73 20 74 68   signature is th
11d0: 65 20 53 48 41 31 20 68 61 73 68 20 6f 66 0a 74  e SHA1 hash of.t
11e0: 68 65 20 63 6f 6e 63 61 74 65 6e 61 74 69 6f 6e  he concatenation
11f0: 20 6f 66 20 74 68 65 20 6e 6f 6e 63 65 20 61 6e   of the nonce an
1200: 64 20 74 68 65 20 75 73 65 72 73 20 70 61 73 73  d the users pass
1210: 77 6f 72 64 2e 3c 2f 70 3e 0a 0a 3c 70 3e 46 6f  word.</p>..<p>Fo
1220: 72 20 65 61 63 68 20 6c 6f 67 69 6e 20 63 61 72  r each login car
1230: 64 2c 20 74 68 65 20 73 65 72 76 65 72 20 6c 6f  d, the server lo
1240: 6f 6b 73 20 75 70 20 74 68 65 20 75 73 65 72 20  oks up the user 
1250: 61 6e 64 20 76 65 72 69 66 69 65 73 0a 74 68 61  and verifies.tha
1260: 74 20 74 68 65 20 6e 6f 6e 63 65 20 6d 61 74 63  t the nonce matc
1270: 68 65 73 20 74 68 65 20 53 48 41 31 20 68 61 73  hes the SHA1 has
1280: 68 20 6f 66 20 74 68 65 20 72 65 6d 61 69 6e 64  h of the remaind
1290: 65 72 20 6f 66 20 74 68 65 0a 6d 65 73 73 61 67  er of the.messag
12a0: 65 2e 20 20 49 74 20 74 68 65 6e 20 63 68 65 63  e.  It then chec
12b0: 6b 73 20 74 68 65 20 73 69 67 6e 61 74 75 72 65  ks the signature
12c0: 20 68 61 73 68 20 74 6f 20 6d 61 6b 65 20 73 75   hash to make su
12d0: 72 65 20 74 68 65 20 0a 73 69 67 6e 61 74 75 72  re the .signatur
12e0: 65 20 6d 61 74 63 68 65 73 2e 20 20 49 66 20 65  e matches.  If e
12f0: 76 65 72 79 74 68 69 6e 67 0a 63 68 65 63 6b 73  verything.checks
1300: 20 6f 75 74 2c 20 74 68 65 6e 20 74 68 65 20 63   out, then the c
1310: 6c 69 65 6e 74 20 69 73 20 67 72 61 6e 74 65 64  lient is granted
1320: 20 61 6c 6c 20 70 72 69 76 69 6c 65 67 65 73 20   all privileges 
1330: 6f 66 20 74 68 65 0a 73 70 65 63 69 66 69 65 64  of the.specified
1340: 20 75 73 65 72 2e 3c 2f 70 3e 0a 0a 3c 70 3e 50   user.</p>..<p>P
1350: 72 69 76 69 6c 65 67 65 73 20 61 72 65 20 63 75  rivileges are cu
1360: 6d 75 6c 61 74 69 76 65 2e 20 20 54 68 65 72 65  mulative.  There
1370: 20 63 61 6e 20 62 65 20 6d 75 6c 74 69 70 6c 65   can be multiple
1380: 20 73 75 63 63 65 73 73 66 75 6c 0a 6c 6f 67 69   successful.logi
1390: 6e 20 63 61 72 64 73 2e 20 20 54 68 65 20 73 65  n cards.  The se
13a0: 73 73 69 6f 6e 20 70 72 69 76 69 6c 65 67 65 73  ssion privileges
13b0: 20 61 72 65 20 74 68 65 20 62 69 74 2d 77 69 73   are the bit-wis
13c0: 65 20 4f 52 20 6f 66 20 74 68 65 0a 70 72 69 76  e OR of the.priv
13d0: 69 6c 65 67 65 73 20 6f 66 20 65 61 63 68 20 69  ileges of each i
13e0: 6e 64 69 76 69 64 75 61 6c 20 6c 6f 67 69 6e 2e  ndividual login.
13f0: 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 33 20 46 69  </p>..<h3>2.3 Fi
1400: 6c 65 20 43 61 72 64 73 3c 2f 68 33 3e 0a 0a 3c  le Cards</h3>..<
1410: 70 3e 52 65 70 6f 73 69 74 6f 72 79 20 63 6f 6e  p>Repository con
1420: 74 65 6e 74 20 72 65 63 6f 72 64 73 20 6f 72 20  tent records or 
1430: 66 69 6c 65 73 20 61 72 65 20 74 72 61 6e 73 66  files are transf
1440: 65 72 72 65 64 20 75 73 69 6e 67 0a 61 20 22 66  erred using.a "f
1450: 69 6c 65 22 20 63 61 72 64 2e 20 20 46 69 6c 65  ile" card.  File
1460: 20 63 61 72 64 73 20 63 6f 6d 65 20 69 6e 20 74   cards come in t
1470: 77 6f 20 64 69 66 66 65 72 65 6e 74 20 66 6f 72  wo different for
1480: 6d 61 74 73 20 64 65 70 65 6e 64 69 6e 67 0a 6f  mats depending.o
1490: 6e 20 77 68 65 74 68 65 72 20 74 68 65 20 66 69  n whether the fi
14a0: 6c 65 20 69 73 20 73 65 6e 74 20 64 69 72 65 63  le is sent direc
14b0: 74 6c 79 20 6f 72 20 61 73 20 61 20 64 65 6c 74  tly or as a delt
14c0: 61 20 66 72 6f 6d 20 73 6f 6d 65 0a 6f 74 68 65  a from some.othe
14d0: 72 20 66 69 6c 65 2e 3c 2f 70 3e 0a 0a 3c 62 6c  r file.</p>..<bl
14e0: 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 66 69 6c  ockquote>.<b>fil
14f0: 65 3c 2f 62 3e 20 3c 69 3e 75 75 69 64 20 73 69  e</b> <i>uuid si
1500: 7a 65 3c 2f 69 3e 20 3c 62 3e 5c 6e 3c 2f 62 3e  ze</i> <b>\n</b>
1510: 20 3c 69 3e 63 6f 6e 74 65 6e 74 3c 2f 69 3e 3c   <i>content</i><
1520: 62 72 3e 0a 3c 62 3e 66 69 6c 65 3c 2f 62 3e 20  br>.<b>file</b> 
1530: 3c 69 3e 75 75 69 64 20 64 65 6c 74 61 2d 75 75  <i>uuid delta-uu
1540: 69 64 20 73 69 7a 65 3c 2f 69 3e 20 3c 62 3e 5c  id size</i> <b>\
1550: 6e 3c 2f 62 3e 20 3c 69 3e 63 6f 6e 74 65 6e 74  n</b> <i>content
1560: 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  </i>.</blockquot
1570: 65 3e 0a 0a 3c 70 3e 46 69 6c 65 20 63 61 72 64  e>..<p>File card
1580: 73 20 61 72 65 20 64 69 66 66 65 72 65 6e 74 20  s are different 
1590: 66 72 6f 6d 20 61 6c 6c 20 6f 74 68 65 72 20 63  from all other c
15a0: 61 72 64 73 20 69 6e 20 74 68 61 74 20 74 68 65  ards in that the
15b0: 79 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 20 69 6e  y.followed by in
15c0: 2d 6c 69 6e 65 20 22 70 61 79 6c 6f 61 64 22 20  -line "payload" 
15d0: 64 61 74 61 2e 20 20 54 68 65 20 63 6f 6e 74 65  data.  The conte
15e0: 6e 74 20 6f 66 20 74 68 65 20 66 69 6c 65 0a 6f  nt of the file.o
15f0: 72 20 74 68 65 20 66 69 6c 65 20 64 65 6c 74 61  r the file delta
1600: 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 68 65   consists of the
1610: 20 66 69 72 73 74 20 3c 69 3e 73 69 7a 65 3c 2f   first <i>size</
1620: 69 3e 20 62 79 74 65 73 20 6f 66 20 74 68 65 0a  i> bytes of the.
1630: 78 2d 66 6f 73 73 69 6c 20 63 6f 6e 74 65 6e 74  x-fossil content
1640: 20 74 68 61 74 20 69 6d 6d 65 64 69 61 74 65 6c   that immediatel
1650: 79 20 66 6f 6c 6c 6f 77 20 74 68 65 20 6e 65 77  y follow the new
1660: 6c 69 6e 65 20 74 68 61 74 0a 74 65 72 6d 69 6e  line that.termin
1670: 61 74 65 73 20 74 68 65 20 66 69 6c 65 20 63 61  ates the file ca
1680: 72 64 2e 20 20 4e 6f 20 6f 74 68 65 72 20 63 61  rd.  No other ca
1690: 72 64 73 20 68 61 76 65 20 74 68 69 73 20 63 68  rds have this ch
16a0: 61 72 61 63 74 65 72 69 73 74 69 63 2e 0a 3c 2f  aracteristic..</
16b0: 70 3e 0a 0a 3c 70 3e 54 68 65 20 66 69 72 73 74  p>..<p>The first
16c0: 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 61 20 66   argument of a f
16d0: 69 6c 65 20 63 61 72 64 20 69 73 20 74 68 65 20  ile card is the 
16e0: 55 55 49 44 20 6f 66 20 74 68 65 20 66 69 6c 65  UUID of the file
16f0: 20 74 68 61 74 0a 69 73 20 62 65 69 6e 67 20 74   that.is being t
1700: 72 61 6e 73 66 65 72 72 65 64 2e 20 20 54 68 65  ransferred.  The
1710: 20 55 55 49 44 20 69 73 20 74 68 65 20 6c 6f 77   UUID is the low
1720: 65 72 2d 63 61 73 65 20 68 65 78 61 64 65 63 69  er-case hexadeci
1730: 6d 61 6c 0a 72 65 70 72 65 73 65 6e 74 61 74 69  mal.representati
1740: 6f 6e 20 6f 66 20 74 68 65 20 53 48 41 31 20 68  on of the SHA1 h
1750: 61 73 68 20 6f 66 20 74 68 65 20 65 6e 74 69 72  ash of the entir
1760: 65 20 66 69 6c 65 20 63 6f 6e 74 65 6e 74 2e 0a  e file content..
1770: 54 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65 6e  The last argumen
1780: 74 20 6f 66 20 74 68 65 20 66 69 6c 65 20 63 61  t of the file ca
1790: 72 64 20 69 73 20 74 68 65 20 6e 75 6d 62 65 72  rd is the number
17a0: 20 6f 66 20 62 79 74 65 73 20 6f 66 0a 70 61 79   of bytes of.pay
17b0: 6c 6f 61 64 20 74 68 61 74 20 69 6d 6d 65 64 69  load that immedi
17c0: 61 74 65 6c 79 20 66 6f 6c 6c 6f 77 20 74 68 65  ately follow the
17d0: 20 66 69 6c 65 20 63 61 72 64 2e 20 20 49 66 20   file card.  If 
17e0: 74 68 65 20 66 69 6c 65 0a 63 61 72 64 20 68 61  the file.card ha
17f0: 73 20 6f 6e 6c 79 20 74 77 6f 20 61 72 67 75 6d  s only two argum
1800: 65 6e 74 73 2c 20 74 68 61 74 20 6d 65 61 6e 73  ents, that means
1810: 20 74 68 65 20 70 61 79 6c 6f 61 64 20 69 73 20   the payload is 
1820: 74 68 65 0a 63 6f 6d 70 6c 65 74 65 20 63 6f 6e  the.complete con
1830: 74 65 6e 74 20 6f 66 20 74 68 65 20 66 69 6c 65  tent of the file
1840: 2e 20 20 49 66 20 74 68 65 20 66 69 6c 65 20 63  .  If the file c
1850: 61 72 64 20 68 61 73 20 74 68 72 65 65 0a 61 72  ard has three.ar
1860: 67 75 6d 65 6e 74 73 2c 20 74 68 65 6e 20 74 68  guments, then th
1870: 65 20 70 61 79 6c 6f 61 64 20 69 73 20 61 20 64  e payload is a d
1880: 65 6c 74 61 20 61 6e 64 20 73 65 63 6f 6e 64 20  elta and second 
1890: 61 72 67 75 6d 65 6e 74 20 69 73 0a 74 68 65 20  argument is.the 
18a0: 55 55 49 44 20 6f 66 20 61 6e 6f 74 68 65 72 20  UUID of another 
18b0: 66 69 6c 65 20 74 68 61 74 20 69 73 20 74 68 65  file that is the
18c0: 20 73 6f 75 72 63 65 20 6f 66 20 74 68 65 20 64   source of the d
18d0: 65 6c 74 61 2e 3c 2f 70 3e 0a 0a 3c 70 3e 46 69  elta.</p>..<p>Fi
18e0: 6c 65 20 63 61 72 64 73 20 61 72 65 20 73 65 6e  le cards are sen
18f0: 74 20 69 6e 20 62 6f 74 68 20 64 69 72 65 63 74  t in both direct
1900: 69 6f 6e 73 3a 20 63 6c 69 65 6e 74 20 74 6f 20  ions: client to 
1910: 73 65 72 76 65 72 20 61 6e 64 0a 73 65 72 76 65  server and.serve
1920: 72 20 74 6f 20 63 6c 69 65 6e 74 2e 20 20 41 20  r to client.  A 
1930: 64 65 6c 74 61 20 6d 69 67 68 74 20 62 65 20 73  delta might be s
1940: 65 6e 74 20 62 65 66 6f 72 65 20 74 68 65 20 73  ent before the s
1950: 6f 75 72 63 65 20 6f 66 0a 74 68 65 20 64 65 6c  ource of.the del
1960: 74 61 2c 20 73 6f 20 62 6f 74 68 20 63 6c 69 65  ta, so both clie
1970: 6e 74 20 61 6e 64 20 73 65 72 76 65 72 20 73 68  nt and server sh
1980: 6f 75 6c 64 20 72 65 6d 65 6d 62 65 72 20 64 65  ould remember de
1990: 6c 74 61 73 0a 61 6e 64 20 62 65 20 61 62 6c 65  ltas.and be able
19a0: 20 74 6f 20 61 70 70 6c 79 20 74 68 65 6d 20 77   to apply them w
19b0: 68 65 6e 20 74 68 65 69 72 20 73 6f 75 72 63 65  hen their source
19c0: 20 61 72 72 69 76 65 73 2e 3c 2f 70 3e 0a 0a 3c   arrives.</p>..<
19d0: 68 33 3e 32 2e 34 20 50 75 73 68 20 61 6e 64 20  h3>2.4 Push and 
19e0: 50 75 6c 6c 20 43 61 72 64 73 3c 2f 68 33 3e 0a  Pull Cards</h3>.
19f0: 0a 3c 70 3e 41 6d 6f 6e 67 20 6f 66 20 74 68 65  .<p>Among of the
1a00: 20 66 69 72 73 74 20 63 61 72 64 73 20 69 6e 20   first cards in 
1a10: 61 20 63 6c 69 65 6e 74 2d 74 6f 2d 73 65 72 76  a client-to-serv
1a20: 65 72 20 6d 65 73 73 61 67 65 20 61 72 65 0a 74  er message are.t
1a30: 68 65 20 70 75 73 68 20 61 6e 64 20 70 75 6c 6c  he push and pull
1a40: 20 63 61 72 64 73 2e 20 20 54 68 65 20 70 75 73   cards.  The pus
1a50: 68 20 63 61 72 64 20 74 65 6c 6c 20 74 68 65 20  h card tell the 
1a60: 73 65 72 76 65 72 20 74 68 61 74 0a 74 68 65 20  server that.the 
1a70: 63 6c 69 65 6e 74 20 69 73 20 70 75 73 68 69 6e  client is pushin
1a80: 67 20 63 6f 6e 74 65 6e 74 2e 20 20 54 68 65 20  g content.  The 
1a90: 70 75 6c 6c 20 63 61 72 64 20 74 65 6c 6c 20 74  pull card tell t
1aa0: 68 65 20 73 65 72 76 65 72 0a 74 68 61 74 20 74  he server.that t
1ab0: 68 65 20 63 6c 69 65 6e 74 20 77 61 6e 74 73 20  he client wants 
1ac0: 74 6f 20 70 75 6c 6c 20 63 6f 6e 74 65 6e 74 2e  to pull content.
1ad0: 20 20 49 6e 20 74 68 65 20 65 76 65 6e 74 20 6f    In the event o
1ae0: 66 20 61 20 73 79 6e 63 2c 0a 62 6f 74 68 20 63  f a sync,.both c
1af0: 61 72 64 73 20 61 72 65 20 73 65 6e 74 2e 20 20  ards are sent.  
1b00: 54 68 65 20 66 6f 72 6d 61 74 20 69 73 20 61 73  The format is as
1b10: 20 66 6f 6c 6c 6f 77 73 3a 3c 2f 70 3e 0a 0a 3c   follows:</p>..<
1b20: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 70  blockquote>.<b>p
1b30: 75 73 68 3c 2f 62 3e 20 3c 69 3e 73 65 72 76 65  ush</b> <i>serve
1b40: 72 63 6f 64 65 20 70 72 6f 6a 65 63 74 63 6f 64  rcode projectcod
1b50: 65 3c 2f 69 3e 3c 62 72 3e 0a 3c 62 3e 70 75 6c  e</i><br>.<b>pul
1b60: 6c 3c 2f 62 3e 20 3c 69 3e 73 65 72 76 65 72 63  l</b> <i>serverc
1b70: 6f 64 65 20 70 72 6f 6a 65 63 74 63 6f 64 65 3c  ode projectcode<
1b80: 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65  /i>.</blockquote
1b90: 3e 0a 0a 3c 70 3e 54 68 65 20 3c 69 3e 73 65 72  >..<p>The <i>ser
1ba0: 76 65 72 63 6f 64 65 3c 2f 69 3e 20 61 72 67 75  vercode</i> argu
1bb0: 6d 65 6e 74 20 69 73 20 74 68 65 20 72 65 70 6f  ment is the repo
1bc0: 73 69 74 6f 72 79 20 49 44 20 66 6f 72 20 74 68  sitory ID for th
1bd0: 65 0a 63 6c 69 65 6e 74 2e 20 20 54 68 65 20 73  e.client.  The s
1be0: 65 72 76 65 72 20 77 69 6c 6c 20 6f 6e 6c 79 20  erver will only 
1bf0: 61 6c 6c 6f 77 20 74 68 65 20 74 72 61 6e 73 61  allow the transa
1c00: 63 74 69 6f 6e 20 74 6f 20 70 72 6f 63 65 65 64  ction to proceed
1c10: 0a 69 66 20 74 68 65 20 73 65 72 76 65 72 63 6f  .if the serverco
1c20: 64 65 20 69 73 20 64 69 66 66 65 72 65 6e 74 20  de is different 
1c30: 66 72 6f 6d 20 69 74 73 20 6f 77 6e 20 73 65 72  from its own ser
1c40: 76 65 72 63 6f 64 65 2e 20 20 54 68 69 73 0a 70  vercode.  This.p
1c50: 72 65 76 65 6e 74 73 20 61 20 73 79 6e 63 2d 6c  revents a sync-l
1c60: 6f 6f 70 2e 20 20 54 68 65 20 3c 69 3e 70 72 6f  oop.  The <i>pro
1c70: 6a 65 63 74 63 6f 64 65 3c 2f 69 3e 20 69 73 20  jectcode</i> is 
1c80: 74 68 65 20 69 64 65 6e 74 69 66 69 65 72 0a 6f  the identifier.o
1c90: 66 20 74 68 65 20 73 6f 66 74 77 61 72 65 20 70  f the software p
1ca0: 72 6f 6a 65 63 74 20 74 68 61 74 20 74 68 65 20  roject that the 
1cb0: 63 6c 69 65 6e 74 20 72 65 70 6f 73 69 74 6f 72  client repositor
1cc0: 79 20 63 6f 6e 74 61 69 6e 73 2e 0a 54 68 65 20  y contains..The 
1cd0: 70 72 6f 6a 65 63 74 63 6f 64 65 20 66 6f 72 20  projectcode for 
1ce0: 74 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20 73  the client and s
1cf0: 65 72 76 65 72 20 6d 75 73 74 20 6d 61 74 63 68  erver must match
1d00: 20 69 6e 20 6f 72 64 65 72 0a 66 6f 72 20 74 68   in order.for th
1d10: 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 74 6f  e transaction to
1d20: 20 70 72 6f 63 65 65 64 2e 3c 2f 70 3e 0a 0a 3c   proceed.</p>..<
1d30: 70 3e 54 68 65 20 73 65 72 76 65 72 20 77 69 6c  p>The server wil
1d40: 6c 20 61 6c 73 6f 20 73 65 6e 64 20 61 20 70 75  l also send a pu
1d50: 73 68 20 63 61 72 64 20 62 61 63 6b 20 74 6f 20  sh card back to 
1d60: 74 68 65 20 63 6c 69 65 6e 74 0a 64 75 72 69 6e  the client.durin
1d70: 67 20 61 20 63 6c 6f 6e 65 2e 20 20 54 68 69 73  g a clone.  This
1d80: 20 69 73 20 68 6f 77 20 74 68 65 20 63 6c 69 65   is how the clie
1d90: 6e 74 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68  nt determines wh
1da0: 61 74 20 70 72 6f 6a 65 63 74 0a 63 6f 64 65 20  at project.code 
1db0: 74 6f 20 70 75 74 20 69 6e 20 74 68 65 20 6e 65  to put in the ne
1dc0: 77 20 72 65 70 6f 73 69 74 6f 72 79 20 69 74 20  w repository it 
1dd0: 69 73 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 2e  is constructing.
1de0: 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 35 20 43 6c  </p>..<h3>2.5 Cl
1df0: 6f 6e 65 20 43 61 72 64 73 3c 2f 68 33 3e 0a 0a  one Cards</h3>..
1e00: 3c 70 3e 41 20 63 6c 6f 6e 65 20 63 61 72 64 20  <p>A clone card 
1e10: 77 6f 72 6b 73 20 6c 69 6b 65 20 61 20 70 75 6c  works like a pul
1e20: 6c 20 63 61 72 64 20 69 6e 20 74 68 61 74 20 69  l card in that i
1e30: 74 20 69 73 20 73 65 6e 74 20 66 72 6f 6d 0a 63  t is sent from.c
1e40: 6c 69 65 6e 74 20 74 6f 20 73 65 72 76 65 72 20  lient to server 
1e50: 69 6e 20 6f 72 64 65 72 20 74 6f 20 74 65 6c 6c  in order to tell
1e60: 20 74 68 65 20 73 65 72 76 65 72 20 74 68 61 74   the server that
1e70: 20 74 68 65 20 63 6c 69 65 6e 74 0a 77 61 6e 74   the client.want
1e80: 73 20 74 6f 20 70 75 6c 6c 20 63 6f 6e 74 65 6e  s to pull conten
1e90: 74 2e 20 20 42 75 74 20 75 6e 6c 69 6b 65 20 74  t.  But unlike t
1ea0: 68 65 20 70 75 6c 6c 20 63 61 72 64 2c 20 74 68  he pull card, th
1eb0: 65 20 63 6c 6f 6e 65 0a 63 61 72 64 20 68 61 73  e clone.card has
1ec0: 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 2e 3c 2f   no arguments.</
1ed0: 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e  p>..<blockquote>
1ee0: 0a 3c 62 3e 63 6c 6f 6e 65 3c 2f 62 3e 0a 3c 2f  .<b>clone</b>.</
1ef0: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70 3e  blockquote>..<p>
1f00: 49 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 61  In response to a
1f10: 20 63 6c 6f 6e 65 20 6d 65 73 73 61 67 65 2c 20   clone message, 
1f20: 74 68 65 20 73 65 72 76 65 72 20 61 6c 73 6f 20  the server also 
1f30: 73 65 6e 64 73 20 74 68 65 20 63 6c 69 65 6e 74  sends the client
1f40: 0a 61 20 70 75 73 68 20 6d 65 73 73 61 67 65 20  .a push message 
1f50: 73 6f 20 74 68 61 74 20 74 68 65 20 63 6c 69 65  so that the clie
1f60: 6e 74 20 63 61 6e 20 64 69 73 63 6f 76 65 72 20  nt can discover 
1f70: 74 68 65 20 70 72 6f 6a 65 63 74 63 6f 64 65 20  the projectcode 
1f80: 66 6f 72 0a 74 68 69 73 20 70 72 6f 6a 65 63 74  for.this project
1f90: 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 36 20 49  .</p>..<h3>2.6 I
1fa0: 67 6f 74 20 43 61 72 64 73 3c 2f 68 33 3e 0a 0a  got Cards</h3>..
1fb0: 3c 70 3e 41 6e 20 69 67 6f 74 20 63 61 72 64 20  <p>An igot card 
1fc0: 63 61 6e 20 62 65 20 73 65 6e 74 20 66 72 6f 6d  can be sent from
1fd0: 20 65 69 74 68 65 72 20 63 6c 69 65 6e 74 20 74   either client t
1fe0: 6f 20 73 65 72 76 65 72 20 6f 72 20 66 72 6f 6d  o server or from
1ff0: 0a 73 65 72 76 65 72 20 74 6f 20 63 6c 69 65 6e  .server to clien
2000: 74 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 69 6e  t in order to in
2010: 64 69 63 61 74 65 20 74 68 61 74 20 74 68 65 20  dicate that the 
2020: 73 65 6e 64 65 72 20 68 6f 6c 64 73 20 61 20 63  sender holds a c
2030: 6f 70 79 0a 6f 66 20 61 20 70 61 72 74 69 63 75  opy.of a particu
2040: 6c 61 72 20 66 69 6c 65 2e 20 20 54 68 65 20 66  lar file.  The f
2050: 6f 72 6d 61 74 20 69 73 3a 3c 2f 70 3e 0a 0a 3c  ormat is:</p>..<
2060: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 69  blockquote>.<b>i
2070: 67 6f 74 3c 2f 62 3e 20 3c 69 3e 75 75 69 64 3c  got</b> <i>uuid<
2080: 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65  /i>.</blockquote
2090: 3e 0a 0a 3c 70 3e 54 68 65 20 61 72 67 75 6d 65  >..<p>The argume
20a0: 6e 74 20 6f 66 20 74 68 65 20 69 67 6f 74 20 63  nt of the igot c
20b0: 61 72 64 20 69 73 20 74 68 65 20 55 55 49 44 20  ard is the UUID 
20c0: 6f 66 20 74 68 65 20 66 69 6c 65 20 74 68 61 74  of the file that
20d0: 0a 74 68 65 20 73 65 6e 64 65 72 20 70 6f 73 73  .the sender poss
20e0: 65 73 73 65 73 2e 0a 54 68 65 20 72 65 63 65 69  esses..The recei
20f0: 76 65 72 20 6f 66 20 61 6e 20 69 67 6f 74 20 63  ver of an igot c
2100: 61 72 64 20 77 69 6c 6c 20 74 79 70 69 63 61 6c  ard will typical
2110: 6c 79 20 63 68 65 63 6b 20 74 6f 20 73 65 65 20  ly check to see 
2120: 69 66 0a 69 74 20 61 6c 73 6f 20 68 6f 6c 64 73  if.it also holds
2130: 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 20 61   the same file a
2140: 6e 64 20 69 66 20 6e 6f 74 20 69 74 20 77 69 6c  nd if not it wil
2150: 6c 20 72 65 71 75 65 73 74 20 74 68 65 20 66 69  l request the fi
2160: 6c 65 0a 75 73 69 6e 67 20 61 20 67 69 6d 6d 65  le.using a gimme
2170: 20 63 61 72 64 20 69 6e 20 65 69 74 68 65 72 20   card in either 
2180: 74 68 65 20 72 65 70 6c 79 20 6f 72 20 69 6e 20  the reply or in 
2190: 74 68 65 20 6e 65 78 74 20 6d 65 73 73 61 67 65  the next message
21a0: 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 37 20 47  .</p>..<h3>2.7 G
21b0: 69 6d 6d 65 20 43 61 72 64 73 3c 2f 68 33 3e 0a  imme Cards</h3>.
21c0: 0a 3c 70 3e 41 20 67 69 6d 6d 65 20 63 61 72 64  .<p>A gimme card
21d0: 20 69 73 20 73 65 6e 74 20 66 72 6f 6d 20 65 69   is sent from ei
21e0: 74 68 65 72 20 63 6c 69 65 6e 74 20 74 6f 20 73  ther client to s
21f0: 65 72 76 65 72 20 6f 72 20 66 72 6f 6d 20 73 65  erver or from se
2200: 72 76 65 72 0a 74 6f 20 63 6c 69 65 6e 74 2e 20  rver.to client. 
2210: 20 54 68 65 20 67 69 6d 6d 65 20 63 61 72 64 20   The gimme card 
2220: 61 73 6b 73 20 74 68 65 20 72 65 63 65 69 76 65  asks the receive
2230: 72 20 74 6f 20 73 65 6e 64 20 61 20 70 61 72 74  r to send a part
2240: 69 63 75 6c 61 72 0a 66 69 6c 65 20 62 61 63 6b  icular.file back
2250: 20 74 6f 20 74 68 65 20 73 65 6e 64 65 72 2e 20   to the sender. 
2260: 20 54 68 65 20 66 6f 72 6d 61 74 20 6f 66 20 61   The format of a
2270: 20 67 69 6d 6d 65 20 63 61 72 64 20 69 73 20 74   gimme card is t
2280: 68 69 73 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b  his:</p>..<block
2290: 71 75 6f 74 65 3e 0a 3c 62 3e 67 69 6d 6d 65 3c  quote>.<b>gimme<
22a0: 2f 62 3e 20 3c 69 3e 75 75 69 64 3c 2f 69 3e 0a  /b> <i>uuid</i>.
22b0: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c  </blockquote>..<
22c0: 70 3e 54 68 65 20 61 72 67 75 6d 65 6e 74 20 74  p>The argument t
22d0: 6f 20 74 68 65 20 67 69 6d 6d 65 20 63 61 72 64  o the gimme card
22e0: 20 69 73 20 74 68 65 20 55 55 49 44 20 6f 66 20   is the UUID of 
22f0: 74 68 65 20 66 69 6c 65 20 74 68 61 74 0a 74 68  the file that.th
2300: 65 20 73 65 6e 64 65 72 20 77 61 6e 74 73 2e 20  e sender wants. 
2310: 20 54 68 65 20 72 65 63 65 69 76 65 72 20 77 69   The receiver wi
2320: 6c 6c 20 74 79 70 69 63 61 6c 6c 79 20 72 65 73  ll typically res
2330: 70 6f 6e 64 20 74 6f 20 61 0a 67 69 6d 6d 65 20  pond to a.gimme 
2340: 63 61 72 64 20 62 79 20 73 65 6e 64 69 6e 67 20  card by sending 
2350: 61 20 66 69 6c 65 20 63 61 72 64 20 69 6e 20 69  a file card in i
2360: 74 73 20 72 65 70 6c 79 20 6f 72 20 69 6e 20 74  ts reply or in t
2370: 68 65 20 6e 65 78 74 0a 6d 65 73 73 61 67 65 2e  he next.message.
2380: 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e 38 20 43 6f  </p>..<h3>2.8 Co
2390: 6f 6b 69 65 20 43 61 72 64 73 3c 2f 68 33 3e 0a  okie Cards</h3>.
23a0: 0a 3c 70 3e 41 20 63 6f 6f 6b 69 65 20 63 61 72  .<p>A cookie car
23b0: 64 20 63 61 6e 20 62 65 20 75 73 65 64 20 62 79  d can be used by
23c0: 20 61 20 73 65 72 76 65 72 20 74 6f 20 72 65 63   a server to rec
23d0: 6f 72 64 20 61 20 73 6d 61 6c 6c 20 61 6d 6f 75  ord a small amou
23e0: 6e 74 0a 6f 66 20 73 74 61 74 65 20 69 6e 66 6f  nt.of state info
23f0: 72 6d 61 74 69 6f 6e 20 6f 6e 20 61 20 63 6c 69  rmation on a cli
2400: 65 6e 74 2e 20 20 54 68 65 20 73 65 72 76 65 72  ent.  The server
2410: 20 73 65 6e 64 73 20 61 20 63 6f 6f 6b 69 65 20   sends a cookie 
2420: 74 6f 20 74 68 65 0a 63 6c 69 65 6e 74 2e 20 20  to the.client.  
2430: 54 68 65 20 63 6c 69 65 6e 74 20 73 65 6e 64 73  The client sends
2440: 20 74 68 65 20 73 61 6d 65 20 63 6f 6f 6b 69 65   the same cookie
2450: 20 62 61 63 6b 20 74 6f 20 74 68 65 20 73 65 72   back to the ser
2460: 76 65 72 20 6f 6e 0a 69 74 73 20 6e 65 78 74 20  ver on.its next 
2470: 72 65 71 75 65 73 74 2e 20 20 54 68 65 20 63 6f  request.  The co
2480: 6f 6b 69 65 20 63 61 72 64 20 68 61 73 20 61 20  okie card has a 
2490: 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74 20  single argument 
24a0: 77 68 69 63 68 0a 69 73 20 69 74 73 20 70 61 79  which.is its pay
24b0: 6c 6f 61 64 2e 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63  load.</p>..<bloc
24c0: 6b 71 75 6f 74 65 3e 0a 3c 62 3e 63 6f 6f 6b 69  kquote>.<b>cooki
24d0: 65 3c 2f 62 3e 20 3c 69 3e 70 61 79 6c 6f 61 64  e</b> <i>payload
24e0: 3c 2f 69 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  </i>.</blockquot
24f0: 65 3e 0a 0a 3c 70 3e 54 68 65 20 63 6c 69 65 6e  e>..<p>The clien
2500: 74 20 69 73 20 6e 6f 74 20 72 65 71 75 69 72 65  t is not require
2510: 64 20 74 6f 20 72 65 74 75 72 6e 20 74 68 65 20  d to return the 
2520: 63 6f 6f 6b 69 65 20 74 6f 20 74 68 65 20 73 65  cookie to the se
2530: 72 76 65 72 20 6f 6e 0a 69 74 73 20 6e 65 78 74  rver on.its next
2540: 20 72 65 71 75 65 73 74 2e 20 20 4f 72 20 74 68   request.  Or th
2550: 65 20 63 6c 69 65 6e 74 20 6d 69 67 68 74 20 73  e client might s
2560: 65 6e 64 20 61 20 63 6f 6f 6b 69 65 20 66 72 6f  end a cookie fro
2570: 6d 20 61 20 64 69 66 66 65 72 65 6e 74 0a 73 65  m a different.se
2580: 72 76 65 72 20 6f 6e 20 74 68 65 20 6e 65 78 74  rver on the next
2590: 20 72 65 71 75 65 73 74 2e 20 20 53 6f 20 74 68   request.  So th
25a0: 65 20 73 65 72 76 65 72 20 6d 75 73 74 20 6e 6f  e server must no
25b0: 74 20 64 65 70 65 6e 64 20 6f 6e 20 74 68 65 0a  t depend on the.
25c0: 63 6f 6f 6b 69 65 20 61 6e 64 20 74 68 65 20 73  cookie and the s
25d0: 65 72 76 65 72 20 6d 75 73 74 20 73 74 72 75 63  erver must struc
25e0: 74 75 72 65 20 74 68 65 20 63 6f 6f 6b 69 65 20  ture the cookie 
25f0: 70 61 79 6c 6f 61 64 20 69 6e 20 73 75 63 68 0a  payload in such.
2600: 61 20 77 61 79 20 74 68 61 74 20 69 74 20 63 61  a way that it ca
2610: 6e 20 74 65 6c 6c 20 69 66 20 74 68 65 20 63 6f  n tell if the co
2620: 6f 6b 69 65 20 69 74 20 73 65 65 73 20 69 73 20  okie it sees is 
2630: 69 74 73 20 6f 77 6e 20 63 6f 6f 6b 69 65 20 6f  its own cookie o
2640: 72 0a 61 20 63 6f 6f 6b 69 65 20 66 72 6f 6d 20  r.a cookie from 
2650: 61 6e 6f 74 68 65 72 20 73 65 72 76 65 72 2e 20  another server. 
2660: 20 28 54 79 70 69 63 61 6c 6c 79 20 74 68 65 20   (Typically the 
2670: 73 65 72 76 65 72 20 77 69 6c 6c 20 65 6d 62 65  server will embe
2680: 64 0a 69 74 73 20 73 65 72 76 65 72 63 6f 64 65  d.its servercode
2690: 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20   as part of the 
26a0: 63 6f 6f 6b 69 65 2e 29 3c 2f 70 3e 0a 0a 3c 68  cookie.)</p>..<h
26b0: 33 3e 32 2e 39 20 45 72 72 6f 72 20 43 61 72 64  3>2.9 Error Card
26c0: 73 3c 2f 68 33 3e 0a 0a 3c 70 3e 49 66 20 74 68  s</h3>..<p>If th
26d0: 65 20 73 65 72 76 65 72 20 64 69 73 63 6f 76 65  e server discove
26e0: 72 73 20 61 6e 79 74 68 69 6e 67 20 77 72 6f 6e  rs anything wron
26f0: 67 20 77 69 74 68 20 61 20 72 65 71 75 65 73 74  g with a request
2700: 2c 20 69 74 20 67 65 6e 65 72 61 74 65 73 0a 61  , it generates.a
2710: 6e 20 65 72 72 6f 72 20 63 61 72 64 20 69 6e 20  n error card in 
2720: 69 74 73 20 72 65 70 6c 79 2e 20 20 57 68 65 6e  its reply.  When
2730: 20 74 68 65 20 63 6c 69 65 6e 74 20 73 65 65 73   the client sees
2740: 20 74 68 65 20 65 72 72 6f 72 20 63 61 72 64 2c   the error card,
2750: 0a 69 74 20 64 69 73 70 6c 61 79 73 20 61 6e 20  .it displays an 
2760: 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 74 6f  error message to
2770: 20 74 68 65 20 75 73 65 72 20 61 6e 64 20 61 62   the user and ab
2780: 6f 72 74 73 20 74 68 65 20 73 79 6e 63 0a 6f 70  orts the sync.op
2790: 65 72 61 74 69 6f 6e 2e 20 20 41 6e 20 65 72 72  eration.  An err
27a0: 6f 72 20 63 61 72 64 20 6c 6f 6f 6b 73 20 6c 69  or card looks li
27b0: 6b 65 20 74 68 69 73 3a 3c 2f 70 3e 0a 0a 3c 62  ke this:</p>..<b
27c0: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 62 3e 65 72  lockquote>.<b>er
27d0: 72 6f 72 3c 2f 62 3e 20 3c 69 3e 65 72 72 6f 72  ror</b> <i>error
27e0: 2d 6d 65 73 73 61 67 65 3c 2f 69 3e 0a 3c 2f 62  -message</i>.</b
27f0: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70 3e 54  lockquote>..<p>T
2800: 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65  he error message
2810: 20 69 73 20 45 6e 67 6c 69 73 68 20 74 65 78 74   is English text
2820: 20 74 68 61 74 20 69 73 20 65 6e 63 6f 64 65 64   that is encoded
2830: 20 69 6e 20 6f 72 64 65 72 20 74 6f 0a 62 65 20   in order to.be 
2840: 61 20 73 69 6e 67 6c 65 20 74 6f 6b 65 6e 2e 0a  a single token..
2850: 41 20 73 70 61 63 65 20 28 41 53 43 49 49 20 30  A space (ASCII 0
2860: 78 32 30 29 20 69 73 20 72 65 70 72 65 73 65 6e  x20) is represen
2870: 74 65 64 20 61 73 20 22 5c 73 22 20 28 41 53 43  ted as "\s" (ASC
2880: 49 49 20 30 78 35 43 2c 20 30 78 37 33 29 2e 20  II 0x5C, 0x73). 
2890: 20 41 0a 6e 65 77 6c 69 6e 65 20 28 41 53 43 49   A.newline (ASCI
28a0: 49 20 30 78 30 61 29 20 69 73 20 22 5c 6e 22 20  I 0x0a) is "\n" 
28b0: 28 41 53 43 49 49 20 30 78 36 43 2c 20 78 36 45  (ASCII 0x6C, x6E
28c0: 29 2e 20 20 41 20 62 61 63 6b 73 6c 61 73 68 20  ).  A backslash 
28d0: 0a 28 41 53 43 49 49 20 30 78 35 43 29 20 69 73  .(ASCII 0x5C) is
28e0: 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20   represented as 
28f0: 74 77 6f 20 62 61 63 6b 73 6c 61 73 68 65 73 20  two backslashes 
2900: 22 5c 5c 22 2e 20 20 41 70 61 72 74 20 66 72 6f  "\\".  Apart fro
2910: 6d 0a 73 70 61 63 65 20 61 6e 64 20 6e 65 77 6c  m.space and newl
2920: 69 6e 65 2c 20 6e 6f 20 6f 74 68 65 72 20 77 68  ine, no other wh
2930: 69 74 65 73 70 61 63 65 20 63 68 61 72 61 63 74  itespace charact
2940: 65 72 73 20 6e 6f 72 20 61 6e 79 0a 75 6e 70 72  ers nor any.unpr
2950: 69 6e 74 61 62 6c 65 20 63 68 61 72 61 63 74 65  intable characte
2960: 72 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 69  rs are allowed i
2970: 6e 0a 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73  n.the error mess
2980: 61 67 65 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 32 2e  age.</p>..<h3>2.
2990: 31 30 20 55 6e 6b 6e 6f 77 6e 20 43 61 72 64 73  10 Unknown Cards
29a0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 49 66 20 65 69 74  </h3>..<p>If eit
29b0: 68 65 72 20 74 68 65 20 63 6c 69 65 6e 74 20 6f  her the client o
29c0: 72 20 74 68 65 20 73 65 72 76 65 72 20 73 65 65  r the server see
29d0: 73 20 61 20 63 61 72 64 20 74 68 61 74 20 69 73  s a card that is
29e0: 20 6e 6f 74 0a 64 65 73 63 72 69 62 65 64 20 61   not.described a
29f0: 62 6f 76 65 2c 20 74 68 65 6e 20 69 74 20 67 65  bove, then it ge
2a00: 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f 72  nerates an error
2a10: 20 61 6e 64 20 61 62 6f 72 74 73 2e 3c 2f 70 3e   and aborts.</p>
2a20: 0a 0a 3c 68 32 3e 33 2e 30 20 50 68 61 6e 74 6f  ..<h2>3.0 Phanto
2a30: 6d 73 20 41 6e 64 20 43 6c 75 73 74 65 72 73 3c  ms And Clusters<
2a40: 2f 68 32 3e 0a 0a 3c 70 3e 57 68 65 6e 20 61 20  /h2>..<p>When a 
2a50: 72 65 70 6f 73 69 74 6f 72 79 20 6b 6e 6f 77 73  repository knows
2a60: 20 74 68 61 74 20 61 20 66 69 6c 65 20 65 78 69   that a file exi
2a70: 73 74 73 20 61 6e 64 20 6b 6e 6f 77 73 20 74 68  sts and knows th
2a80: 65 20 55 55 49 44 20 6f 66 0a 74 68 61 74 20 66  e UUID of.that f
2a90: 69 6c 65 2c 20 62 75 74 20 69 74 20 64 6f 65 73  ile, but it does
2aa0: 20 6e 6f 74 20 6b 6e 6f 77 20 74 68 65 20 66 69   not know the fi
2ab0: 6c 65 20 63 6f 6e 74 65 6e 74 2c 20 74 68 65 6e  le content, then
2ac0: 20 69 74 20 73 74 6f 72 65 73 20 74 68 61 74 0a   it stores that.
2ad0: 66 69 6c 65 20 61 73 20 61 20 22 70 68 61 6e 74  file as a "phant
2ae0: 6f 6d 22 2e 20 20 41 20 72 65 70 6f 73 69 74 6f  om".  A reposito
2af0: 72 79 20 77 69 6c 6c 20 74 79 70 69 63 61 6c 6c  ry will typicall
2b00: 79 20 63 72 65 61 74 65 20 61 20 70 68 61 6e 74  y create a phant
2b10: 6f 6d 20 77 68 65 6e 0a 69 74 20 72 65 63 65 69  om when.it recei
2b20: 76 65 73 20 61 6e 20 69 67 6f 74 20 63 61 72 64  ves an igot card
2b30: 20 66 6f 72 20 61 20 66 69 6c 65 20 74 68 61 74   for a file that
2b40: 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 68 6f 6c   it does not hol
2b50: 64 20 6f 72 20 77 68 65 6e 20 69 74 0a 72 65 63  d or when it.rec
2b60: 65 69 76 65 73 20 61 20 66 69 6c 65 20 63 61 72  eives a file car
2b70: 64 20 74 68 61 74 20 72 65 66 65 72 65 6e 63 65  d that reference
2b80: 73 20 61 20 64 65 6c 74 61 20 73 6f 75 72 63 65  s a delta source
2b90: 20 74 68 61 74 20 69 74 20 64 6f 65 73 20 6e 6f   that it does no
2ba0: 74 0a 68 6f 6c 64 2e 20 20 57 68 65 6e 20 61 20  t.hold.  When a 
2bb0: 73 65 72 76 65 72 20 69 73 20 67 65 6e 65 72 61  server is genera
2bc0: 74 69 6e 67 20 69 74 73 20 72 65 70 6c 79 20 6f  ting its reply o
2bd0: 72 20 77 68 65 6e 20 61 20 63 6c 69 65 6e 74 20  r when a client 
2be0: 69 73 0a 67 65 6e 65 72 61 74 69 6e 67 20 61 20  is.generating a 
2bf0: 6e 65 77 20 72 65 71 75 65 73 74 2c 20 69 74 20  new request, it 
2c00: 77 69 6c 6c 20 75 73 75 61 6c 6c 79 20 73 65 6e  will usually sen
2c10: 64 20 67 69 6d 6d 65 20 63 61 72 64 73 20 66 6f  d gimme cards fo
2c20: 72 20 65 76 65 72 79 0a 70 68 61 6e 74 6f 6d 20  r every.phantom 
2c30: 74 68 61 74 20 69 74 20 68 6f 6c 64 73 2e 3c 2f  that it holds.</
2c40: 70 3e 0a 0a 3c 70 3e 41 20 63 6c 75 73 74 65 72  p>..<p>A cluster
2c50: 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 66 69   is a special fi
2c60: 6c 65 20 74 68 61 74 20 74 65 6c 6c 73 20 6f 66  le that tells of
2c70: 20 74 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f   the existence o
2c80: 66 20 6f 74 68 65 72 0a 66 69 6c 65 73 2e 20 20  f other.files.  
2c90: 41 6e 79 20 66 69 6c 65 20 69 6e 20 74 68 65 20  Any file in the 
2ca0: 72 65 70 6f 73 69 74 6f 72 79 20 74 68 61 74 20  repository that 
2cb0: 66 6f 6c 6c 6f 77 73 20 74 68 65 20 73 79 6e 74  follows the synt
2cc0: 61 63 74 69 63 20 72 75 6c 65 73 0a 6f 66 20 61  actic rules.of a
2cd0: 20 63 6c 75 73 74 65 72 20 69 73 20 63 6f 6e 73   cluster is cons
2ce0: 69 64 65 72 65 64 20 61 20 63 6c 75 73 74 65 72  idered a cluster
2cf0: 2e 3c 2f 70 3e 0a 0a 3c 70 3e 41 20 63 6c 75 73  .</p>..<p>A clus
2d00: 74 65 72 20 69 73 20 61 20 6c 69 6e 65 20 6f 72  ter is a line or
2d10: 69 65 6e 74 65 64 20 66 69 6c 65 2e 20 20 45 61  iented file.  Ea
2d20: 63 68 20 6c 69 6e 65 20 6f 66 20 61 20 63 6c 75  ch line of a clu
2d30: 73 74 65 72 0a 69 73 20 61 20 63 61 72 64 2e 20  ster.is a card. 
2d40: 20 54 68 65 20 63 61 72 64 73 20 61 72 65 20 73   The cards are s
2d50: 65 70 61 72 61 74 65 64 20 62 79 20 74 68 65 20  eparated by the 
2d60: 6e 65 77 6c 69 6e 65 20 28 22 5c 6e 22 29 20 63  newline ("\n") c
2d70: 68 61 72 61 63 74 65 72 2e 0a 45 61 63 68 20 63  haracter..Each c
2d80: 61 72 64 20 63 6f 6e 73 69 73 74 73 20 6f 66 20  ard consists of 
2d90: 61 20 73 69 6e 67 6c 65 20 63 68 61 72 61 63 74  a single charact
2da0: 65 72 20 63 61 72 64 20 74 79 70 65 2c 20 61 20  er card type, a 
2db0: 73 70 61 63 65 2c 20 61 6e 64 20 61 0a 73 69 6e  space, and a.sin
2dc0: 67 6c 65 20 61 72 67 75 6d 65 6e 74 2e 20 20 4e  gle argument.  N
2dd0: 6f 20 65 78 74 72 61 20 77 68 69 74 65 73 70 61  o extra whitespa
2de0: 63 65 20 61 6e 64 20 6e 6f 20 74 72 61 69 6c 69  ce and no traili
2df0: 6e 67 20 6f 72 20 6c 65 61 64 69 6e 67 0a 77 68  ng or leading.wh
2e00: 69 74 65 73 70 61 63 65 20 69 73 20 61 6c 6c 6f  itespace is allo
2e10: 77 65 64 2e 20 20 41 6c 6c 20 63 61 72 64 73 20  wed.  All cards 
2e20: 69 6e 20 74 68 65 20 63 6c 75 73 74 65 72 20 6d  in the cluster m
2e30: 75 73 74 20 6f 63 63 75 72 20 69 6e 0a 73 74 72  ust occur in.str
2e40: 69 63 74 20 6c 65 78 69 63 6f 67 72 61 70 68 69  ict lexicographi
2e50: 63 61 6c 20 6f 72 64 65 72 2e 3c 2f 70 3e 0a 0a  cal order.</p>..
2e60: 3c 70 3e 41 20 63 6c 75 73 74 65 72 20 63 6f 6e  <p>A cluster con
2e70: 73 69 73 74 73 20 6f 66 20 6f 6e 65 20 6f 72 20  sists of one or 
2e80: 6d 6f 72 65 20 22 4d 22 20 63 61 72 64 73 20 66  more "M" cards f
2e90: 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 73 69 6e  ollowed by a sin
2ea0: 67 6c 65 0a 22 5a 22 20 63 61 72 64 2e 20 20 45  gle."Z" card.  E
2eb0: 61 63 68 20 4d 20 63 61 72 64 20 68 6f 6c 64 73  ach M card holds
2ec0: 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 77 68 69   an argument whi
2ed0: 63 68 20 69 73 20 61 20 55 55 49 44 20 66 6f 72  ch is a UUID for
2ee0: 20 61 20 66 69 6c 65 0a 69 6e 20 74 68 65 20 72   a file.in the r
2ef0: 65 70 6f 73 69 74 6f 72 79 2e 20 20 54 68 65 20  epository.  The 
2f00: 5a 20 63 61 72 64 20 68 61 73 20 61 20 73 69 6e  Z card has a sin
2f10: 67 6c 65 20 61 72 67 75 6d 65 6e 74 20 77 68 69  gle argument whi
2f20: 63 68 20 69 73 20 74 68 65 0a 6c 6f 77 65 72 2d  ch is the.lower-
2f30: 63 61 73 65 20 68 65 78 61 64 65 63 69 6d 61 6c  case hexadecimal
2f40: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20   representation 
2f50: 6f 66 20 74 68 65 20 4d 44 35 20 63 68 65 63 6b  of the MD5 check
2f60: 73 75 6d 20 6f 66 20 61 6c 6c 0a 70 72 65 63 65  sum of all.prece
2f70: 64 69 6e 67 20 4d 20 63 61 72 64 73 20 75 70 20  ding M cards up 
2f80: 74 6f 20 61 6e 64 20 69 6e 63 6c 75 64 65 64 20  to and included 
2f90: 74 68 65 20 6e 65 77 6c 69 6e 65 20 63 68 61 72  the newline char
2fa0: 61 63 74 65 72 20 74 68 61 74 0a 6f 63 63 75 72  acter that.occur
2fb0: 72 65 64 20 6a 75 73 74 20 62 65 66 6f 72 65 20  red just before 
2fc0: 74 68 65 20 5a 20 74 68 61 74 20 73 74 61 72 74  the Z that start
2fd0: 73 20 74 68 65 20 5a 20 63 61 72 64 2e 3c 2f 70  s the Z card.</p
2fe0: 3e 0a 0a 3c 70 3e 41 6e 79 20 66 69 6c 65 20 74  >..<p>Any file t
2ff0: 68 61 74 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74  hat does not mat
3000: 63 68 20 74 68 65 20 73 70 65 63 69 66 69 63 61  ch the specifica
3010: 74 69 6f 6e 73 20 6f 66 20 61 20 63 6c 75 73 74  tions of a clust
3020: 65 72 0a 65 78 61 63 74 6c 79 20 69 73 20 6e 6f  er.exactly is no
3030: 74 20 61 20 63 6c 75 73 74 65 72 2e 20 20 54 68  t a cluster.  Th
3040: 65 72 65 20 6d 75 73 74 20 62 65 20 6e 6f 20 65  ere must be no e
3050: 78 74 72 61 20 77 68 69 74 65 73 70 61 63 65 20  xtra whitespace 
3060: 69 6e 0a 74 68 65 20 66 69 6c 65 2e 20 20 54 68  in.the file.  Th
3070: 65 72 65 20 6d 75 73 74 20 62 65 20 6f 6e 65 20  ere must be one 
3080: 6f 72 20 6d 6f 72 65 20 4d 20 63 61 72 64 73 2e  or more M cards.
3090: 20 20 54 68 65 72 65 20 6d 75 73 74 20 62 65 20    There must be 
30a0: 61 0a 73 69 6e 67 6c 65 20 5a 20 63 61 72 64 20  a.single Z card 
30b0: 77 69 74 68 20 61 20 63 6f 72 72 65 63 74 20 4d  with a correct M
30c0: 44 35 20 63 68 65 63 6b 73 75 6d 2e 20 20 41 6e  D5 checksum.  An
30d0: 64 20 61 6c 6c 20 63 61 72 64 73 20 6d 75 73 74  d all cards must
30e0: 0a 62 65 20 69 6e 20 73 74 72 69 63 74 20 6c 65  .be in strict le
30f0: 78 69 63 6f 67 72 61 70 68 69 63 61 6c 20 6f 72  xicographical or
3100: 64 65 72 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 33 2e  der.</p>..<h3>3.
3110: 31 20 54 68 65 20 55 6e 63 6c 75 73 74 65 72 65  1 The Unclustere
3120: 64 20 54 61 62 6c 65 3c 2f 68 33 3e 0a 0a 3c 70  d Table</h3>..<p
3130: 3e 45 76 65 72 79 20 72 65 70 6f 73 69 74 6f 72  >Every repositor
3140: 79 20 6d 61 69 6e 74 61 69 6e 73 20 61 20 74 61  y maintains a ta
3150: 62 6c 65 20 6e 61 6d 65 64 20 22 3c 62 3e 75 6e  ble named "<b>un
3160: 63 6c 75 73 74 65 72 65 64 3c 2f 62 3e 22 0a 77  clustered</b>".w
3170: 68 69 63 68 20 72 65 63 6f 72 64 73 20 74 68 65  hich records the
3180: 20 69 64 65 6e 74 69 74 79 20 6f 66 20 65 76 65   identity of eve
3190: 72 79 20 66 69 6c 65 20 61 6e 64 20 70 68 61 6e  ry file and phan
31a0: 74 6f 6d 20 69 74 20 68 6f 6c 64 73 20 74 68 61  tom it holds tha
31b0: 74 20 69 73 20 6e 6f 74 0a 6d 65 6e 74 69 6f 6e  t is not.mention
31c0: 65 64 20 69 6e 20 61 20 63 6c 75 73 74 65 72 2e  ed in a cluster.
31d0: 20 20 54 68 65 20 65 6e 74 72 69 65 73 20 69 6e    The entries in
31e0: 20 74 68 65 20 75 6e 63 6c 75 73 74 65 72 65 64   the unclustered
31f0: 20 74 61 62 6c 65 20 63 61 6e 0a 62 65 20 74 68   table can.be th
3200: 6f 75 67 68 74 20 6f 66 20 61 73 20 6c 65 61 76  ought of as leav
3210: 65 73 20 6f 6e 20 61 20 74 72 65 65 20 6f 66 20  es on a tree of 
3220: 66 69 6c 65 73 2e 20 20 53 6f 6d 65 20 6f 66 20  files.  Some of 
3230: 74 68 65 20 75 6e 63 6c 75 73 74 65 72 65 64 0a  the unclustered.
3240: 66 69 6c 65 73 20 77 69 6c 6c 20 62 65 20 63 6c  files will be cl
3250: 75 73 74 65 72 73 2e 20 20 54 68 6f 73 65 20 63  usters.  Those c
3260: 6c 75 73 74 65 72 73 20 6d 61 79 20 63 6f 6e 74  lusters may cont
3270: 61 69 6e 20 6f 74 68 65 72 20 63 6c 75 73 74 65  ain other cluste
3280: 72 73 2c 0a 77 68 69 63 68 20 6d 69 67 68 74 20  rs,.which might 
3290: 63 6f 6e 74 61 69 6e 20 73 74 69 6c 6c 20 6d 6f  contain still mo
32a0: 72 65 20 63 6c 75 73 74 65 72 73 2c 20 61 6e 64  re clusters, and
32b0: 20 73 6f 20 66 6f 72 74 68 2e 20 20 42 65 67 69   so forth.  Begi
32c0: 6e 6e 69 6e 67 0a 77 69 74 68 20 74 68 65 20 66  nning.with the f
32d0: 69 6c 65 73 20 69 6e 20 74 68 65 20 75 6e 63 6c  iles in the uncl
32e0: 75 73 74 65 72 65 64 20 74 61 62 6c 65 2c 20 6f  ustered table, o
32f0: 6e 65 20 63 61 6e 20 66 6f 6c 6c 6f 77 20 74 68  ne can follow th
3300: 65 20 63 68 61 69 6e 0a 6f 66 20 63 6c 75 73 74  e chain.of clust
3310: 65 72 73 20 74 6f 20 66 69 6e 64 20 65 76 65 72  ers to find ever
3320: 79 20 66 69 6c 65 20 69 6e 20 74 68 65 20 72 65  y file in the re
3330: 70 6f 73 69 74 6f 72 79 2e 3c 2f 70 3e 0a 0a 3c  pository.</p>..<
3340: 68 32 3e 34 2e 30 20 53 79 6e 63 68 72 6f 6e 69  h2>4.0 Synchroni
3350: 7a 61 74 69 6f 6e 20 53 74 72 61 74 65 67 69 65  zation Strategie
3360: 73 3c 2f 68 32 3e 0a 0a 3c 68 33 3e 34 2e 31 20  s</h2>..<h3>4.1 
3370: 50 75 6c 6c 3c 2f 68 33 3e 0a 0a 3c 70 3e 41 20  Pull</h3>..<p>A 
3380: 74 79 70 69 63 61 6c 20 70 75 6c 6c 20 6f 70 65  typical pull ope
3390: 72 61 74 69 6f 6e 20 70 72 6f 63 65 65 64 73 20  ration proceeds 
33a0: 61 73 20 73 68 6f 77 6e 20 62 65 6c 6f 77 2e 20  as shown below. 
33b0: 20 44 65 74 61 69 6c 73 0a 6f 66 20 74 68 65 20   Details.of the 
33c0: 61 63 74 75 61 6c 20 69 6d 70 6c 65 6d 65 6e 74  actual implement
33d0: 61 74 69 6f 6e 20 6d 61 79 20 76 65 72 79 20 73  ation may very s
33e0: 6c 69 67 68 74 6c 79 20 62 75 74 20 74 68 65 20  lightly but the 
33f0: 67 69 73 74 20 6f 66 0a 61 20 70 75 6c 6c 20 69  gist of.a pull i
3400: 73 20 63 61 70 74 75 72 65 64 20 69 6e 20 74 68  s captured in th
3410: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 65 70  e following step
3420: 73 3a 3c 2f 70 3e 0a 0a 3c 6f 6c 3e 0a 3c 6c 69  s:</p>..<ol>.<li
3430: 3e 54 68 65 20 63 6c 69 65 6e 74 20 73 65 6e 64  >The client send
3440: 73 20 6c 6f 67 69 6e 20 61 6e 64 20 70 75 6c 6c  s login and pull
3450: 20 63 61 72 64 73 2e 0a 3c 6c 69 3e 54 68 65 20   cards..<li>The 
3460: 63 6c 69 65 6e 74 20 73 65 6e 64 73 20 61 20 63  client sends a c
3470: 6f 6f 6b 69 65 20 63 61 72 64 20 69 66 20 69 74  ookie card if it
3480: 20 68 61 73 20 70 72 65 76 69 6f 75 73 6c 79 20   has previously 
3490: 72 65 63 65 69 76 65 64 20 61 20 63 6f 6f 6b 69  received a cooki
34a0: 65 2e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65 6e  e..<li>The clien
34b0: 74 20 73 65 6e 64 73 20 67 69 6d 6d 65 20 63 61  t sends gimme ca
34c0: 72 64 73 20 66 6f 72 20 65 76 65 72 79 20 70 68  rds for every ph
34d0: 61 6e 74 6f 6d 20 74 68 61 74 20 69 74 20 68 6f  antom that it ho
34e0: 6c 64 73 2e 0a 3c 68 72 3e 0a 3c 6c 69 3e 54 68  lds..<hr>.<li>Th
34f0: 65 20 73 65 72 76 65 72 20 63 68 65 63 6b 73 20  e server checks 
3500: 74 68 65 20 6c 6f 67 69 6e 20 70 61 73 73 77 6f  the login passwo
3510: 72 64 20 61 6e 64 20 72 65 6a 65 63 74 73 20 74  rd and rejects t
3520: 68 65 20 73 65 73 73 69 6f 6e 20 69 66 0a 74 68  he session if.th
3530: 65 20 75 73 65 72 20 64 6f 65 73 20 6e 6f 74 20  e user does not 
3540: 68 61 76 65 20 70 65 72 6d 69 73 73 69 6f 6e 20  have permission 
3550: 74 6f 20 70 75 6c 6c 2e 0a 3c 6c 69 3e 49 66 20  to pull..<li>If 
3560: 74 68 65 20 6e 75 6d 62 65 72 20 65 6e 74 72 69  the number entri
3570: 65 73 20 69 6e 20 74 68 65 20 75 6e 63 6c 75 73  es in the unclus
3580: 74 65 72 65 64 20 74 61 62 6c 65 20 6f 6e 20 74  tered table on t
3590: 68 65 20 73 65 72 76 65 72 20 69 73 0a 67 72 65  he server is.gre
35a0: 61 74 65 72 20 74 68 61 6e 20 31 30 30 2c 20 74  ater than 100, t
35b0: 68 65 6e 20 74 68 65 20 73 65 72 76 65 72 20 63  hen the server c
35c0: 6f 6e 73 74 72 75 63 74 73 20 61 20 6e 65 77 20  onstructs a new 
35d0: 63 6c 75 73 74 65 72 20 66 69 6c 65 20 74 6f 0a  cluster file to.
35e0: 63 6f 76 65 72 20 61 6c 6c 20 74 68 6f 73 65 20  cover all those 
35f0: 75 6e 63 6c 75 73 74 65 72 65 64 20 65 6e 74 72  unclustered entr
3600: 69 65 73 2e 0a 3c 6c 69 3e 54 68 65 20 73 65 72  ies..<li>The ser
3610: 76 65 72 20 73 65 6e 64 73 20 66 69 6c 65 20 63  ver sends file c
3620: 61 72 64 73 20 66 6f 72 20 65 76 65 72 79 20 67  ards for every g
3630: 69 6d 6d 65 20 63 61 72 64 20 69 74 20 72 65 63  imme card it rec
3640: 65 69 76 65 64 0a 66 72 6f 6d 20 74 68 65 20 63  eived.from the c
3650: 6c 69 65 6e 74 2e 0a 3c 6c 69 3e 54 68 65 20 73  lient..<li>The s
3660: 65 72 76 65 72 20 73 65 6e 64 73 20 69 68 61 76  erver sends ihav
3670: 65 20 63 61 72 64 73 20 66 6f 72 20 65 76 65 72  e cards for ever
3680: 79 20 66 69 6c 65 20 69 6e 20 69 74 73 20 75 6e  y file in its un
3690: 63 6c 75 73 74 65 72 65 64 0a 74 61 62 6c 65 20  clustered.table 
36a0: 74 68 61 74 20 69 73 20 6e 6f 74 20 61 20 70 68  that is not a ph
36b0: 61 6e 74 6f 6d 2e 0a 3c 68 72 3e 0a 3c 6c 69 3e  antom..<hr>.<li>
36c0: 54 68 65 20 63 6c 69 65 6e 74 20 61 64 64 73 20  The client adds 
36d0: 74 68 65 20 63 6f 6e 74 65 6e 74 20 6f 66 20 66  the content of f
36e0: 69 6c 65 20 63 61 72 64 73 20 74 6f 20 69 74 73  ile cards to its
36f0: 20 72 65 70 6f 73 69 74 6f 72 79 2e 0a 3c 6c 69   repository..<li
3700: 3e 54 68 65 20 63 6c 69 65 6e 74 20 63 72 65 61  >The client crea
3710: 74 65 73 20 61 20 70 68 61 6e 74 6f 6d 20 66 6f  tes a phantom fo
3720: 72 20 65 76 65 72 79 20 69 68 61 76 65 20 63 61  r every ihave ca
3730: 72 64 20 69 6e 20 74 68 65 20 73 65 72 76 65 72  rd in the server
3740: 20 72 65 70 6c 79 0a 74 68 61 74 20 6d 65 6e 74   reply.that ment
3750: 69 6f 6e 73 20 61 20 66 69 6c 65 20 74 68 61 74  ions a file that
3760: 20 74 68 65 20 63 6c 69 65 6e 74 20 64 6f 65 73   the client does
3770: 20 6e 6f 74 20 70 6f 73 73 65 73 73 2e 0a 3c 6c   not possess..<l
3780: 69 3e 54 68 65 20 63 6c 69 65 6e 74 20 63 72 65  i>The client cre
3790: 61 74 65 73 20 61 20 70 68 61 6e 74 6f 6d 20 66  ates a phantom f
37a0: 6f 72 20 74 68 65 20 64 65 6c 74 61 20 73 6f 75  or the delta sou
37b0: 72 63 65 20 6f 66 20 66 69 6c 65 20 63 61 72 64  rce of file card
37c0: 73 20 77 68 65 6e 0a 74 68 65 20 64 65 6c 74 61  s when.the delta
37d0: 20 73 6f 75 72 63 65 20 69 73 20 61 20 66 69 6c   source is a fil
37e0: 65 20 74 68 61 74 20 74 68 65 20 63 6c 69 65 6e  e that the clien
37f0: 74 20 64 6f 65 73 20 6e 6f 74 20 70 6f 73 73 65  t does not posse
3800: 73 73 2e 0a 3c 2f 6f 6c 3e 0a 0a 3c 70 3e 54 68  ss..</ol>..<p>Th
3810: 65 73 65 20 74 65 6e 20 73 74 65 70 73 20 72 65  ese ten steps re
3820: 70 72 65 73 65 6e 74 20 61 20 73 69 6e 67 6c 65  present a single
3830: 20 48 54 54 50 20 72 6f 75 6e 64 2d 74 72 69 70   HTTP round-trip
3840: 20 72 65 71 75 65 73 74 2e 0a 54 68 65 20 66 69   request..The fi
3850: 72 73 74 20 74 68 72 65 65 20 73 74 65 70 73 20  rst three steps 
3860: 61 72 65 20 74 68 65 20 70 72 6f 63 65 73 73 69  are the processi
3870: 6e 67 20 74 68 61 74 20 6f 63 63 75 72 73 20 6f  ng that occurs o
3880: 6e 20 74 68 65 20 63 6c 69 65 6e 74 0a 74 6f 20  n the client.to 
3890: 67 65 6e 65 72 61 74 65 20 74 68 65 20 72 65 71  generate the req
38a0: 75 65 73 74 2e 20 20 54 68 65 20 6d 69 64 64 6c  uest.  The middl
38b0: 65 20 66 6f 75 72 20 73 74 65 70 73 20 61 72 65  e four steps are
38c0: 20 70 72 6f 63 65 73 73 69 6e 67 0a 74 68 61 74   processing.that
38d0: 20 6f 63 63 75 72 73 20 6f 6e 20 74 68 65 20 73   occurs on the s
38e0: 65 72 76 65 72 20 74 6f 20 69 6e 74 65 72 70 72  erver to interpr
38f0: 65 74 20 74 68 65 20 72 65 71 75 65 73 74 20 61  et the request a
3900: 6e 64 20 67 65 6e 65 72 61 74 65 20 61 0a 72 65  nd generate a.re
3910: 70 6c 79 2e 20 20 41 6e 64 20 74 68 65 20 6c 61  ply.  And the la
3920: 73 74 20 74 68 72 65 65 20 73 74 65 70 73 20 61  st three steps a
3930: 72 65 20 74 68 65 20 70 72 6f 63 65 73 73 69 6e  re the processin
3940: 67 20 74 68 61 74 20 74 68 65 0a 63 6c 69 65 6e  g that the.clien
3950: 74 20 64 6f 65 73 20 74 6f 20 69 6e 74 65 72 70  t does to interp
3960: 72 65 74 20 74 68 65 20 72 65 70 6c 79 2e 3c 2f  ret the reply.</
3970: 70 3e 0a 0a 3c 70 3e 44 75 72 69 6e 67 20 61 20  p>..<p>During a 
3980: 70 75 6c 6c 2c 20 74 68 65 20 63 6c 69 65 6e 74  pull, the client
3990: 20 77 69 6c 6c 20 6b 65 65 70 20 73 65 6e 64 69   will keep sendi
39a0: 6e 67 20 48 54 54 50 20 72 65 71 75 65 73 74 73  ng HTTP requests
39b0: 0a 75 6e 74 69 6c 20 69 74 20 68 6f 6c 64 73 20  .until it holds 
39c0: 61 6c 6c 20 66 69 6c 65 73 20 74 68 61 74 20 65  all files that e
39d0: 78 69 73 74 20 6f 6e 20 74 68 65 20 73 65 72 76  xist on the serv
39e0: 65 72 2e 3c 2f 70 3e 0a 0a 3c 70 3e 4e 6f 74 65  er.</p>..<p>Note
39f0: 20 74 68 61 74 20 74 68 65 20 73 65 72 76 65 72   that the server
3a00: 20 74 72 69 65 73 0a 74 6f 20 6c 69 6d 69 74 20   tries.to limit 
3a10: 74 68 65 20 73 69 7a 65 20 6f 66 20 69 74 73 20  the size of its 
3a20: 72 65 70 6c 79 20 6d 65 73 73 61 67 65 20 74 6f  reply message to
3a30: 20 73 6f 6d 65 74 68 69 6e 67 20 72 65 61 73 6f   something reaso
3a40: 6e 61 62 6c 65 0a 28 75 73 75 61 6c 6c 79 20 61  nable.(usually a
3a50: 62 6f 75 74 20 31 4d 42 29 20 73 6f 20 74 68 61  bout 1MB) so tha
3a60: 74 20 69 74 20 6d 69 67 68 74 20 73 74 6f 70 20  t it might stop 
3a70: 73 65 6e 64 69 6e 67 20 66 69 6c 65 20 63 61 72  sending file car
3a80: 64 73 20 61 73 0a 64 65 73 63 72 69 62 65 64 20  ds as.described 
3a90: 69 6e 20 73 74 65 70 20 28 36 29 20 69 66 20 74  in step (6) if t
3aa0: 68 65 20 72 65 70 6c 79 20 62 65 63 6f 6d 65 73  he reply becomes
3ab0: 20 74 6f 6f 20 6c 61 72 67 65 2e 3c 2f 70 3e 0a   too large.</p>.
3ac0: 0a 3c 70 3e 53 74 65 70 20 28 35 29 20 69 73 20  .<p>Step (5) is 
3ad0: 74 68 65 20 6f 6e 6c 79 20 77 61 79 20 69 6e 20  the only way in 
3ae0: 77 68 69 63 68 20 6e 65 77 20 63 6c 75 73 74 65  which new cluste
3af0: 72 73 20 63 61 6e 20 62 65 20 63 72 65 61 74 65  rs can be create
3b00: 64 2e 0a 42 79 20 6f 6e 6c 79 20 63 72 65 61 74  d..By only creat
3b10: 69 6e 67 20 63 6c 75 73 74 65 72 73 20 6f 6e 20  ing clusters on 
3b20: 74 68 65 20 73 65 72 76 65 72 2c 20 77 65 20 68  the server, we h
3b30: 6f 70 65 20 74 6f 20 6d 69 6e 69 6d 69 7a 65 20  ope to minimize 
3b40: 74 68 65 0a 61 6d 6f 75 6e 74 20 6f 66 20 6f 76  the.amount of ov
3b50: 65 72 6c 61 70 20 62 65 74 77 65 65 6e 20 63 6c  erlap between cl
3b60: 75 73 74 65 72 73 20 69 6e 20 74 68 65 20 63 6f  usters in the co
3b70: 6d 6d 6f 6e 20 63 6f 6e 66 69 67 75 72 61 74 69  mmon configurati
3b80: 6f 6e 20 77 68 65 72 65 0a 74 68 65 72 65 20 69  on where.there i
3b90: 73 20 61 20 73 69 6e 67 6c 65 20 73 65 72 76 65  s a single serve
3ba0: 72 20 61 6e 64 20 6d 61 6e 79 20 63 6c 69 65 6e  r and many clien
3bb0: 74 73 2e 20 20 54 68 65 20 73 61 6d 65 20 73 79  ts.  The same sy
3bc0: 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 0a 70 72  nchronization.pr
3bd0: 6f 74 6f 63 6f 6c 20 77 69 6c 6c 20 63 6f 6e 74  otocol will cont
3be0: 69 6e 75 65 20 74 6f 20 77 6f 72 6b 20 65 76 65  inue to work eve
3bf0: 6e 20 69 66 20 74 68 65 72 65 20 61 72 65 20 6d  n if there are m
3c00: 75 6c 74 69 70 6c 65 20 73 65 72 76 65 72 73 0a  ultiple servers.
3c10: 6f 72 20 69 66 20 73 65 72 76 65 72 73 20 61 6e  or if servers an
3c20: 64 20 63 6c 69 65 6e 74 73 20 73 6f 6d 65 74 69  d clients someti
3c30: 6d 65 73 20 63 68 61 6e 67 65 20 72 6f 6c 65 73  mes change roles
3c40: 2e 20 20 54 68 65 20 6f 6e 6c 79 20 6e 65 67 61  .  The only nega
3c50: 74 69 76 65 0a 65 66 66 65 63 74 73 20 6f 66 20  tive.effects of 
3c60: 74 68 65 73 65 20 75 6e 75 73 75 61 6c 20 61 72  these unusual ar
3c70: 72 61 6e 67 65 6d 65 6e 74 73 20 69 73 20 74 68  rangements is th
3c80: 61 74 20 6d 6f 72 65 20 74 68 61 6e 20 74 68 65  at more than the
3c90: 20 6d 69 6e 69 6d 75 6d 0a 6e 75 6d 62 65 72 20   minimum.number 
3ca0: 6f 66 20 63 6c 75 73 74 65 72 73 20 6d 69 67 68  of clusters migh
3cb0: 74 20 62 65 20 67 65 6e 65 72 61 74 65 64 2e 3c  t be generated.<
3cc0: 2f 70 3e 0a 0a 3c 68 33 3e 34 2e 32 20 50 75 73  /p>..<h3>4.2 Pus
3cd0: 68 3c 2f 68 33 3e 0a 0a 3c 70 3e 41 20 74 79 70  h</h3>..<p>A typ
3ce0: 69 63 61 6c 20 70 75 73 68 20 6f 70 65 72 61 74  ical push operat
3cf0: 69 6f 6e 20 70 72 6f 63 65 65 64 73 20 72 6f 75  ion proceeds rou
3d00: 67 68 6c 79 20 61 73 20 73 68 6f 77 6e 20 62 65  ghly as shown be
3d10: 6c 6f 77 2e 20 20 41 73 0a 77 69 74 68 20 61 20  low.  As.with a 
3d20: 70 75 6c 6c 2c 20 74 68 65 20 61 63 74 75 61 6c  pull, the actual
3d30: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20   implementation 
3d40: 6d 61 79 20 76 61 72 79 20 73 6c 69 67 68 74 6c  may vary slightl
3d50: 79 2e 3c 2f 70 3e 0a 0a 3c 6f 6c 3e 0a 3c 6c 69  y.</p>..<ol>.<li
3d60: 3e 54 68 65 20 63 6c 69 65 6e 74 20 73 65 6e 64  >The client send
3d70: 73 20 6c 6f 67 69 6e 20 61 6e 64 20 70 75 73 68  s login and push
3d80: 20 63 61 72 64 73 2e 0a 3c 6c 69 3e 54 68 65 20   cards..<li>The 
3d90: 63 6c 69 65 6e 74 20 73 65 6e 64 73 20 66 69 6c  client sends fil
3da0: 65 20 63 61 72 64 73 20 66 6f 72 20 61 6e 79 20  e cards for any 
3db0: 66 69 6c 65 73 20 74 68 61 74 20 69 74 20 68 6f  files that it ho
3dc0: 6c 64 73 20 74 68 61 74 20 68 61 76 65 0a 6e 65  lds that have.ne
3dd0: 76 65 72 20 62 65 66 6f 72 65 20 62 65 65 6e 20  ver before been 
3de0: 70 75 73 68 65 64 20 2d 20 66 69 6c 65 73 20 74  pushed - files t
3df0: 68 61 74 20 63 6f 6d 65 20 66 72 6f 6d 20 6c 6f  hat come from lo
3e00: 63 61 6c 20 63 68 65 63 6b 2d 69 6e 73 2e 0a 3c  cal check-ins..<
3e10: 6c 69 3e 49 66 20 74 68 69 73 20 69 73 20 74 68  li>If this is th
3e20: 65 20 73 65 63 6f 6e 64 20 6f 72 20 6c 61 74 65  e second or late
3e30: 72 20 63 79 63 6c 65 20 69 6e 20 61 20 70 75 73  r cycle in a pus
3e40: 68 2c 20 74 68 65 6e 20 74 68 65 0a 63 6c 69 65  h, then the.clie
3e50: 6e 74 20 73 65 6e 64 73 20 66 69 6c 65 20 63 61  nt sends file ca
3e60: 72 64 73 20 66 6f 72 20 61 6e 79 20 67 69 6d 6d  rds for any gimm
3e70: 65 20 63 61 72 64 73 20 74 68 61 74 20 74 68 65  e cards that the
3e80: 20 73 65 72 76 65 72 20 73 65 6e 74 0a 69 6e 20   server sent.in 
3e90: 74 68 65 20 70 72 65 76 69 6f 75 73 20 63 79 63  the previous cyc
3ea0: 6c 65 2e 0a 3c 6c 69 3e 54 68 65 20 63 6c 69 65  le..<li>The clie
3eb0: 6e 74 20 73 65 6e 64 73 20 69 67 6f 74 20 63 61  nt sends igot ca
3ec0: 72 64 73 20 66 6f 72 20 65 76 65 72 79 20 66 69  rds for every fi
3ed0: 6c 65 20 69 6e 20 69 74 73 20 75 6e 63 6c 75 73  le in its unclus
3ee0: 74 65 72 65 64 20 74 61 62 6c 65 0a 74 68 61 74  tered table.that
3ef0: 20 69 73 20 6e 6f 74 20 61 20 70 68 61 6e 74 6f   is not a phanto
3f00: 6d 2e 0a 3c 68 72 3e 0a 3c 6c 69 3e 54 68 65 20  m..<hr>.<li>The 
3f10: 73 65 72 76 65 72 20 63 68 65 63 6b 73 20 74 68  server checks th
3f20: 65 20 6c 6f 67 69 6e 20 61 6e 64 20 70 75 73 68  e login and push
3f30: 20 63 61 72 64 73 20 61 6e 64 20 69 73 73 75 65   cards and issue
3f40: 73 20 61 6e 20 65 72 72 6f 72 20 69 66 0a 61 6e  s an error if.an
3f50: 79 74 68 69 6e 67 20 69 73 20 61 6d 69 73 73 2e  ything is amiss.
3f60: 0a 3c 6c 69 3e 54 68 65 20 73 65 72 76 65 72 20  .<li>The server 
3f70: 61 63 63 65 70 74 73 20 66 69 6c 65 20 63 61 72  accepts file car
3f80: 64 73 20 66 72 6f 6d 20 74 68 65 20 63 6c 69 65  ds from the clie
3f90: 6e 74 20 61 6e 64 20 61 64 64 73 20 74 68 6f 73  nt and adds thos
3fa0: 65 20 66 69 6c 65 73 0a 74 6f 20 69 74 73 20 72  e files.to its r
3fb0: 65 70 6f 73 69 74 6f 72 79 2e 0a 3c 6c 69 3e 54  epository..<li>T
3fc0: 68 65 20 73 65 72 76 65 72 20 63 72 65 61 74 65  he server create
3fd0: 73 20 70 68 61 6e 74 6f 6d 73 20 66 6f 72 20 69  s phantoms for i
3fe0: 67 6f 74 20 63 61 72 64 73 20 74 68 61 74 20 6d  got cards that m
3ff0: 65 6e 74 69 6f 6e 20 66 69 6c 65 73 20 69 74 0a  ention files it.
4000: 64 6f 65 73 20 6e 6f 74 20 70 6f 73 73 65 73 73  does not possess
4010: 20 6f 72 20 66 6f 72 20 66 69 6c 65 20 63 61 72   or for file car
4020: 64 73 20 74 68 61 74 20 6d 65 6e 74 69 6f 6e 20  ds that mention 
4030: 64 65 6c 74 61 20 73 6f 75 72 63 65 20 66 69 6c  delta source fil
4040: 65 73 20 74 68 61 74 0a 69 74 20 64 6f 65 73 20  es that.it does 
4050: 6e 6f 74 20 70 6f 73 73 65 73 73 2e 0a 3c 6c 69  not possess..<li
4060: 3e 54 68 65 20 73 65 72 76 65 72 20 69 73 73 75  >The server issu
4070: 65 73 20 67 69 6d 6d 65 20 63 61 72 64 73 20 66  es gimme cards f
4080: 6f 72 20 61 6c 6c 20 70 68 61 6e 74 6f 6d 73 2e  or all phantoms.
4090: 0a 3c 68 72 3e 0a 3c 6c 69 3e 54 68 65 20 63 6c  .<hr>.<li>The cl
40a0: 69 65 6e 74 20 72 65 6d 65 6d 62 65 72 73 20 74  ient remembers t
40b0: 68 65 20 67 69 6d 6d 65 20 63 61 72 64 73 20 66  he gimme cards f
40c0: 72 6f 6d 20 74 68 65 20 73 65 72 76 65 72 20 73  rom the server s
40d0: 6f 20 74 68 61 74 20 69 74 0a 63 61 6e 20 67 65  o that it.can ge
40e0: 6e 65 72 61 74 65 20 66 69 6c 65 20 63 61 72 64  nerate file card
40f0: 73 20 69 6e 20 72 65 70 6c 79 20 6f 6e 20 74 68  s in reply on th
4100: 65 20 6e 65 78 74 20 63 79 63 6c 65 2e 0a 3c 2f  e next cycle..</
4110: 6f 6c 3e 0a 0a 3c 70 3e 41 73 20 77 69 74 68 20  ol>..<p>As with 
4120: 61 20 70 75 6c 6c 2c 20 74 68 65 20 73 74 65 70  a pull, the step
4130: 73 20 6f 66 20 61 20 70 75 73 68 20 6f 70 65 72  s of a push oper
4140: 61 74 69 6f 6e 20 72 65 70 65 61 74 20 75 6e 74  ation repeat unt
4150: 69 6c 20 74 68 65 0a 73 65 72 76 65 72 20 6b 6e  il the.server kn
4160: 6f 77 73 20 61 6c 6c 20 66 69 6c 65 73 20 74 68  ows all files th
4170: 61 74 20 65 78 69 73 74 20 6f 6e 20 74 68 65 20  at exist on the 
4180: 63 6c 69 65 6e 74 2e 20 20 41 6c 73 6f 2c 20 61  client.  Also, a
4190: 73 20 77 69 74 68 0a 70 75 6c 6c 2c 20 74 68 65  s with.pull, the
41a0: 20 63 6c 69 65 6e 74 20 61 74 74 65 6d 70 74 73   client attempts
41b0: 20 74 6f 20 6b 65 65 70 20 74 68 65 20 73 69 7a   to keep the siz
41c0: 65 20 6f 66 20 74 68 65 20 72 65 71 75 65 73 74  e of the request
41d0: 20 66 72 6f 6d 0a 67 72 6f 77 69 6e 67 20 74 6f   from.growing to
41e0: 6f 20 6c 61 72 67 65 20 62 79 20 73 75 70 70 72  o large by suppr
41f0: 65 73 73 69 6e 67 20 66 69 6c 65 20 63 61 72 64  essing file card
4200: 73 20 6f 6e 63 65 20 74 68 65 0a 73 69 7a 65 20  s once the.size 
4210: 6f 66 20 74 68 65 20 72 65 71 75 65 73 74 20 72  of the request r
4220: 65 61 63 68 65 73 20 31 4d 42 2e 3c 2f 70 3e 0a  eaches 1MB.</p>.
4230: 0a 3c 68 33 3e 34 2e 33 20 53 79 6e 63 3c 2f 68  .<h3>4.3 Sync</h
4240: 33 3e 0a 0a 3c 70 3e 41 20 73 79 6e 63 20 69 73  3>..<p>A sync is
4250: 20 6a 75 73 74 20 61 20 70 75 6c 6c 20 61 6e 64   just a pull and
4260: 20 61 20 70 75 73 68 20 74 68 61 74 20 68 61 70   a push that hap
4270: 70 65 6e 20 61 74 20 74 68 65 20 73 61 6d 65 20  pen at the same 
4280: 74 69 6d 65 2e 0a 54 68 65 20 66 69 72 73 74 20  time..The first 
4290: 74 68 72 65 65 20 73 74 65 70 73 20 6f 66 20 61  three steps of a
42a0: 20 70 75 6c 6c 20 61 72 65 20 63 6f 6d 62 69 6e   pull are combin
42b0: 65 64 20 77 69 74 68 20 74 68 65 20 66 69 72 73  ed with the firs
42c0: 74 20 66 69 76 65 20 73 74 65 70 73 0a 6f 66 20  t five steps.of 
42d0: 61 20 70 75 73 68 2e 20 20 53 74 65 70 73 20 28  a push.  Steps (
42e0: 34 29 20 74 68 72 6f 75 67 68 20 28 37 29 20 6f  4) through (7) o
42f0: 66 20 61 20 70 75 6c 6c 20 61 72 65 20 63 6f 6d  f a pull are com
4300: 62 69 6e 65 64 20 77 69 74 68 20 73 74 65 70 73  bined with steps
4310: 0a 28 35 29 20 74 68 72 6f 75 67 68 20 28 38 29  .(5) through (8)
4320: 20 6f 66 20 61 20 70 75 73 68 2e 20 20 41 6e 64   of a push.  And
4330: 20 73 74 65 70 73 20 28 38 29 20 74 68 72 6f 75   steps (8) throu
4340: 67 68 20 28 31 30 29 20 6f 66 20 61 20 70 75 6c  gh (10) of a pul
4350: 6c 0a 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 77  l.are combined w
4360: 69 74 68 20 73 74 65 70 20 28 39 29 20 6f 66 20  ith step (9) of 
4370: 61 20 70 75 73 68 2e 3c 2f 70 3e 0a 0a 3c 68 32  a push.</p>..<h2
4380: 3e 35 2e 30 20 53 75 6d 6d 61 72 79 3c 2f 68 32  >5.0 Summary</h2
4390: 3e 0a 0a 3c 70 3e 48 65 72 65 20 61 72 65 20 74  >..<p>Here are t
43a0: 68 65 20 6b 65 79 20 70 6f 69 6e 74 73 20 6f 66  he key points of
43b0: 20 74 68 65 20 73 79 6e 63 68 72 6f 6e 69 7a 61   the synchroniza
43c0: 74 69 6f 6e 20 70 72 6f 74 6f 63 6f 6c 3a 3c 2f  tion protocol:</
43d0: 70 3e 0a 0a 3c 6f 6c 3e 0a 3c 6c 69 3e 54 68 65  p>..<ol>.<li>The
43e0: 20 63 6c 69 65 6e 74 20 73 65 6e 64 73 20 6f 6e   client sends on
43f0: 65 20 6f 72 20 6d 6f 72 65 20 50 55 53 48 20 48  e or more PUSH H
4400: 54 54 50 20 72 65 71 75 65 73 74 73 20 74 6f 20  TTP requests to 
4410: 74 68 65 20 73 65 72 76 65 72 2e 0a 20 20 20 20  the server..    
4420: 54 68 65 20 72 65 71 75 65 73 74 20 61 6e 64 20  The request and 
4430: 72 65 70 6c 79 20 63 6f 6e 74 65 6e 74 20 74 79  reply content ty
4440: 70 65 20 69 73 20 22 61 70 70 6c 69 63 61 74 69  pe is "applicati
4450: 6f 6e 2f 78 2d 66 6f 73 73 69 6c 22 2e 0a 3c 6c  on/x-fossil"..<l
4460: 69 3e 48 54 54 50 20 72 65 71 75 65 73 74 20 63  i>HTTP request c
4470: 6f 6e 74 65 6e 74 20 69 73 20 63 6f 6d 70 72 65  ontent is compre
4480: 73 73 65 64 20 75 73 69 6e 67 20 7a 6c 69 62 2e  ssed using zlib.
4490: 0a 3c 6c 69 3e 54 68 65 20 63 6f 6e 74 65 6e 74  .<li>The content
44a0: 20 6f 66 20 72 65 71 75 65 73 74 20 61 6e 64 20   of request and 
44b0: 72 65 70 6c 79 20 63 6f 6e 73 69 73 74 73 20 6f  reply consists o
44c0: 66 20 63 61 72 64 73 20 77 69 74 68 20 6f 6e 65  f cards with one
44d0: 0a 20 20 20 20 63 61 72 64 20 70 65 72 20 6c 69  .    card per li
44e0: 6e 65 2e 20 20 0a 3c 6c 69 3e 43 61 72 64 20 66  ne.  .<li>Card f
44f0: 6f 72 6d 61 74 73 20 61 72 65 3a 0a 20 20 20 20  ormats are:.    
4500: 3c 75 6c 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62  <ul>.    <li> <b
4510: 3e 6c 6f 67 69 6e 3c 2f 62 3e 20 3c 69 3e 75 73  >login</b> <i>us
4520: 65 72 69 64 20 6e 6f 6e 63 65 20 73 69 67 6e 61  erid nonce signa
4530: 74 75 72 65 3c 2f 69 3e 0a 20 20 20 20 3c 6c 69  ture</i>.    <li
4540: 3e 20 3c 62 3e 70 75 73 68 3c 2f 62 3e 20 3c 69  > <b>push</b> <i
4550: 3e 73 65 72 76 65 72 63 6f 64 65 20 70 72 6f 6a  >servercode proj
4560: 65 63 74 63 6f 64 65 3c 2f 69 3e 0a 20 20 20 20  ectcode</i>.    
4570: 3c 6c 69 3e 20 3c 62 3e 70 75 6c 6c 3c 2f 62 3e  <li> <b>pull</b>
4580: 20 3c 69 3e 73 65 72 76 65 72 63 6f 64 65 20 70   <i>servercode p
4590: 72 6f 6a 65 63 74 63 6f 64 65 3c 2f 69 3e 0a 20  rojectcode</i>. 
45a0: 20 20 20 3c 6c 69 3e 20 3c 62 3e 63 6c 6f 6e 65     <li> <b>clone
45b0: 3c 2f 62 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62  </b>.    <li> <b
45c0: 3e 66 69 6c 65 3c 2f 62 3e 20 3c 69 3e 75 75 69  >file</b> <i>uui
45d0: 64 20 73 69 7a 65 3c 2f 69 3e 20 3c 62 3e 5c 6e  d size</i> <b>\n
45e0: 3c 2f 62 3e 20 3c 69 3e 63 6f 6e 74 65 6e 74 3c  </b> <i>content<
45f0: 2f 69 3e 0a 20 20 20 20 3c 6c 69 3e 20 3c 62 3e  /i>.    <li> <b>
4600: 66 69 6c 65 3c 2f 62 3e 20 3c 69 3e 75 75 69 64  file</b> <i>uuid
4610: 20 64 65 6c 74 61 2d 75 75 69 64 20 73 69 7a 65   delta-uuid size
4620: 3c 2f 69 3e 20 3c 62 3e 5c 6e 3c 2f 62 3e 20 3c  </i> <b>\n</b> <
4630: 69 3e 63 6f 6e 74 65 6e 74 3c 2f 69 3e 0a 20 20  i>content</i>.  
4640: 20 20 3c 6c 69 3e 20 3c 62 3e 69 67 6f 74 3c 2f    <li> <b>igot</
4650: 62 3e 20 3c 69 3e 75 75 69 64 3c 2f 69 3e 0a 20  b> <i>uuid</i>. 
4660: 20 20 20 3c 6c 69 3e 20 3c 62 3e 67 69 6d 6d 65     <li> <b>gimme
4670: 3c 2f 62 3e 20 3c 69 3e 75 75 69 64 3c 2f 69 3e  </b> <i>uuid</i>
4680: 0a 20 20 20 20 3c 6c 69 3e 20 3c 62 3e 63 6f 6f  .    <li> <b>coo
4690: 6b 69 65 3c 2f 62 3e 20 20 3c 69 3e 63 6f 6f 6b  kie</b>  <i>cook
46a0: 69 65 2d 74 65 78 74 3c 2f 69 3e 0a 20 20 20 20  ie-text</i>.    
46b0: 3c 6c 69 3e 20 3c 62 3e 65 72 72 6f 72 3c 2f 62  <li> <b>error</b
46c0: 3e 20 3c 69 3e 65 72 72 6f 72 2d 6d 65 73 73 61  > <i>error-messa
46d0: 67 65 3c 2f 69 3e 0a 20 20 20 20 3c 2f 75 6c 3e  ge</i>.    </ul>
46e0: 0a 3c 6c 69 3e 50 68 61 6e 74 6f 6d 73 20 61 72  .<li>Phantoms ar
46f0: 65 20 66 69 6c 65 73 20 74 68 61 74 20 61 20 72  e files that a r
4700: 65 70 6f 73 69 74 6f 72 79 20 6b 6e 6f 77 73 20  epository knows 
4710: 65 78 69 73 74 20 62 75 74 20 64 6f 65 73 20 6e  exist but does n
4720: 6f 74 20 70 6f 73 73 65 73 73 2e 0a 3c 6c 69 3e  ot possess..<li>
4730: 43 6c 75 73 74 65 72 73 20 61 72 65 20 66 69 6c  Clusters are fil
4740: 65 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20  es that contain 
4750: 74 68 65 20 55 55 49 44 73 20 6f 66 20 6f 74 68  the UUIDs of oth
4760: 65 72 20 66 69 6c 65 73 2e 0a 3c 6c 69 3e 43 6c  er files..<li>Cl
4770: 75 73 74 65 72 73 20 61 72 65 20 63 72 65 61 74  usters are creat
4780: 65 64 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79  ed automatically
4790: 20 6f 6e 20 74 68 65 20 73 65 72 76 65 72 20 64   on the server d
47a0: 75 72 69 6e 67 20 61 20 70 75 6c 6c 2e 0a 3c 6c  uring a pull..<l
47b0: 69 3e 52 65 70 6f 73 69 74 6f 72 69 65 73 20 6b  i>Repositories k
47c0: 65 65 70 20 74 72 61 63 6b 20 6f 66 20 61 6c 6c  eep track of all
47d0: 20 66 69 6c 65 73 20 74 68 61 74 20 61 72 65 20   files that are 
47e0: 6e 6f 74 20 6e 61 6d 65 64 20 69 6e 20 61 6e 79  not named in any
47f0: 0a 63 6c 75 73 74 65 72 20 61 6e 64 20 73 65 6e  .cluster and sen
4800: 64 20 69 67 6f 74 20 6d 65 73 73 61 67 65 73 20  d igot messages 
4810: 66 6f 72 20 74 68 6f 73 65 20 66 69 6c 65 73 2e  for those files.
4820: 0a 3c 6c 69 3e 52 65 70 6f 73 69 74 6f 72 69 65  .<li>Repositorie
4830: 73 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20  s keep track of 
4840: 61 6c 6c 20 74 68 65 20 70 68 61 6e 74 6f 6d 73  all the phantoms
4850: 20 74 68 65 79 20 68 6f 6c 64 20 61 6e 64 20 73   they hold and s
4860: 65 6e 64 0a 67 69 6d 6d 65 20 6d 65 73 73 61 67  end.gimme messag
4870: 65 73 20 66 6f 72 20 74 68 6f 73 65 20 66 69 6c  es for those fil
4880: 65 73 2e 0a 3c 2f 6f 6c 3e 0a 0a 3c 2f 62 6f 64  es..</ol>..</bod
4890: 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a                 y>.</html>.