Difference between revisions of "API:EPrints/Storage"

From EPrints Documentation
Jump to: navigation, search
(Blanked the page)
Line 1: Line 1:
<!-- 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' comments will be lost.
 
-->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Storage.pm|package_name=EPrints::Storage}}[[Category:API|Storage]]<div><!-- Edit below this comment -->
 
  
 
<!-- Pod2Wiki=_private_ -->{{API:Unstable}}<!-- Pod2Wiki=head_name --></div>
 
==NAME==
 
'''EPrints::Storage''' - store and retrieve objects in the storage engine
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=_private_ -->This should be inserted verbatum into the Wiki page.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=head_synopsis --></div>
 
==SYNOPSIS==
 
  my $store = $repository-&gt;storage();
 
 
 
  $store-&gt;store(
 
    $fileobj,    # file object
 
    "diddle.pdf",  # filename
 
    $fh        # file handle
 
  );
 
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=head_description --></div>
 
==DESCRIPTION==
 
This module is the storage control layer which uses [[API:EPrints/Plugin/Storage|EPrints::Plugin::Storage]] plugins to support various storage back-ends. It enables the storage, retrieval and deletion of data streams. The maximum size of a stream is dependent on the back-end storage mechanism.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=head_methods --></div>
 
==METHODS==
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_new --></div>
 
===$store = EPrints::Storage-&gt;new( $repository )===
 
 
Create a new storage object for $repository. Should not be used directly, see [[API:EPrints/Session|EPrints::Session]].
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_store --></div>
 
===$len = $store-&gt;store( $fileobj, CODEREF )===
 
 
Read from and store all data from CODEREF for $fileobj. The '''filesize''' field in $fileobj must be set at the expected number of bytes to read from CODEREF.
 
 
Returns undef if the file couldn't be stored, otherwise the number of bytes read.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_retrieve --></div>
 
===$success = $store-&gt;retrieve( $fileobj, CALLBACK )===
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_delete --></div>
 
===$success = $store-&gt;delete( $fileobj )===
 
 
Delete all object copies stored for $fileobj.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_delete_copy --></div>
 
===$ok = $store-&gt;delete_copy( $plugin, $fileobj )===
 
 
Delete the copy of this file stored in $plugin.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_get_local_copy --></div>
 
===$filename = $store-&gt;get_local_copy( $fileobj )===
 
 
Return the name of a local copy of the file.
 
 
Will retrieve and cache the remote object using {{API:PodLink|file=File/Temp|package_name=File::Temp|section=|text=File::Temp}} if necessary.
 
 
Returns undef if retrieval failed.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_get_remote_copy --></div>
 
===$url = $store-&gt;get_remote_copy( $fileobj )===
 
 
Returns a URL from which this file can be accessed.
 
 
Returns undef if this file is not available via another service.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_get_plugins --></div>
 
===@plugins = $store-&gt;get_plugins( $fileobj )===
 
 
Returns the [[API:EPrints/Plugin/Storage|EPrints::Plugin::Storage]] plugin(s) to use for $fileobj. If more than one plugin is returned they should be used in turn until one succeeds.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_copy --></div>
 
===$ok = $store-&gt;copy( $plugin, $fileobj )===
 
 
Copy the contents of $fileobj into another storage $plugin.
 
 
Returns 1 on success, 0 on failure and -1 if a copy already exists in $plugin.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_open_write --></div>
 
===$ok = $storage-&gt;open_write( $fileobj )===
 
 
Start a write session for $fileobj. $fileobj must have at least the "filesize" property set (which is the number of bytes that will be written).
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_write --></div>
 
===$ok = $storage-&gt;write( $fileobj, $buffer )===
 
 
Write $buffer to the storage plugin(s).
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=item_close_write --></div>
 
===$ok = $storage-&gt;close_write( $fileobj );===
 
 
Finish writing to the storage plugin(s) for $fileobj.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
 

Revision as of 12:03, 25 February 2010