What is Objectivity/DB clustering mechanism? Clustering is the process of assigning a new container or basic object to a storage location in a federated database. It is an application’s basic mechanism for specifying where to store a persistent object in the logical storage hierarchy, which in turn controls the object’s location in physical storage. When you create an instance of a persistence-capable class, you must cluster it to make it persistent (instead of transient). Clustering a container assigns it to a database; clustering a basic object assigns it to a container. What is a cluster strategy? A clustering strategy is an instance of the class ooClusterStrategy or one of its derived classes. An instance of ooClusterStrategy is called a standard clustering strategy. If you need special clustering behavior, you can define your own clustering-strategy classes; an instance of an application-defined clustering-strategy class is called a custom clustering strategy. A clustering strategy has two properties or clustering characteristics that affect the
➤ Its new-container type determines what class of container the clustering strategy creates when needed to accommodate a new basic object. What are clustering priorities? Each clustering strategy has clustering priorities that constitute an ordered set of clustering rules for determining the storage location for a new basic object. These rules select a location for the new object relative to an existing object in the federated database—namely, the clustering directive specified to operator new. Clustering priorities are specified with a bit mask; each bit in the mask corresponds to a particular clustering rule that can be applied. If the bit is set, the corresponding rule is used; if the bit is not set, the rule is not used. Each clustering-rule constant has an integer value whose binary representation sets one bit in the bit mask. What is a clustering rule? A clustering rule specifies a location relative to the clustering directive. The location “closest” to the clustering directive is on the same logical page; the location “farthest” from the clustering directive is in a new container in a new database. What are Objectivity/DB's default clustering priorities? When a session is created, its clustering strategy is created with default clustering priorities, which consist of the following three clustering rules: oocSamePage, oocOtherPage, and oocNewPage. The default priorities represent the basic Objectivity/DB clustering behavior, which controls the choice of logical page within an existing container indicated by the clustering directive. In particular, when combined with a clustering directive near, the default priorities cause a new basic object to be clustered as follows:
➤ If near specifies a container, the new basic object is put in that container—on an existing logical page, if possible, or else on a new logical page. The operation fails if a new logical page cannot be added. ➤ If near specifies a database, the new basic object is put in the default container of the database—on an existing logical page, if possible, or else on a new logical page. The operation fails if a new logical page cannot be added. How do I create a clustering rule? When you set the clustering priorities for a clustering strategy, you can indicate either a single clustering-rule constant, or a combination of clustering rules—an integer value whose binary representation can be interpreted as a bit mask that stores a combination of the desired clustering rules. You can specify a combination by using the C++ bitwise OR operator (|) to combine the desired clustering-rule constants. For code examples on how to cluster objects, visit our How To's section. |
|||
