| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package KiokuDB::Collapser; | ||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 20 | ▶ | no warnings 'recursion'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 20 | ▶ | use Scope::Guard; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 20 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 20 | ▶ | use Scalar::Util qw(isweak refaddr reftype); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 20 | ▶ | use KiokuDB::Entry; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 20 | ▶ | use KiokuDB::Entry::Skip; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 20 | ▶ | use KiokuDB::Reference; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 20 | ▶ | use KiokuDB::Collapser::Buffer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 20 | ▶ | use KiokuDB::Error::UnknownObjects; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 20 | ▶ | use Data::Visitor 0.18; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 20 | ▶ | use Set::Object qw(set); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 20 | ▶ | use namespace::clean -except => 'meta'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 20 | extends qw(Data::Visitor); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 20 | with qw(KiokuDB::Role::UUIDs); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 20 | has '+tied_as_objects' => ( default => 1 ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 20 | has live_objects => ( | |||||||||||||||||||||||||||
| 31 | isa => "KiokuDB::LiveObjects", | ||||||||||||||||||||||||||||
| 32 | is => "ro", | ||||||||||||||||||||||||||||
| 33 | required => 1, | ||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 20 | has backend => ( | |||||||||||||||||||||||||||
| 37 | does => "KiokuDB::Backend", | ||||||||||||||||||||||||||||
| 38 | is => "ro", | ||||||||||||||||||||||||||||
| 39 | required => 1, | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 20 | has typemap_resolver => ( | |||||||||||||||||||||||||||
| 43 | isa => "KiokuDB::TypeMap::Resolver", | ||||||||||||||||||||||||||||
| 44 | is => "ro", | ||||||||||||||||||||||||||||
| 45 | handles => [qw(collapse_method id_method)], | ||||||||||||||||||||||||||||
| 46 | required => 1, | ||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 20 | has compact => ( | |||||||||||||||||||||||||||
| 50 | isa => "Bool", | ||||||||||||||||||||||||||||
| 51 | is => "rw", | ||||||||||||||||||||||||||||
| 52 | default => 1, | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 20 | has '+weaken' => ( | |||||||||||||||||||||||||||
| 56 | default => 0, | ||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 20 | has '_buffer' => ( | |||||||||||||||||||||||||||
| 60 | isa => "KiokuDB::Collapser::Buffer", | ||||||||||||||||||||||||||||
| 61 | is => "ro", | ||||||||||||||||||||||||||||
| 62 | clearer => "_clear_buffer", | ||||||||||||||||||||||||||||
| 63 | writer => "_set_buffer", | ||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | sub collapse { | ||||||||||||||||||||||||||||
| 67 | 1356 | ▶ | my ( $self, %args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
collapse: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1356 | my $objects = delete $args{objects}; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1356 | my $r; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 1356 | ▶ | if ( $args{shallow} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 405 | $args{only} = set(@$objects); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 1356 | my $buf = KiokuDB::Collapser::Buffer->new( | |||||||||||||||||||||||||||
| 78 | live_objects => $self->live_objects, | ||||||||||||||||||||||||||||
| 79 | options => \%args, | ||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1356 | ▶ | my $g = Scope::Guard->new(sub { $self->_clear_buffer }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 83 | 1356 | $self->_set_buffer($buf); | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | # recurse through the object, accumilating entries | ||||||||||||||||||||||||||||
| 86 | 1356 | $self->visit(@$objects); | |||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1338 | my @ids = $buf->merged_objects_to_ids(@$objects); | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 1338 | $buf->first_class->insert(@ids); | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | # compact UUID space by merging simple non shared structures into a single | ||||||||||||||||||||||||||||
| 93 | # deep entry | ||||||||||||||||||||||||||||
| 94 | 1338 | ▶ | $buf->compact_entries if $self->compact; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 1338 | return ( $buf, @ids ); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | sub may_compact { | ||||||||||||||||||||||||||||
| 100 | 68 | ▶ | my ( $self, $ref_or_id ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
may_compact: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 68 | ▶ | my $id = ref($ref_or_id) ? $ref_or_id->id : $ref_or_id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 68 | not $self->_buffer->first_class->includes($id); | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | sub make_entry { | ||||||||||||||||||||||||||||
| 108 | 9254 | ▶ | my ( $self, %args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_entry: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 9254 | ▶ | my $meta = delete $args{meta} || {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'meta'} || {}
MC/DC0%0/1
delete $args{'meta'} || {}
delete $args{'meta'}
Truth table50%1/2
A
A= delete $args{'meta'}
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 9254 | my $object = $args{object}; | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 9254 | ▶ | if ( my $id = $args{id} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 9150 | my $l = $self->live_objects; | |||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 9150 | my $prev = $l->object_to_entry($object); | |||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 9150 | ▶ | if ( !$prev and $l->id_in_storage($id) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $prev and $l->id_in_storage($id)
MC/DC100%2/2
not $prev and $l->id_in_storage($id)
not $prev
$l->id_in_storage($id)
Truth table100%3/3
not(A) and B
A= not $prevB= $l->id_in_storage($id)
| |||||||||||||||||||||||||||||
| 120 | # FIXME Backend->store( insert => [ ... ], update => [ ... ] ) | ||||||||||||||||||||||||||||
| 121 | # this happens when keep_entries is false | ||||||||||||||||||||||||||||
| 122 | 105 | $prev = KiokuDB::Entry->new( root => $l->id_in_root_set($id) ); # force the operation to be an update | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 9150 | ▶ | my $entry = KiokuDB::Entry->new( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | ( $prev ? ( prev => $prev ) : () ), | ||||||||||||||||||||||||||||
| 127 | %args, | ||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 9150 | $self->_buffer->insert_entry( $id => $entry, $object, %$meta ); | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 9150 | return $entry; | |||||||||||||||||||||||||||
| 133 | } else { | ||||||||||||||||||||||||||||
| 134 | # intrinsic | ||||||||||||||||||||||||||||
| 135 | 104 | my $entry = KiokuDB::Entry->new(%args); | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 104 | $self->_buffer->insert_intrinsic( $object => $entry, %$meta ); | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 104 | return $entry; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | sub make_skip_entry { | ||||||||||||||||||||||||||||
| 144 | 135 | ▶ | my ( $self, %args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_skip_entry: called CC=4 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 135 | my $object = $args{object}; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 135 | ▶ | my $prev = $args{prev} || $self->live_objects->object_to_entry($object); | ||||||||||||||||||||||||||
|
Condition66%2/3
$args{'prev'} || $self->live_objects->object_to_entry($object)
MC/DC50%1/2
$args{'prev'} || $self->live_objects->object_to_entry($object)
$args{'prev'}
$self->live_objects->object_to_entry($object)
Truth table66%2/3
A || B
A= $args{'prev'}B= $self->live_objects->object_to_entry($object)
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 135 | my $id = $args{id}; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 135 | ▶ | unless ( $id ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 0 | ▶ | croak "skip entries must have an ID" unless $prev; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 0 | $id = $prev->id; | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 135 | return undef; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | sub make_ref { | ||||||||||||||||||||||||||||
| 161 | 12209 | ▶ | my ( $self, $id, $value ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_ref: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 12209 | my $weak = isweak($_[2]); | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 12209 | ▶ | $self->_buffer->first_class->insert($id) if $weak; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 12209 | ▶ | return KiokuDB::Reference->new( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | id => $id, | ||||||||||||||||||||||||||||
| 169 | $weak ? ( is_weak => 1 ) : () | ||||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | sub visit_seen { | ||||||||||||||||||||||||||||
| 174 | 2254 | ▶ | my ( $self, $seen, $prev ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
visit_seen: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 2254 | my $b = $self->_buffer; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 2254 | ▶ | if ( my $entry = $b->intrinsic_entry($seen) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 179 | 0 | return $entry->clone; | |||||||||||||||||||||||||||
| 180 | ▶ | } elsif ( my $id = $self->_buffer->object_to_id($seen) || $self->live_objects->object_to_id($seen) ) { | |||||||||||||||||||||||||||
|
Condition100%3/3
$self->_buffer->object_to_id($seen) || $self->live_objects->object_to_id($seen)
MC/DC100%2/2
$self->_buffer->object_to_id($seen) || $self->live_objects->object_to_id($seen)
$self->_buffer->object_to_id($seen)
$self->live_objects->object_to_id($seen)
Truth table100%3/3
A || B
A= $self->_buffer->object_to_id($seen)B= $self->live_objects->object_to_id($seen)
| |||||||||||||||||||||||||||||
| 181 | 2253 | ▶ | $self->_buffer->first_class->insert($id) unless blessed($seen); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | # return a uuid ref | ||||||||||||||||||||||||||||
| 184 | 2253 | return $self->make_ref( $id => $_[1] ); | |||||||||||||||||||||||||||
| 185 | } else { | ||||||||||||||||||||||||||||
| 186 | 1 | KiokuDB::Error::UnknownObjects->throw( objects => [ $seen ] ); | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | sub visit_ref_fallback { | ||||||||||||||||||||||||||||
| 191 | 8000 | ▶ | my ( $self, $ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
visit_ref_fallback: called CC=11 SCAR=27.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 8000 | my $o = $self->_buffer->options; | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 8000 | ▶ | if ( my $entry = $o->{only_in_storage} && $self->live_objects->object_to_entry($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$o->{'only_in_storage'} && $self->live_objects->object_to_entry($ref)
MC/DC0%0/2
$o->{'only_in_storage'} && $self->live_objects->object_to_entry($ref)
$o->{'only_in_storage'}
$self->live_objects->object_to_entry($ref)
Truth table66%2/3
A && B
A= $o->{'only_in_storage'}B= $self->live_objects->object_to_entry($ref)
| |||||||||||||||||||||||||||||
| 196 | 0 | return $self->make_ref( $entry->id => $_[1] ); | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 8000 | ▶ | if ( my $id = $self->_ref_id($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 200 | 6192 | ▶ | if ( !$self->compact and my $only = $o->{only} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $self->compact and my $only = $o->{"only"}
MC/DC0%0/2
not $self->compact and my $only = $o->{"only"}
not $self->compact
my $only = $o->{"only"}
Truth table66%2/3
not(A) and B
A= not $self->compactB= my $only = $o->{"only"}
| |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | unless ( $only->contains($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | 0 | return $self->make_ref( $id => $_[1] ); | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 6192 | my $collapsed = $self->visit_ref_data($_[1]); | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 6192 | ▶ | if ( ref($collapsed) eq 'KiokuDB::Reference' and $collapsed->id eq $id ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $collapsed eq "KiokuDB::Reference" and $collapsed->id eq $id
MC/DC100%2/2
ref $collapsed eq "KiokuDB::Reference" and $collapsed->id eq $id
ref $collapsed eq "KiokuDB::Reference"
$collapsed->id eq $id
Truth table100%3/3
A and B
A= ref $collapsed eq "KiokuDB::Reference"B= $collapsed->id eq $id
| |||||||||||||||||||||||||||||
| 209 | 33 | return $collapsed; # tied | |||||||||||||||||||||||||||
| 210 | } else { | ||||||||||||||||||||||||||||
| 211 | 6159 | push @{ $self->_buffer->simple_entries }, $id; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 6159 | $self->make_entry( | |||||||||||||||||||||||||||
| 214 | id => $id, | ||||||||||||||||||||||||||||
| 215 | object => $ref, | ||||||||||||||||||||||||||||
| 216 | data => $collapsed, | ||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 6159 | return $self->make_ref( $id => $_[1] ); | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | ▶ | } elsif ( $self->compact and not isweak($_[1]) ) { | |||||||||||||||||||||||||||
|
Condition33%1/3
$self->compact and not builtin::is_weak($_[1])
MC/DC0%0/2
$self->compact and not builtin::is_weak($_[1])
$self->compact
not builtin::is_weak($_[1])
Truth table33%1/3
A and not(B)
A= $self->compactB= not builtin::is_weak($_[1])
| |||||||||||||||||||||||||||||
| 222 | # for now we assume this data just won't be shared, instead of | ||||||||||||||||||||||||||||
| 223 | # compacting it later. | ||||||||||||||||||||||||||||
| 224 | 1808 | return $self->SUPER::visit_ref($_[1]); | |||||||||||||||||||||||||||
| 225 | } else { | ||||||||||||||||||||||||||||
| 226 | 0 | KiokuDB::Error::UnknownObjects->throw( objects => [ $ref ] ); | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | sub visit_ref_data { | ||||||||||||||||||||||||||||
| 231 | 6236 | ▶ | my ( $self, $ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
visit_ref_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 232 | 6236 | $self->SUPER::visit_ref($_[1]); | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | sub _ref_id { | ||||||||||||||||||||||||||||
| 236 | 8037 | ▶ | my ( $self, $ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_ref_id: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 8037 | my $l = $self->live_objects; | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 8037 | ▶ | if ( my $id = $l->object_to_id($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 215 | return $id; | |||||||||||||||||||||||||||
| 242 | } else { | ||||||||||||||||||||||||||||
| 243 | 7822 | my $b = $self->_buffer; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 7822 | ▶ | if ( $b->options->{only_known} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 1808 | ▶ | if ( $self->compact ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | # if we're compacting this is not an error, we just compact in place | ||||||||||||||||||||||||||||
| 248 | # and we generate an error if we encounter this data again in visit_seen | ||||||||||||||||||||||||||||
| 249 | 1808 | return; | |||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||
| 251 | 0 | KiokuDB::Error::UnknownObjects->throw( objects => [ $ref ] ); | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | } else { | ||||||||||||||||||||||||||||
| 254 | 6014 | my $id = $self->generate_uuid; | |||||||||||||||||||||||||||
| 255 | 6014 | $b->insert( $id => $ref ); | |||||||||||||||||||||||||||
| 256 | 6014 | return $id; | |||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | # avoid retying, we want to get back Reference or Entry objects | ||||||||||||||||||||||||||||
| 262 | 37 | ▶ | sub visit_tied_hash { shift->visit_tied(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_tied_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub visit_tied_array { shift->visit_tied(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_tied_array: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub visit_tied_scalar { shift->visit_tied(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_tied_scalar: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub visit_tied_glob { shift->visit_tied(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_tied_glob: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | sub visit_tied { | ||||||||||||||||||||||||||||
| 268 | 37 | ▶ | my ( $self, $tied, $ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
visit_tied: called CC=5 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 37 | my $tie = $self->visit($tied); | |||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 37 | ▶ | if ( my $id = $self->_ref_id($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 273 | 37 | ▶ | if ( !$self->compact and my $only = $self->_buffer->options->{only} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $self->compact and my $only = $self->_buffer->options->{"only"}
MC/DC0%0/2
not $self->compact and my $only = $self->_buffer->options->{"only"}
not $self->compact
my $only = $self->_buffer->options->{"only"}
Truth table33%1/3
not(A) and B
A= not $self->compactB= my $only = $self->_buffer->options->{"only"}
| |||||||||||||||||||||||||||||
| 274 | 0 | ▶ | unless ( $only->contains($ref) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | 0 | return $self->make_ref( $id => $_[1] ); | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 37 | push @{ $self->_buffer->simple_entries }, $id; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 37 | $self->make_entry( | |||||||||||||||||||||||||||
| 282 | id => $id, | ||||||||||||||||||||||||||||
| 283 | object => $ref, | ||||||||||||||||||||||||||||
| 284 | data => $tie, | ||||||||||||||||||||||||||||
| 285 | tied => substr(reftype($ref), 0, 1), | ||||||||||||||||||||||||||||
| 286 | ); | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 37 | return $self->make_ref( $id => $_[2] ); | |||||||||||||||||||||||||||
| 289 | } else { | ||||||||||||||||||||||||||||
| 290 | 0 | return $self->make_entry( | |||||||||||||||||||||||||||
| 291 | object => $ref, | ||||||||||||||||||||||||||||
| 292 | data => $tie, | ||||||||||||||||||||||||||||
| 293 | tied => substr(reftype($ref), 0, 1), | ||||||||||||||||||||||||||||
| 294 | ); | ||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 3892 | ▶ | sub visit_object { shift->visit_with_typemap(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_object: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 299 | 8072 | ▶ | sub visit_ref { shift->visit_with_typemap(@_) } | ||||||||||||||||||||||||||
|
Subroutine
visit_ref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | sub visit_with_typemap { | ||||||||||||||||||||||||||||
| 302 | 11964 | ▶ | my ( $self, $ref ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
visit_with_typemap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 11964 | my $collapse = $self->collapse_method(ref $ref); | |||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 11952 | shift->$collapse(@_); | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | sub collapse_first_class { | ||||||||||||||||||||||||||||
| 310 | 3770 | ▶ | my ( $self, $collapse, $object, @entry_args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
collapse_first_class: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | # Data::Visitor stuff for circular refs | ||||||||||||||||||||||||||||
| 313 | 3770 | $self->_register_mapping( $object, $object ); | |||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 3770 | my ( $l, $b ) = ( $self->live_objects, $self->_buffer ); | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 3770 | my $id = $l->object_to_id($object); | |||||||||||||||||||||||||||
| 318 | 3770 | my $in_storage = $l->id_in_storage($id); | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 3770 | my $o = $b->options; | |||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 3770 | ▶ | if ( $o->{only_in_storage} && $in_storage ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$o->{"only_in_storage"} and $in_storage
MC/DC100%2/2
$o->{"only_in_storage"} and $in_storage
$o->{"only_in_storage"}
$in_storage
Truth table100%3/3
A and B
A= $o->{"only_in_storage"}B= $in_storage
| |||||||||||||||||||||||||||||
| 323 | 3 | return $self->make_ref( $id => $_[2] ); | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 3767 | ▶ | if ( my $only = $o->{only} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 327 | 1283 | ▶ | unless ( $only->contains($object) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | 670 | ▶ | if ( $in_storage ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | 668 | return $self->make_ref( $id => $_[2] ); | |||||||||||||||||||||||||||
| 330 | } else { | ||||||||||||||||||||||||||||
| 331 | 2 | KiokuDB::Error::UnknownObjects->throw( objects => [ $object ] ); | |||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 3097 | ▶ | unless ( $id ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 337 | 2143 | ▶ | if ( $o->{only_known} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 338 | 3 | KiokuDB::Error::UnknownObjects->throw( objects => [ $object ] ); | |||||||||||||||||||||||||||
| 339 | } else { | ||||||||||||||||||||||||||||
| 340 | 2140 | my $id_method = $self->id_method(ref $object); | |||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 2140 | $id = $self->$id_method($object); | |||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 2140 | ▶ | if ( defined( my $conflict = $l->id_to_object($id) ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 345 | 50 | return $self->id_conflict( $id, $_[2], $conflict ); | |||||||||||||||||||||||||||
| 346 | } else { | ||||||||||||||||||||||||||||
| 347 | 2090 | $b->insert( $id => $object ); | |||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 3044 | my @args = ( | |||||||||||||||||||||||||||
| 353 | object => $object, | ||||||||||||||||||||||||||||
| 354 | id => $id, | ||||||||||||||||||||||||||||
| 355 | class => ref($object), | ||||||||||||||||||||||||||||
| 356 | @entry_args, | ||||||||||||||||||||||||||||
| 357 | ); | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | 3044 | $self->$collapse(@args); | |||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | # we pass $_[1], an alias, so that isweak works | ||||||||||||||||||||||||||||
| 362 | 3039 | return $self->make_ref( $id => $_[2] ); | |||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | sub id_conflict { | ||||||||||||||||||||||||||||
| 366 | 50 | ▶ | my ( $self, $id, $object, $other ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
id_conflict: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 50 | $self->make_skip_entry( id => $id, object => $object ); | |||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 50 | $self->_buffer->insert( $id => $object ); | |||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | 50 | return $self->make_ref( $id => $_[2] ); | |||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | sub collapse_intrinsic { | ||||||||||||||||||||||||||||
| 377 | 104 | ▶ | my ( $self, $collapse, $object, @entry_args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
collapse_intrinsic: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | 104 | my $class = ref $object; | |||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 104 | my @args = ( | |||||||||||||||||||||||||||
| 382 | object => $object, | ||||||||||||||||||||||||||||
| 383 | class => $class, | ||||||||||||||||||||||||||||
| 384 | @entry_args, | ||||||||||||||||||||||||||||
| 385 | ); | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 104 | return $self->$collapse(@args); | |||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | # we don't reblass in collapse_naive | ||||||||||||||||||||||||||||
| 391 | sub retain_magic { | ||||||||||||||||||||||||||||
| 392 | 8006 | ▶ | my ( $self, $proto, $clone ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
retain_magic: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 393 | 8006 | return $clone; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | 20 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 20 | __PACKAGE__ | |||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | __END__ | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | =pod | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =head1 NAME | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | KiokuDB::Collapser - Collapse object hierarchies to entry | ||||||||||||||||||||||||||||
| 407 | data | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | # mostly internal | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | The collapser simplifies real objects into L<KiokuDB::Entry> objects to pass to | ||||||||||||||||||||||||||||
| 416 | the backend. | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | Non object data is collapsed by walking it with L<Data::Visitor> (which | ||||||||||||||||||||||||||||
| 419 | L<KiokuDB::Collapser> inherits from). | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | Object collapsing is detailed in L</"COLLAPSING STRATEGIES">. | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | The object's data will be copied into the L<KiokuDB::Entry> with references to | ||||||||||||||||||||||||||||
| 424 | other data structures translated into L<KiokuDB::Reference> objects. | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | Reference addresses are mapped to unique identifiers, which are generated as | ||||||||||||||||||||||||||||
| 427 | necessary. | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | =head2 Compacting | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | If C<compact> is disabled then every reference is symbolic, and every data | ||||||||||||||||||||||||||||
| 432 | structure has an entry. | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | If compacting is enabled (the default) the minimum number of entry objects | ||||||||||||||||||||||||||||
| 435 | required for consistency is created. | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | Every blessed, shared or tied data structure requires an entry object, as does | ||||||||||||||||||||||||||||
| 438 | every target of a weak reference. "Simple" structures, such as plain | ||||||||||||||||||||||||||||
| 439 | hashes/arrays will be left inline as data intrinsic to the object it was found in. | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | Compacting is usually desirable, but sometimes isn't (for instance with an RDF | ||||||||||||||||||||||||||||
| 442 | like store). | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =head1 COLLAPSING STRATEGIES | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | Collapsing strategies are chosen based on the type of the object being | ||||||||||||||||||||||||||||
| 447 | collapsed, using L<KiokuDB::TypeMap::Resolver>. | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | The resolver consults the typemap (L<KiokuDB::TypeMap>), and caches the results | ||||||||||||||||||||||||||||
| 450 | as keyed by C<ref $object>. | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | The typemap contains normal entries (keyed by C<ref $object eq $class>) or isa | ||||||||||||||||||||||||||||
| 453 | entries (filtered by C<< $object->isa($class) >>). The rationale is that a typemap | ||||||||||||||||||||||||||||
| 454 | entry for a superclass might not support all subclasses as well. | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | Any strategy may be collapsed as a first class object, or intrinsicly, inside | ||||||||||||||||||||||||||||
| 457 | its parent (in which case it isn't assigned a UUID). This is determined based | ||||||||||||||||||||||||||||
| 458 | on the C<intrinsic> attribute to the entry. For instance, if L<Path::Class> | ||||||||||||||||||||||||||||
| 459 | related objects should be collapsed as if they are values, the following | ||||||||||||||||||||||||||||
| 460 | typemap entry can be used: | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | isa_entries => { | ||||||||||||||||||||||||||||
| 463 | 'Path::Class::Entity' => KiokuDB::TypeMap::Entry::Callback->new( | ||||||||||||||||||||||||||||
| 464 | intrinsic => 1, | ||||||||||||||||||||||||||||
| 465 | collapse => "stringify", | ||||||||||||||||||||||||||||
| 466 | expand => "new", | ||||||||||||||||||||||||||||
| 467 | ), | ||||||||||||||||||||||||||||
| 468 | }, | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | If no typemap entry exists, L<KiokuDB::TypeMap::Entry::MOP> is used by default. | ||||||||||||||||||||||||||||
| 471 | See L<KiokuDB::TypeMap::Resolver> for more details. | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | These are the strategies in brief: | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | =head2 MOP | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | When the object has a L<Class::MOP> registered metaclass (any L<Moose> object, | ||||||||||||||||||||||||||||
| 478 | but not only), the MOP is used to walk the object's attributes and construct | ||||||||||||||||||||||||||||
| 479 | the simplified version without breaking encapsulation. | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | See L<KiokuDB::TypeMap::Entry::MOP>. | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | =head2 Naive | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | This collapsing strategy simply walks the object's data using L<Data::Visitor>. | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | This allows collapsing of L<Class::Accessor> based objects, for instance, but | ||||||||||||||||||||||||||||
| 488 | should be used with care. | ||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | See L<KiokuDB::TypeMap::Entry::Naive> | ||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||
| 492 | =head2 Callback | ||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | This collapsing strategy allows callbacks to be used to map the types. | ||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | It is more limited than the other strategies, but very convenient for simple | ||||||||||||||||||||||||||||
| 497 | values. | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | See L<KiokuDB::TypeMap::Entry::Callback> for more details. | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | =head2 Passthrough | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | This delegates collapsing to the backend serialization. This is convenient for | ||||||||||||||||||||||||||||
| 504 | when a backend uses e.g. L<Storable> to serialize entries, and the object in | ||||||||||||||||||||||||||||
| 505 | question already has a C<STORABLE_freeze> and C<STORABLE_thaw> method. | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | =cut | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||