Data::Stream::Bulk::Filter ();
use Metabase::Archive;
use Metabase::Index;
use Data::GUID ();
use JSON 2 ();
has 'archive' => (
is => 'ro',
isa => 'Metabase::Archive',
required => 1,
);
->facts ) {
push @fact_guids, $self->store( $f );
}
$fact_struct->{content} = JSON->new->ascii->encode(\@fact_guids);
}
if ( $self->archive->store( $fact_struct )
&&
rjbs, 2009-06-24
if ($class->isa('Metabase::Report')) {
my @facts;
my $content = JSON->new->ascii->decode( $fact_struct->{content} );
for my $g ( @$content ) {
# XXX no
lk::Array;
use Fcntl ':flock';
use IO::File ();
use List::AllUtils qw/any all/;
use JSON 2 qw/encode_json decode_json/;
use Regexp::SQL::LIKE 0.001 qw/to_regexp/;
use Tie::File;
use MooseX::Types::Pat
" ) unless $fact->guid;
my $metadata = $self->clone_metadata( $fact );
my $line = encode_json($metadata);
my $filename = $self->index_file;
my $fh = IO::File->new( $filename, "a+" )
flock $fh, LOCK_SH;
{
while ( my $line = <$fh> ) {
my $parsed = decode_json($line);
push @matches, $parsed if $query->{-where}->($parsed);
}
}
$f
::Fact;
use Carp ();
use Data::Stream::Bulk::Callback;
use Data::GUID ();
use File::Slurp ();
use JSON 2 ();
use MooseX::Types::Path::Class;
with 'Metabase::Archive';
has 'root_dir' => (
is => '
File::Slurp::write_file(
$self->_guid_path( $guid ),
{binmode => ':raw'},
JSON->new->ascii->encode($fact_struct),
);
return $guid;
}
# given guid, retrieve it and ret
($guid) );
}
sub _extract_file {
my ($self, $file) = @_;
# read the fact
my $fact_struct = JSON->new->ascii->decode(
File::Slurp::read_file( $file, { binmode => ':raw' } ),
);
return $f