ObjectStore C++ API Reference

os_retain_address

The class os_retain_address allows an application to specify that certain address ranges be kept assigned across calls to objectstore::release_persistent_addresses() and top-level transactions. The interface to os_retain_address is similar to the interface to os_pvar. The os_retain_address constructor takes a pointer to a transient pointer that the application wants to remain assigned.

A single os_retain_address instance can track modifications made to a pointer. When the client releases address space, it iterates through all os_retain_address instances and dereferences their ptr_to_ptr to determine which address ranges should be retained. There are no error states: if ptr_to_ptr is NULL, or if it points to a pointer that does not point into persistent space, no error is signaled, and no address range is retained by the os_retain_address instance. Since address space is reserved in 64 KB units, the amount of address space reserved by a single os_retain_address is some multiple of 64 KB- usually, for objects 64 KB or smaller, it is just 64 KB.

Like os_pvars, os_retain_address inherits from basic_undo, and so all instances must be on the stack (correspond to automatic C++ variables). When an instance of os_retain_address is deleted, it is removed from consideration by the client.

More than one instance of os_retain_address can refer to the same persistent address. As long as at least one instance of os_retain_address refers to a persistent address when the client releases addresses, that persistent address is retained.

The retaining function member returns the persistent address pointed to by the ptr_to_ptr data member, or NULL if the ptr_to_ptr is NULL. Calling the release function member is equivalent to calling set_retain(NULL).

Use of Pvars

Instances of os_pvar are treated specially by the address release operation when called within a transaction. Any such os_pvars that are "active" when address space is released act like instances of os_retain_address - the persistent address that they refer to continues to be assigned. However, unlike os_retain_address, active os_pvars do not hold address space across transaction boundaries when objectstore::retain_persistent_addresses() is not operating

os_retain_address::os_retain_address()

os_retain_address::os_retain_address(void **ptr_to_ptr);

os_retain_address::retaining()

void *os_retain_address::retaining() const;

os_retain_address::release()

void os_retain_address::release();

os_retain_address::set_retain()

void os_retain_address::set_retain(void **ptr_to_ptr);
The os_retain_address::set_retain() function member can be used to change the pointer to a transient pointer.

.



[previous] [next]

Copyright © 1997 Object Design, Inc. All rights reserved.

Updated: 03/31/98 17:25:09