7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Search_Lucene
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Directory.php 16541 2009-07-07 06:59:03Z bkarwin $
26 * @package Zend_Search_Lucene
28 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
29 * @license http://framework.zend.com/license/new-bsd New BSD License
31 abstract class Zend_Search_Lucene_Storage_Directory
39 abstract public function close();
42 * Returns an array of strings, one for each file in the directory.
46 abstract public function fileList();
49 * Creates a new, empty file in the directory with the given $filename.
51 * @param string $filename
52 * @return Zend_Search_Lucene_Storage_File
54 abstract public function createFile($filename);
58 * Removes an existing $filename in the directory.
60 * @param string $filename
63 abstract public function deleteFile($filename);
66 * Purge file if it's cached by directory object
68 * Method is used to prevent 'too many open files' error
70 * @param string $filename
73 abstract public function purgeFile($filename);
76 * Returns true if a file with the given $filename exists.
78 * @param string $filename
81 abstract public function fileExists($filename);
85 * Returns the length of a $filename in the directory.
87 * @param string $filename
90 abstract public function fileLength($filename);
94 * Returns the UNIX timestamp $filename was last modified.
96 * @param string $filename
99 abstract public function fileModified($filename);
103 * Renames an existing file in the directory.
105 * @param string $from
109 abstract public function renameFile($from, $to);
113 * Sets the modified time of $filename to now.
115 * @param string $filename
118 abstract public function touchFile($filename);
122 * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
124 * If $shareHandler option is true, then file handler can be shared between File Object
125 * requests. It speed-ups performance, but makes problems with file position.
126 * Shared handler are good for short atomic requests.
127 * Non-shared handlers are useful for stream file reading (especial for compound files).
129 * @param string $filename
130 * @param boolean $shareHandler
131 * @return Zend_Search_Lucene_Storage_File
133 abstract public function getFileObject($filename, $shareHandler = true);