From: Tara L Andrews Date: Wed, 22 Feb 2012 14:20:42 +0000 (+0100) Subject: restore Directory deletion, albeit without garbage collection X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d7ba60b4f5b9621bdb6d257a27b77696d8e2abff;p=scpubgit%2Fstemmatology.git restore Directory deletion, albeit without garbage collection --- diff --git a/lib/Text/Tradition/Directory.pm b/lib/Text/Tradition/Directory.pm index f01d19b..9293d0c 100644 --- a/lib/Text/Tradition/Directory.pm +++ b/lib/Text/Tradition/Directory.pm @@ -52,6 +52,11 @@ Returns the Text::Tradition object of the given ID. Writes the given tradition to the database, returning its ID. +=head2 delete( $tradition ) + +Deletes the given tradition object from the database. +WARNING!! Garbage collection does not yet work. Use this sparingly. + =begin testing use TryCatch; @@ -127,8 +132,7 @@ is( ref( $nt ), 'Text::Tradition', "Made new tradition" ); is( scalar $f->tradition_ids, 1, "Object is deleted from index" ); } -SKIP: { - skip 'Have yet to figure out garbage collection', 1; +{ my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; is( scalar $g->tradition_ids, 1, "Now one object in new directory index" ); @@ -170,12 +174,13 @@ before [ qw/ store update insert delete / ] => sub { } }; -# If a tradition is deleted, remove it from the index. -after delete => sub { - my $self = shift; - my $gc = KiokuDB::GC::Naive->new( backend => $self->directory->backend ); - $self->directory->backend->delete( $gc->garbage->members ); -}; +# TODO Garbage collection doesn't work. Suck it up and live with the +# inflated DB. +# after delete => sub { +# my $self = shift; +# my $gc = KiokuDB::GC::Naive->new( backend => $self->directory->backend ); +# $self->directory->backend->delete( $gc->garbage->members ); +# }; sub save { my $self = shift; diff --git a/t/text_tradition_directory.t b/t/text_tradition_directory.t index 2e18c20..dd8eeec 100644 --- a/t/text_tradition_directory.t +++ b/t/text_tradition_directory.t @@ -81,8 +81,7 @@ is( ref( $nt ), 'Text::Tradition', "Made new tradition" ); is( scalar $f->tradition_ids, 1, "Object is deleted from index" ); } -SKIP: { - skip 'Have yet to figure out garbage collection', 1; +{ my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; is( scalar $g->tradition_ids, 1, "Now one object in new directory index" );