Difference between revisions of "API:EPrints/Plugin/Storage"
(Created page with '<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' com…')
Revision as of 13:42, 25 July 2013
$plugin = $repo->plugin('Storage::Local'); $plugin->open_write($fileobj) or die; $plugin->write('Hello, World!'); $plugin->close_write() or die;
See EPrints::Storage for information on using the storage layer.
$sourceid = $store->store( $fileobj, CALLBACK )
Store an object using data from CALLBACK.
If successful returns the source id used to retrieve this object.
Returns undef on error.
$success = $store->retrieve( $fileobj, $sourceid, $offset, $len, CALLBACK )
Retrieve $n bytes of data starting at $offset from the data stored for $fileobj identified by $sourceid.
CALLBACK = $rc = &f( BYTES )
$success = $store->delete( $fileobj, $sourceid )
Delete the object stored for $fileobj.
$filename = $store->get_local_copy( $fileobj, $sourceid )
Return the name of a local copy of the file (may be a File::Temp object).
Returns undef if no local copy is available.
$url = $store->get_remote_copy( $fileobj, $sourceid )
Returns an alternative URL for this file (must be publicly accessible).
Returns undef if no such copy is available.
$ok = $store->open_write( $fileobj )
Initialise a new write based on $fileobj.
$ok = $store->write( $fileobj, $buffer )
Write $buffer. Will croak if $fileobj was not previously opened for writing with open_write().
$sourceid = $store->close_write( $fileobj )
Finish writing to $fileobj. Returns the sourceid or undef on failure.
Copyright 2000-2011 University of Southampton.
This file is part of EPrints http://www.eprints.org/.
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.