Robert Buels

NAME

Bio::JBrowse::Store::NCList::JSONFileStorage

SYNOPSIS

    my $storage = Bio::JBrowse::Store::NCList::JSONFileStorage->new( $outDir, $self->config->{compress} );
    $storage->put( 'relative/path/to/file.jsonz', \%data );
    my $data = $storage->get( 'relative/path/to/file.jsonz' );

    $storage->modify( 'relative/path/to/file.jsonz',
                      sub {
                         my $json_data = shift;
                         # do something with the data
                         return $json_data;
                      })

NAME

Bio::JBrowse::Store::NCList::JSONFileStorage - manage a directory structure of .json or .jsonz files

METHODS

new( $outDir, $compress, \%opts )

Constructor. Takes the directory to work with, boolean flag of whether to compress the results, and an optional hashref of other options as:

  # TODO: document options hashref

fullPath( 'path/to/file.json' )

Get the full path to the given filename in the output directory. Just calls File::Spec->join with the <$outDir> that was set at construction.

ext

Accessor for the file extension currently in use for the files in this storage directory. Usually either '.json' or '.jsonz'.

encodedSize( $object )

put( $path, $data )

get( $path, $default_value )

AUTHOR

Robert Buels <rbuels@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Robert Buels.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.