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