blob: 0d3df2b8b723543433d391874797b97888683353 [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
Fred Drake3a0351c1998-04-04 07:23:21 +00003\section{Built-in Module \module{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 Drakecce10901998-03-17 06:33:25 +000014\begin{funcdesc}{name_append}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000015Stores 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
Fred Drakecce10901998-03-17 06:33:25 +000034\begin{funcdesc}{name_replace}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000035Replaces 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
Fred Drakeb6ce6421998-01-19 02:51:02 +000075\emph{c2a}(U)
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000076and
Fred Drakeb6ce6421998-01-19 02:51:02 +000077\emph{a2c}(U).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000078For example:
79
Fred Drake19479911998-02-13 06:58:54 +000080\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000081>>> amoeba.name_lookup('/profile/cap')
82aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a
83>>>
Fred Drake19479911998-02-13 06:58:54 +000084\end{verbatim}
Guido van Rossume47da0a1997-07-17 16:34:52 +000085%
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000086The following methods are defined for capability objects.
87
Fred Drake19479911998-02-13 06:58:54 +000088\setindexsubitem{(capability method)}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000089\begin{funcdesc}{dir_list}{}
90Returns a list of the names of the entries in an Amoeba directory.
91\end{funcdesc}
92
Fred Drakecce10901998-03-17 06:33:25 +000093\begin{funcdesc}{b_read}{offset, maxsize}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000094Reads (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}{}
Fred Drake65b32f71998-02-09 20:27:12 +0000122Returns the time (in seconds since the Epoch, in UCT, as for \POSIX{}) from
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000123a time server.
124\end{funcdesc}
125
126\begin{funcdesc}{tod_settime}{t}
127Sets the time kept by a time server.
128\end{funcdesc}