blob: 23120613d151ed9af0cce7373fa8782cbcb20881 [file] [log] [blame]
Guido van Rossum6c150461995-04-28 22:28:39 +00001Filesystem, RCS and CVS client and server classes
2=================================================
3
Guido van Rossum5f07b841995-04-26 22:57:11 +00004This directory contains various modules and classes that support
Guido van Rossum6c150461995-04-28 22:28:39 +00005remote file system operations.
6
7rrcs.py Remote RCS client command line interface
8rrcs Script to put in your bin directory
9
10rcvs.py Remote CVS client command line interface
11rcvs Script to put in your bin directory
12
13sumtree.py Old demo for FSProxy
14cmptree.py First FSProxy client (used to sync from the Mac)
15
16cvslib.py CVS admin files classes (used by rrcs)
17rcsclient.py Return an RCSProxyClient instance
18 (has reasonable default server/port/directory)
19
20FSProxy.py Filesystem interface classes
21RCSProxy.py RCS interface classes
22
23client.py Client class
24server.py Server class
25
26cmdfw.py CommandFrameWork class
27 (used by rcvs, should be used by rrcs as well)
28
29
30Client/Server operation
31-----------------------
32
33The Client and Server classes implement a simple-minded RPC protocol,
34using Python's pickle module to transfer arguments, return values and
35exceptions with the most generality. The Server class is instantiated
36with a port number on which it should listen for requests; the Client
37class is instantiated with a host name and a port number where it
38should connect to. Once a client is connected, a TCP connection is
39maintained between client and server.
40
41The Server class currently handles only one connection at a time;
42however it could be rewritten to allow various modes of operations,
43using multiple threads or processes or the select() system call as
44desired to serve multiple clients simultaneously (when using select(),
45still handling one request at a time). This would not require
46rewriting of the Client class. It may also be possible to adapt the
47code to use UDP instead of TCP, but then both classes will have to be
48rewritten (and unless extensive acknowlegements and request serial
49numbers are used, the server should handle duplicate requests, so its
50semantics should be idempotent -- shrudder).
51
52Even though the FSProxy and RCSProxy modules define client classes,
53the client class is fully generic -- what methods it supports is
54determined entirely by the server. The server class, however, must be
55derived from. This is generally done as follows:
56
57 from server import Server
58 from client import Client
59
60 # Define a class that performs the operations locally
61 class MyClassLocal:
62 def __init__(self): ...
63 def _close(self): ...
64
65 # Derive a server class using multiple inheritance
66 class MyClassServer(MyClassLocal, Server):
67 def __init__(self, address):
68 # Must initialize MyClassLocal as well as Server
69 MyClassLocal.__init__(self)
70 Server.__init__(self, address)
71 def _close(self):
72 Server._close()
73 MyClassLocal._close()
74
75 # A dummy client class
76 class MyClassClient(Client): pass
77
78Note that because MyClassLocal isn't used in the definition of
79MyClassClient, it would actually be better to place it in a separate
80module so the definition of MyClassLocal isn't executed when we only
81instantiate a client.
82
83The modules client and server should probably be renamed to Client and
84Server in order to match the class names.