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