31: Using Packages
- Global memory among processes
- A package provides access to common data among processes (as opposed to operation calling, which involves only two processes)
- Packages work only within a single engine place.
- Only objects with the PackageProcess mix-in have packages.
- In Telescript built-ins, only processes have packages
- A package is a dictionary of with keys and associated values.
- Each package has an assigned telename so that it can be easily found and referenced.
- Each process has a publicPackages and privatePackages attribute.
- publicPackages is a list of packages that are made available to any process, including itself.
- The list of packages starts with the packages provided by the process itself, follows with the packages provided by the place it occupies, then follows (if they exist) with the packages of the superplace of the place, and so on until it ends with the packages of the engine place.
- The publicPackages list is created when a process is constructed.
- New packages can be added (via the list op on publicPackages) after a process is constructed. If the process is a place, all subplaces automatically know about the package because the packages are provided via reference in the effective package, so any package update is immediately available in the package list.
- To get an entry in a public package, a process provides a key. The process looks for the key starting with the first package in the list. If it find it, it returns the value. If not, it looks in the next package, and continues until it either finds a match or reaches the end of the package list.
- This package list search algorithm creates an effective package; that is, in effect, a single package. A search for a key returns a match from the package that is closest to the current process or its place of residence. Subplace packages with keys identical to superplace packages override the key/value pair in the superplace packages.
- privatePackages is a list of packages that are searched only by the process itself.
- When a process checks its private packages, an effective package is formed with the private packages first in the list followed by all the public packages.
- Private packages allow a process to privately override any public package entries.
- Adding entries to packages, removing entries from packages, modifying package entries.
- Reading package entries
- A package returns a reference to an entry; the retrieving process can use that reference to examine the contents of the package entry.
- Typical package contents
- Newly constructed classes (via module) are stored in the public package of a place--usually the engine place so they're available to all processes running in the engine place.
- Shared objects such as Magic Cap forms
- Configuration information
- Object interchange data
- The region's address card
- Localized text
- The region's address card
- Anything that you want to share across the region
- The decode op of the OctetString class
TS Ref - 26 JUN 1996
Generated by the sweat of Mike Boom's brow.