
ObjStore::Reference - a listing of APIs

Fortunately,
you will probably not need to use most of the API.
In general,
the API mostly mirrors the ObjectStore C++ API.
Refer to the ObjectStore documentation for exact symantics.

Primarily, the API is exhibited here to make it seem like this extension has a difficult and steep learning curve (it doesn't).
The API for ::UNIVERSAL is probably of greatest interest to ex-C++ developers.
ObjStoreAlso see ObjStore::HV::Database.
::Server::DatabaseAlso see ObjStore::HV::Database.
This is the recommended API for roots. If the given root is not found, creates a new one. Returns the root's current value.
In general, you should try to avoid using roots. Roots have an unnatural API for perl: hashes can nest but roots cannot. Roots are similar to a necessary but annoying accounting detail. It is much better practice to use ObjStore::HV::Database or ObjStore::ServerDB.
Be aware that this method (correctly) never returns an error.
The only way to know which segments are actually created in a database is to iterate through get_all_segments.
Policy can be one of segment,
page,
or stream.
Policy can be one of as_used,
read,
or write.
Destroys the root with the given name if it exists.
::Root::TransactionObjectStore transactions and exceptions are seemlessly integrated into perl.
ObjectStore exceptions cause a die in perl just as perl exceptions can cause a transaction abort.
begin 'update', sub {
$top = $db->root('top');
$top->{abc} = 3;
die "Oops! abc should not change!"; # aborts the transaction
};
die if $@;
There are three types of transactions: read, update, and abort_only. The default is read. Read transaction are blindingly fast.
begin 'read', sub {
my $var = $db->root('top');
$var->{abc} = 7; # write to $var triggers exception
};
die if $@;
(In a read transaction, you are not allowed to modify persistent data.)
$rw should be either 'read' or 'write'. Return value of 1 == 1 second. Undef indicates that there is no timeout.
Set lock timeouts.
Dynamic transactions are also available. See ObjStore::Serve.
::SegmentPolicy can be one of segment, page, or stream.
Policy can be one of as_used, read, or write.
::NotificationEasy event dispatching for network distributed objects. See ObjStore::notify.
::UNIVERSALAll persistent objects inherit from ObjStore::UNIVERSAL.
Stringify, boolean & numeric coersion, equality tests.
os_class
Reports the natural persistent class of the object. All persistent objects must have this class in their @ISA tree.
rep_class
Reports the representation's class.
bless
In addition to the usual meaning of bless, ObjStore bless stores the current @ISA tree and the VERSION of every member of the @ISA tree.
$o-isa($baseclass)>
Whether the $baseclass was part of the @ISA tree at the moment of blessing.
$o-versionof($baseclass)>
Returns the version of the $baseclass (at the moment of blessing).
$o-subscribe()> and $o-unsubscribe()>
These might not be available per-object. Only per-segment or per-database. XXX
$o-notify($why, $when)>
Sends a notification to subscribers. When can be either 'now' or 'commit'. The $when parameter might be required. [Also under consideration is a means to bunch notifications together for batch send. XXX]
database_of and segment_of are available as methods.
posh
posh behavior can be customized by adding special methods that are detected by posh. See the posh section.
To make everything seem apparently consistent, ObjStore::Database (while not really being a storable object) is lavishly special-cased to support most (maybe all!) of the above features.