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