.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "KiokuDB::LiveObjects 3pm" .TH KiokuDB::LiveObjects 3pm "2014-03-25" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" KiokuDB::LiveObjects \- Live object set tracking .SH "VERSION" .IX Header "VERSION" version 0.57 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& $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; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This object keeps track of the set of live objects, their associated IDs, and the storage entries. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .IP "clear_leaks" 4 .IX Item "clear_leaks" Boolean. Defaults to false. .Sp If true, when the last known scope is removed but some objects are still live they will be removed from the live object set. .Sp Note that this does \fB\s-1NOT\s0\fR prevent leaks (memory cannot be reclaimed), it merely prevents stale objects from staying loaded. .IP "leak_tracker" 4 .IX Item "leak_tracker" This is a coderef or object. .Sp If any objects are leaked (see \f(CW\*(C`clear_leaks\*(C'\fR) then the this can be used to report them, or to break the circular structure. .Sp When an object is provided the \f(CW\*(C`leaked_objects\*(C'\fR method is called. The coderef is simply invoked with the objects as arguments. .Sp Triggered after \f(CW\*(C`clear_leaks\*(C'\fR causes \f(CW\*(C`clear\*(C'\fR to be called. .Sp For example, to break cycles you can use Data::Structure::Util's \&\f(CW\*(C`circular_off\*(C'\fR function: .Sp .Vb 1 \& use Data::Structure::Util qw(circular_off); \& \& $dir\->live_objects\->leak_tracker(sub { \& my @leaked_objects = @_; \& circular_off($_) for @leaked_objects; \& }); .Ve .IP "keep_entries" 4 .IX Item "keep_entries" \&\fB\s-1EXPERIMENTAL\s0\fR .Sp When true (the default), KiokuDB::Entries loaded from the backend or created by the collapser are kept around. .Sp This results in a considerable memory overhead, so it's no longer required. .SH "METHODS" .IX Header "METHODS" .IP "insert" 4 .IX Item "insert" Takes pairs, id or entry as the key, and object as the value, registering the objects. .IP "objects_to_ids" 4 .IX Item "objects_to_ids" .PD 0 .IP "object_to_id" 4 .IX Item "object_to_id" .PD Given objects, returns their IDs, or undef for objects which not registered. .IP "objects_to_entries" 4 .IX Item "objects_to_entries" .PD 0 .IP "object_to_entry" 4 .IX Item "object_to_entry" .PD Given objects, find the corresponding entries. .IP "ids_to_objects" 4 .IX Item "ids_to_objects" .PD 0 .IP "id_to_object" 4 .IX Item "id_to_object" .PD Given IDs, find the corresponding objects. .IP "ids_to_entries" 4 .IX Item "ids_to_entries" Given IDs, find the corresponding entries. .IP "update_entries" 4 .IX Item "update_entries" Given entries, replaces the live entries of the corresponding objects with the newly updated ones. .Sp The objects must already be in the live object set. .Sp This method is called on a successful transaction commit. .IP "new_scope" 4 .IX Item "new_scope" Creates a new KiokuDB::LiveObjects::Scope, with the current scope as its parent. .IP "current_scope" 4 .IX Item "current_scope" The current KiokuDB::LiveObjects::Scope instance. .Sp This is the scope into which newly registered objects are pushed. .IP "new_txn" 4 .IX Item "new_txn" Creates a new KiokuDB::LiveObjects::TXNScope, with the current txn scope as its parent. .IP "txn_scope" 4 .IX Item "txn_scope" The current KiokuDB::LiveObjects::TXNScope. .IP "clear" 4 .IX Item "clear" Forces a clear of the live object set. .Sp This removes all objects and entries, and can be useful in the case of leaks (to prevent false positives on lookups). .Sp 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. .IP "live_entries" 4 .IX Item "live_entries" .PD 0 .IP "live_objects" 4 .IX Item "live_objects" .IP "live_ids" 4 .IX Item "live_ids" .PD Enumerates the live entries, objects or ids. .IP "rollback_entries" 4 .IX Item "rollback_entries" Called by \*(L"rollback\*(R" in KiokuDB::LiveObjects::TXNScope. .IP "remove" 4 .IX Item "remove" Removes entries from the live object set. .ie n .IP "remove_scope $scope" 4 .el .IP "remove_scope \f(CW$scope\fR" 4 .IX Item "remove_scope $scope" Removes a scope from the set of known scopes. .Sp Also calls \f(CW\*(C`detach_scope\*(C'\fR, and calls \f(CW\*(C`KiokuDB::LiveObjects::Scope/clear\*(C'\fR on the scope itself. .ie n .IP "detach_scope $scope" 4 .el .IP "detach_scope \f(CW$scope\fR" 4 .IX Item "detach_scope $scope" Detaches \f(CW$scope\fR if it's the current scope. .Sp This prevents \f(CW\*(C`push\*(C'\fR from being called on this scope object implicitly anymore. .SH "AUTHOR" .IX Header "AUTHOR" Yuval Kogman .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.