KiokuDB::LiveObjects - Live object set tracking
version 0.57
$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;
This object keeps track of the set of live objects, their associated IDs, and the storage entries.
Boolean. Defaults to false.
If true, when the last known scope is removed but some objects are still live they will be removed from the live object set.
Note that this does NOT prevent leaks (memory cannot be reclaimed), it merely prevents stale objects from staying loaded.
This is a coderef or object.
If any objects are leaked (see clear_leaks) then the this can be used to report them, or to break the circular structure.
clear_leaks
When an object is provided the leaked_objects method is called. The coderef is simply invoked with the objects as arguments.
leaked_objects
Triggered after clear_leaks causes clear to be called.
clear
For example, to break cycles you can use Data::Structure::Util's circular_off function:
circular_off
use Data::Structure::Util qw(circular_off); $dir->live_objects->leak_tracker(sub { my @leaked_objects = @_; circular_off($_) for @leaked_objects; });
EXPERIMENTAL
When true (the default), KiokuDB::Entries loaded from the backend or created by the collapser are kept around.
This results in a considerable memory overhead, so it's no longer required.
Takes pairs, id or entry as the key, and object as the value, registering the objects.
Given objects, returns their IDs, or undef for objects which not registered.
Given objects, find the corresponding entries.
Given IDs, find the corresponding objects.
Given IDs, find the corresponding 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.
Creates a new KiokuDB::LiveObjects::Scope, with the current scope as its parent.
The current KiokuDB::LiveObjects::Scope instance.
This is the scope into which newly registered objects are pushed.
Creates a new KiokuDB::LiveObjects::TXNScope, with the current txn scope as its parent.
The current KiokuDB::LiveObjects::TXNScope.
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.
Enumerates the live entries, objects or ids.
Called by "rollback" in KiokuDB::LiveObjects::TXNScope.
Removes entries from the live object set.
Removes a scope from the set of known scopes.
Also calls detach_scope, and calls KiokuDB::LiveObjects::Scope/clear on the scope itself.
detach_scope
KiokuDB::LiveObjects::Scope/clear
Detaches $scope if it's the current scope.
$scope
This prevents push from being called on this scope object implicitly anymore.
push
Yuval Kogman <nothingmuch@woobling.org>
This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install KiokuDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm KiokuDB
CPAN shell
perl -MCPAN -e shell install KiokuDB
For more information on module installation, please visit the detailed CPAN module installation guide.