/Demo/pdist/README

http://unladen-swallow.googlecode.com/ · #! · 121 lines · 91 code · 30 blank · 0 comment · 0 complexity · 0ba61ac915224fa0a88addaae8f339a9 MD5 · raw file

  1. Filesystem, RCS and CVS client and server classes
  2. =================================================
  3. *** See the security warning at the end of this file! ***
  4. This directory contains various modules and classes that support
  5. remote file system operations.
  6. CVS stuff
  7. ---------
  8. rcvs Script to put in your bin directory
  9. rcvs.py Remote CVS client command line interface
  10. cvslib.py CVS admin files classes (used by rrcs)
  11. cvslock.py CVS locking algorithms
  12. RCS stuff
  13. ---------
  14. rrcs Script to put in your bin directory
  15. rrcs.py Remote RCS client command line interface
  16. rcsclient.py Return an RCSProxyClient instance
  17. (has reasonable default server/port/directory)
  18. RCSProxy.py RCS proxy and server classes (on top of rcslib.py)
  19. rcslib.py Local-only RCS base class (affects stdout &
  20. local work files)
  21. FSProxy stuff
  22. -------------
  23. sumtree.py Old demo for FSProxy
  24. cmptree.py First FSProxy client (used to sync from the Mac)
  25. FSProxy.py Filesystem interface classes
  26. Generic client/server stuff
  27. ---------------------------
  28. client.py Client class
  29. server.py Server class
  30. security.py Security mix-in class (not very secure I think)
  31. Other generic stuff
  32. -------------------
  33. cmdfw.py CommandFrameWork class
  34. (used by rcvs, should be used by rrcs as well)
  35. Client/Server operation
  36. -----------------------
  37. The Client and Server classes implement a simple-minded RPC protocol,
  38. using Python's pickle module to transfer arguments, return values and
  39. exceptions with the most generality. The Server class is instantiated
  40. with a port number on which it should listen for requests; the Client
  41. class is instantiated with a host name and a port number where it
  42. should connect to. Once a client is connected, a TCP connection is
  43. maintained between client and server.
  44. The Server class currently handles only one connection at a time;
  45. however it could be rewritten to allow various modes of operations,
  46. using multiple threads or processes or the select() system call as
  47. desired to serve multiple clients simultaneously (when using select(),
  48. still handling one request at a time). This would not require
  49. rewriting of the Client class. It may also be possible to adapt the
  50. code to use UDP instead of TCP, but then both classes will have to be
  51. rewritten (and unless extensive acknowlegements and request serial
  52. numbers are used, the server should handle duplicate requests, so its
  53. semantics should be idempotent -- shrudder).
  54. Even though the FSProxy and RCSProxy modules define client classes,
  55. the client class is fully generic -- what methods it supports is
  56. determined entirely by the server. The server class, however, must be
  57. derived from. This is generally done as follows:
  58. from server import Server
  59. from client import Client
  60. # Define a class that performs the operations locally
  61. class MyClassLocal:
  62. def __init__(self): ...
  63. def _close(self): ...
  64. # Derive a server class using multiple inheritance
  65. class MyClassServer(MyClassLocal, Server):
  66. def __init__(self, address):
  67. # Must initialize MyClassLocal as well as Server
  68. MyClassLocal.__init__(self)
  69. Server.__init__(self, address)
  70. def _close(self):
  71. Server._close()
  72. MyClassLocal._close()
  73. # A dummy client class
  74. class MyClassClient(Client): pass
  75. Note that because MyClassLocal isn't used in the definition of
  76. MyClassClient, it would actually be better to place it in a separate
  77. module so the definition of MyClassLocal isn't executed when we only
  78. instantiate a client.
  79. The modules client and server should probably be renamed to Client and
  80. Server in order to match the class names.
  81. *** Security warning: this version requires that you have a file
  82. $HOME/.python_keyfile at the server and client side containing two
  83. comma- separated numbers. The security system at the moment makes no
  84. guarantees of actuallng being secure -- however it requires that the
  85. key file exists and contains the same numbers at both ends for this to
  86. work. (You can specify an alternative keyfile in $PYTHON_KEYFILE).
  87. Have a look at the Security class in security.py for details;
  88. basically, if the key file contains (x, y), then the security server
  89. class chooses a random number z (the challenge) in the range
  90. 10..100000 and the client must be able to produce pow(z, x, y)
  91. (i.e. z**x mod y).