NAME Cantella::Store::UUID::File

A NOTE ABOUT EXTENSIONS

To make file location deterministic, files are stored under only their UUID, along with their respective meta file which is named $UUID.meta eg (DD5EB40A-164B-11DE-9893-5FA9AE3835A0.meta). The meta files may contain any number of attributes relevant to the file such as original name, extension, MIME typ, etc. Meta files are stored in JSON format.

ATTRIBUTES

Cantella::Store::UUID is a subclass of Moose::Object. It inherits the new object provided by Moose. All attributes can be set using the new constructor method, or their respecitive writer method, if applicable.

uuid

Required, read-only Data::GUID object, will automatically coerce.

dir

Required, read-only Path::Class::File object representing the directory where this file is stored. Automatically coercing.

path

Lazy-building, read-only Path::Class::File object representing the file being stored under this UUID.

metadata

Lazy_building, read-write hashref which contains the file's metadata. Setting it with the set_metadata method will write the data to disk.

_meta_file

Lazy-building, read-only Path::Class::File object pointing at the meta file.

METHODS

write_metadata

Write the contents of metadata to the metadata file.

remove

Removes the file and metadata file from the store. Returns true if both are removed successfully.

exists

Checks for existence of both the file and the metadata file. Returns true only if both exist.

SEE ALSO

Cantella::Store::UUID

AUTHOR

Guillermo Roditi (groditi) <groditi@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Guillermo Roditi.

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