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