PreviousNext

Assigning Types to Objects

An object type is a mechanism for associating a set of RPC objects and the manager whose remote procedures implement an RPC interface for those objects. Object types allow an application to cluster objects, such as computing resources, according to any relevant criteria. For example, a single accounting interface can be implemented to operate on accounting databases that contain equivalent information but that are formatted differently; each database format represents a distinct type.

To simultaneously offer alternative implementations of an RPC interface for different types of objects, a server uses alternative managers. Servers that implement each of their interfaces with only one manager can usually avoid the tasks associated with assigning object types. However, when a server offers multiple managers, each manager must be dedicated to operating on a separate type of object. In this case, a server must classify some or all of its objects into types; for example, a calendar application that specifies one non-nil type UUID for departmental calendars and another non-nil type UUID for personal calendars.

By default, objects have the nil type. Only a server that implements different managers for different objects or sets of objects needs to type classify its RPC objects. To type classify an object, a server associates the object UUID of the object with a single type UUID by calling the rpc_object_set_type( ) procedure separately for each object. To create a UUID, a server calls the uuid_create( ) routine.

The exact implementation of a manager can vary with the type of object on which each manager operates. For example, a queue-management interface may be implemented to manage print queues as objects in one case and to manage batch queues as objects in another. The following figure illustrates the use of type UUIDs to identify two types of managers.


Manager Types

When the server receives an incoming call that specifies an object UUID, the server dispatches the call to the manager for the type to which the object belongs. For information on how a type is used to select a manager for an incoming call, see Topics in RPC Application Development.