NAME

LibreCat::FileStore::Container - Abstract definition of a file storage container

SYNOPSIS

    use LibreCat::FileStore::Simple;

    my $filestore => LibreCat::FileStore::Simple->new(%options);

    my $container = $filestore->get('1234');

    my @list_files = $container->list;

    if ($container->exists($filename)) {
                ....
    }

    $container->add($filename, IO::File->new('/path/to/file'));

    my $file = $container->get($filename);

    $container->delete($filename);

    # write all changes to disk (network , database , ...)
    $container->commit;

DESCRIPTION

LibreCat::FileStore::Container is an abstract definition of a storage container. These container are used to store zero or more LibreCat::FileStore::Files.

METHODS

get($key)

Retrieve a LibreCat::FileStore::File based on a $key. Returns a LibreCat::FileStore::File on success or undef on failure.

add($filename, IO::File->new(…))

Add a new LibreCat::FileStore::File file to the container. Return 1 on success or undef on failure.

Based on the implementation of LibreCat::FileStore, the files might only be available when changes have been committed.

commit()

Commit all changes to the container (write to disk).

delete($filename)

Delete a $filename from the container.

exists($filename)

Check if a $filename exists in the container.

SEE ALSO

LibreCat::FileStore , LibreCat::FileStore::File