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