Streams and persistent storage

The CommonPoint application system uses two types of persistent storage. Streams provide a linear or serial form of persistence. Streams flatten objects to represent them as a sequence of bytes in computer memory or in a file. The second type of persistent storage permits random access to stored objects. Random access persistent storage lets you save and retrieve objects as individual units as though you were using a database or a dictionary. In contrast, objects or collections flattened to streams and resurrected from streams don't allow access to individual components. With stream-based persistence, all objects and their subcomponents are processed as a single unit.

See Chapter 4, "Persistent object storage," for more information on random access persistent storage implemented as a disk-based dictionary. The general protocol of disk-based persistent storage is compatible with the interface protocol for dictionaries described in Chapter 1, "Collections." Using a dictionary protocol for accessing persistent objects makes it possible to store any object desired in a disk dictionary, in any order, without disturbing other objects already in the dictionary. Given a key, a persistent storage dictionary returns the value (object) associated with the key, or allows you to store a new object in the location associated with the key. With streams, however, this random access to individual objects is not possible.

Streams are more like serial devices than random access storage. This does not mean that you can't access any particular byte in a stream. As with files, random access to bytes in the middle of a stream is possible, but you cannot change the representation of an object in a stream without rewriting the entire stream from the point of insertion to the end of the stream. The random access protocol provided by dictionaries is the primary difference between the serial streams and random access persistent storage.

Think of streams as serial by nature, like a magnetic tape, or even a sequence of bytes similar to a file stream or pipe in AIX. You can preserve objects in your application, or send them to other computers by streaming them as a sequence of bytes which represent the objects in a serial or flattened form. These streams can be written either to memory, or to disk files.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker