Permalink
Browse files

Add Collapser::Buffer

  • Loading branch information...
nothingmuch committed Jan 24, 2009
1 parent 91d4de1 commit a1b2248964b79f6050dfe6993af033f2f4dc2ffe
View
@@ -441,15 +441,6 @@ sub deep_update {
$self->store_objects( only_known => 1, objects => \@objects );
}
-sub _imply_root {
- my ( $self, @entries ) = @_;
-
- foreach my $entry ( @entries ) {
- next if $entry->has_root; # set by typemap
- $entry->root(1);
- }
-}
-
sub set_root {
my ( $self, @objects ) = @_;
$_->root(1) for $self->live_objects->objects_to_entries(@objects);
@@ -473,17 +464,13 @@ sub store_objects {
my $objects = $args{objects};
- my ( $entries, @ids ) = $self->collapser->collapse(%args);
-
- if ( $args{root_set} ) {
- $self->_imply_root(@{$entries}{@ids});
- }
+ my ( $buffer, @ids ) = $self->collapser->collapse(%args);
- my @insert = grep { ref($_) ne 'KiokuDB::Entry::Skip' } values %$entries;
+ my $entries = $buffer->entries;
- $self->backend->insert(@insert);
+ $buffer->imply_root(@ids) if $args{root_set};
- $self->live_objects->update_entries(@insert);
+ $buffer->insert_to_backend($self->backend);
if ( @$objects == 1 ) {
return $ids[0];
Oops, something went wrong.

0 comments on commit a1b2248

Please sign in to comment.