final move of files
[web.mtrack] / Zend / Search / Lucene / Storage / Directory.php
1 <?php
2 /**
3  * Zend Framework
4  *
5  * LICENSE
6  *
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.
14  *
15  * @category   Zend
16  * @package    Zend_Search_Lucene
17  * @subpackage Storage
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 $
21  */
22
23
24 /**
25  * @category   Zend
26  * @package    Zend_Search_Lucene
27  * @subpackage Storage
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
30  */
31 abstract class Zend_Search_Lucene_Storage_Directory
32 {
33
34     /**
35      * Closes the store.
36      *
37      * @return void
38      */
39     abstract public function close();
40
41     /**
42      * Returns an array of strings, one for each file in the directory.
43      *
44      * @return array
45      */
46     abstract public function fileList();
47
48     /**
49      * Creates a new, empty file in the directory with the given $filename.
50      *
51      * @param string $filename
52      * @return Zend_Search_Lucene_Storage_File
53      */
54     abstract public function createFile($filename);
55
56
57     /**
58      * Removes an existing $filename in the directory.
59      *
60      * @param string $filename
61      * @return void
62      */
63     abstract public function deleteFile($filename);
64
65     /**
66      * Purge file if it's cached by directory object
67      * 
68      * Method is used to prevent 'too many open files' error
69      *
70      * @param string $filename
71      * @return void
72      */
73     abstract public function purgeFile($filename);
74     
75     /**
76      * Returns true if a file with the given $filename exists.
77      *
78      * @param string $filename
79      * @return boolean
80      */
81     abstract public function fileExists($filename);
82
83
84     /**
85      * Returns the length of a $filename in the directory.
86      *
87      * @param string $filename
88      * @return integer
89      */
90     abstract public function fileLength($filename);
91
92
93     /**
94      * Returns the UNIX timestamp $filename was last modified.
95      *
96      * @param string $filename
97      * @return integer
98      */
99     abstract public function fileModified($filename);
100
101
102     /**
103      * Renames an existing file in the directory.
104      *
105      * @param string $from
106      * @param string $to
107      * @return void
108      */
109     abstract public function renameFile($from, $to);
110
111
112     /**
113      * Sets the modified time of $filename to now.
114      *
115      * @param string $filename
116      * @return void
117      */
118     abstract public function touchFile($filename);
119
120
121     /**
122      * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
123      *
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).
128      *
129      * @param string $filename
130      * @param boolean $shareHandler
131      * @return Zend_Search_Lucene_Storage_File
132      */
133     abstract public function getFileObject($filename, $shareHandler = true);
134
135 }
136