This commit was manufactured by cvs2svn to create tag 'cnrisync'.
[python/dscho.git] / Doc / libamoeba.tex
blob54a9dfbd53737624b750a9e110b3a957ecdadfd0
1 \chapter{Amoeba Specific Services}
3 \section{Built-in Module \sectcode{amoeba}}
5 \bimodindex{amoeba}
6 This module provides some object types and operations useful for
7 Amoeba applications. It is only available on systems that support
8 Amoeba operations. RPC errors and other Amoeba errors are reported as
9 the exception \code{amoeba.error = 'amoeba.error'}.
11 The module \code{amoeba} defines the following items:
13 \renewcommand{\indexsubitem}{(in module amoeba)}
14 \begin{funcdesc}{name_append}{path\, cap}
15 Stores a capability in the Amoeba directory tree.
16 Arguments are the pathname (a string) and the capability (a capability
17 object as returned by
18 \code{name_lookup()}).
19 \end{funcdesc}
21 \begin{funcdesc}{name_delete}{path}
22 Deletes a capability from the Amoeba directory tree.
23 Argument is the pathname.
24 \end{funcdesc}
26 \begin{funcdesc}{name_lookup}{path}
27 Looks up a capability.
28 Argument is the pathname.
29 Returns a
30 \dfn{capability}
31 object, to which various interesting operations apply, described below.
32 \end{funcdesc}
34 \begin{funcdesc}{name_replace}{path\, cap}
35 Replaces a capability in the Amoeba directory tree.
36 Arguments are the pathname and the new capability.
37 (This differs from
38 \code{name_append()}
39 in the behavior when the pathname already exists:
40 \code{name_append()}
41 finds this an error while
42 \code{name_replace()}
43 allows it, as its name suggests.)
44 \end{funcdesc}
46 \begin{datadesc}{capv}
47 A table representing the capability environment at the time the
48 interpreter was started.
49 (Alas, modifying this table does not affect the capability environment
50 of the interpreter.)
51 For example,
52 \code{amoeba.capv['ROOT']}
53 is the capability of your root directory, similar to
54 \code{getcap("ROOT")}
55 in C.
56 \end{datadesc}
58 \begin{excdesc}{error}
59 The exception raised when an Amoeba function returns an error.
60 The value accompanying this exception is a pair containing the numeric
61 error code and the corresponding string, as returned by the C function
62 \code{err_why()}.
63 \end{excdesc}
65 \begin{funcdesc}{timeout}{msecs}
66 Sets the transaction timeout, in milliseconds.
67 Returns the previous timeout.
68 Initially, the timeout is set to 2 seconds by the Python interpreter.
69 \end{funcdesc}
71 \subsection{Capability Operations}
73 Capabilities are written in a convenient \ASCII{} format, also used by the
74 Amoeba utilities
75 {\it c2a}(U)
76 and
77 {\it a2c}(U).
78 For example:
80 \bcode\begin{verbatim}
81 >>> amoeba.name_lookup('/profile/cap')
82 aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a
83 >>>
84 \end{verbatim}\ecode
86 The following methods are defined for capability objects.
88 \renewcommand{\indexsubitem}{(capability method)}
89 \begin{funcdesc}{dir_list}{}
90 Returns a list of the names of the entries in an Amoeba directory.
91 \end{funcdesc}
93 \begin{funcdesc}{b_read}{offset\, maxsize}
94 Reads (at most)
95 \var{maxsize}
96 bytes from a bullet file at offset
97 \var{offset.}
98 The data is returned as a string.
99 EOF is reported as an empty string.
100 \end{funcdesc}
102 \begin{funcdesc}{b_size}{}
103 Returns the size of a bullet file.
104 \end{funcdesc}
106 \begin{funcdesc}{dir_append}{}
107 \funcline{dir_delete}{}\
108 \funcline{dir_lookup}{}\
109 \funcline{dir_replace}{}
110 Like the corresponding
111 \samp{name_}*
112 functions, but with a path relative to the capability.
113 (For paths beginning with a slash the capability is ignored, since this
114 is the defined semantics for Amoeba.)
115 \end{funcdesc}
117 \begin{funcdesc}{std_info}{}
118 Returns the standard info string of the object.
119 \end{funcdesc}
121 \begin{funcdesc}{tod_gettime}{}
122 Returns the time (in seconds since the Epoch, in UCT, as for POSIX) from
123 a time server.
124 \end{funcdesc}
126 \begin{funcdesc}{tod_settime}{t}
127 Sets the time kept by a time server.
128 \end{funcdesc}