NAME

KiokuDB::LiveObjects - Live object set tracking

SYNOPSIS

$live_objects->insert( $entry => $object );

$live_objects->insert( $id => $object );

my $id = $live_objects->object_to_id( $object );

my $obj = $live_objects->id_to_object( $id );

my $scope = $live_objects->new_scope;

DESCRIPTION

This object keeps track of the set of live objects, their associated IDs, and the storage entries.

METHODS

insert

Takes pairs, id or entry as the key, and object as the value, registering the objects.

insert_entries

Takes entries and registers them without an object.

This is used when prefetching entries, before their objects are actually inflated.

objects_to_ids
object_to_id

Given objects, returns their IDs, or undef for objects which not registered.

objects_to_entries
object_to_entry

Given objects, find the corresponding entries.

ids_to_objects
id_to_object

Given IDs, find the corresponding objects.

ids_to_entries

Given IDs, find the corresponding entries.

update_entries

Given entries, replaces the live entries of the corresponding objects with the newly updated ones.

The objects must already be in the live object set.

This method is called on a successful transaction commit.

new_scope

Creates a new KiokuDB::LiveObjects::Scope, with the current scope as its parent.

current_scope

The current KiokuDB::LiveObjects::Scope instance.

This is the scope into which newly registered objects are pushed.

new_txn

Creates a new KiokuDB::LiveObjects::TXNScope, with the current txn scope as its parent.

txn_scope

The current KiokuDB::LiveObjects::TXNScope.

clear

Forces a clear of the live object set.

This removes all objects and entries, and can be useful in the case of leaks (to prevent false positives on lookups).

Note that this does not actually break the circular structures, so the leak is unresolved, but the objects are no longer considered live by the KiokuDB instance.

live_entries
live_objects
live_ids

Enumerates the live entries, objects or ids.

rollback_entries

Called by "rollback" in KiokuDB::LiveObjects::TXNScope.

remove

Removes entries from the live object set.