| 1 | use 5.006; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package Metabase::Test::Archive::Null; | ||
| 6 | # ABSTRACT: Metabase storage that discards all data | ||
| 7 | our $VERSION = '1.003'; # VERSION | ||
| 8 | |||
| 9 | use Moose; | ||
| 10 | |||
| 11 | use Carp (); | ||
| 12 | use Data::Stream::Bulk::Nil; | ||
| 13 | |||
| 14 | with 'Metabase::Archive'; | ||
| 15 | |||
| 16 | sub initialize { } | ||
| 17 | |||
| 18 | # given fact, discard it and return guid | ||
| 19 | sub store { | ||
| 20 | my ($self, $fact_struct) = @_; | ||
| 21 | |||
| 22 | my $guid = $fact_struct->{metadata}{core}{guid}; | ||
| 23 | unless ( $guid ) { | ||
| 24 | Carp::confess "Can't store: no GUID set for fact\n"; | ||
| 25 | } | ||
| 26 | |||
| 27 | # do nothing except return | ||
| 28 | return $guid; | ||
| 29 | } | ||
| 30 | |||
| 31 | # we discard, so can't ever extract | ||
| 32 | sub extract { | ||
| 33 | die "unimplemented"; | ||
| 34 | } | ||
| 35 | |||
| 36 | # does nothing | ||
| 37 | sub delete { | ||
| 38 | my ($self, $guid) = @_; | ||
| 39 | return $guid; | ||
| 40 | } | ||
| 41 | |||
| 42 | # we have nothing to return | ||
| 43 | sub iterator { | ||
| 44 | return Data::Stream::Bulk::Nil->new; | ||
| 45 | } | ||
| 46 | |||
| 47 | 1; | ||
| 48 | |||
| 49 | __END__ |