Difference between revisions of "API:EPrints/Storage"

From EPrints Documentation
Jump to: navigation, search
Line 12: Line 12:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 37: Line 40:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 54: Line 60:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 69: Line 78:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 87: Line 99:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 107: Line 122:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 123: Line 141:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 141: Line 162:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 159: Line 183:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 181: Line 208:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 201: Line 231:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 219: Line 252:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 239: Line 275:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 257: Line 296:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 275: Line 317:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
Line 293: Line 338:
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->

Revision as of 12:58, 25 February 2010

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


Warning The interface for this module has not been finalised and may change in the future.

NAME

EPrints::Storage - store and retrieve objects in the storage engine

User Comments


This should be inserted verbatum into the Wiki page.

SYNOPSIS

 my $store = $repository->storage();
 
 $store->store(
   $fileobj,    # file object
   "diddle.pdf",  # filename
   $fh        # file handle
 );
 

User Comments


DESCRIPTION

This module is the storage control layer which uses 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.

User Comments


METHODS

User Comments


$store = EPrints::Storage->new( $repository )

Create a new storage object for $repository. Should not be used directly, see EPrints::Session.

User Comments


$len = $store->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.

User Comments


$success = $store->retrieve( $fileobj, CALLBACK )

User Comments


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

Delete all object copies stored for $fileobj.

User Comments


$ok = $store->delete_copy( $plugin, $fileobj )

Delete the copy of this file stored in $plugin.

User Comments


$filename = $store->get_local_copy( $fileobj )

Return the name of a local copy of the file.

Will retrieve and cache the remote object using File::Temp if necessary.

Returns undef if retrieval failed.

User Comments


$url = $store->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.

User Comments


@plugins = $store->get_plugins( $fileobj )

Returns the 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.

User Comments


$ok = $store->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.

User Comments


$ok = $storage->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).

User Comments


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

Write $buffer to the storage plugin(s).

User Comments


$ok = $storage->close_write( $fileobj );

Finish writing to the storage plugin(s) for $fileobj.

User Comments