File indexing completed on 2025-01-19 05:21:27

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Search_Lucene
0017  * @subpackage Storage
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 
0024 /**
0025  * @category   Zend
0026  * @package    Zend_Search_Lucene
0027  * @subpackage Storage
0028  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0029  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0030  */
0031 abstract class Zend_Search_Lucene_Storage_Directory
0032 {
0033 
0034     /**
0035      * Closes the store.
0036      *
0037      * @return void
0038      */
0039     abstract public function close();
0040 
0041     /**
0042      * Returns an array of strings, one for each file in the directory.
0043      *
0044      * @return array
0045      */
0046     abstract public function fileList();
0047 
0048     /**
0049      * Creates a new, empty file in the directory with the given $filename.
0050      *
0051      * @param string $filename
0052      * @return Zend_Search_Lucene_Storage_File
0053      */
0054     abstract public function createFile($filename);
0055 
0056 
0057     /**
0058      * Removes an existing $filename in the directory.
0059      *
0060      * @param string $filename
0061      * @return void
0062      */
0063     abstract public function deleteFile($filename);
0064 
0065     /**
0066      * Purge file if it's cached by directory object
0067      *
0068      * Method is used to prevent 'too many open files' error
0069      *
0070      * @param string $filename
0071      * @return void
0072      */
0073     abstract public function purgeFile($filename);
0074 
0075     /**
0076      * Returns true if a file with the given $filename exists.
0077      *
0078      * @param string $filename
0079      * @return boolean
0080      */
0081     abstract public function fileExists($filename);
0082 
0083 
0084     /**
0085      * Returns the length of a $filename in the directory.
0086      *
0087      * @param string $filename
0088      * @return integer
0089      */
0090     abstract public function fileLength($filename);
0091 
0092 
0093     /**
0094      * Returns the UNIX timestamp $filename was last modified.
0095      *
0096      * @param string $filename
0097      * @return integer
0098      */
0099     abstract public function fileModified($filename);
0100 
0101 
0102     /**
0103      * Renames an existing file in the directory.
0104      *
0105      * @param string $from
0106      * @param string $to
0107      * @return void
0108      */
0109     abstract public function renameFile($from, $to);
0110 
0111 
0112     /**
0113      * Sets the modified time of $filename to now.
0114      *
0115      * @param string $filename
0116      * @return void
0117      */
0118     abstract public function touchFile($filename);
0119 
0120 
0121     /**
0122      * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
0123      *
0124      * If $shareHandler option is true, then file handler can be shared between File Object
0125      * requests. It speed-ups performance, but makes problems with file position.
0126      * Shared handler are good for short atomic requests.
0127      * Non-shared handlers are useful for stream file reading (especial for compound files).
0128      *
0129      * @param string $filename
0130      * @param boolean $shareHandler
0131      * @return Zend_Search_Lucene_Storage_File
0132      */
0133     abstract public function getFileObject($filename, $shareHandler = true);
0134 
0135 }
0136