NAME

MogileFS::Plugin::FileRefs - MogileFS extension

DESCRIPTION

This module provides MogileFS with additional functionality to keep track of multiple uses of an individual dkey. This may be useful for implementing de-duplication in your application.

Mogile commands

add_file_ref

Takes domain id, dkey, and your reference as arguments.

Creates an association from a key to your reference.

del_file_ref

Takes domain id, dkey, and your reference as arguments.

Deletes an association from a key to your reference.

rename_if_no_refs

Takes domain id, old dkey and new dkey.

Atomically renames a dkey provided there are no references to it.

list_refs_for_dkey

Takes domain id, dkey.

Lists all the references against a dkey.

Locking behaviour

Care has been taken to ensure that it is possible to remove a file, without the danger of a reference being added to it during the deletion process. add_file_ref take a lock, keyed to the domain and key of the reference added. rename_if_no_refs also takes a lock which it holds between checking the reference count and actually doing the renaming, ensuring a reference cannot sneak in.

If a lock cannot be obtained within the timeout period, a get_key_lock_fail error is returned.

SEE ALSO

MogileFS::Server

AUTHOR

Dave Lambley, <dlambley@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2012 Oscar Music and Media

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.