Difference between revisions of "API:EPrints/Plugin/Storage"

From EPrints Documentation
Jump to: navigation, search
(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…')
 
 
Line 26: Line 26:
 
==DESCRIPTION==
 
==DESCRIPTION==
 
See [[API:EPrints/Storage|EPrints::Storage]] for information on using the storage layer.
 
See [[API:EPrints/Storage|EPrints::Storage]] for information on using the storage layer.
 +
 +
You shouldn't need to use a storage plugin directly.
  
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
Line 58: Line 60:
  
 
CALLBACK = $rc = &amp;f( BYTES )
 
CALLBACK = $rc = &amp;f( BYTES )
 +
 +
Note: this API may change in future to reflect the open_write/write/close_write mechanism.
  
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->

Latest revision as of 13:47, 25 July 2013

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Plugin::Storage


SYNOPSIS

$plugin = $repo->plugin('Storage::Local');
$plugin->open_write($fileobj) or die;
$plugin->write('Hello, World!');
$plugin->close_write() or die;


DESCRIPTION

See EPrints::Storage for information on using the storage layer.

You shouldn't need to use a storage plugin directly.


METHODS

store

$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.


retrieve

$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 )

Note: this API may change in future to reflect the open_write/write/close_write mechanism.


delete

$success = $store->delete( $fileobj, $sourceid )

Delete the object stored for $fileobj.


get_local_copy

$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.


get_remote_copy

$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.


open_write

$ok = $store->open_write( $fileobj )

Initialise a new write based on $fileobj.


write

$ok = $store->write( $fileobj, $buffer )

Write $buffer. Will croak if $fileobj was not previously opened for writing with open_write().


close_write

$sourceid = $store->close_write( $fileobj )

Finish writing to $fileobj. Returns the sourceid or undef on failure.


COPYRIGHT

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/.