Directory.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @category Zend
  23. * @package Zend_Search_Lucene
  24. * @subpackage Storage
  25. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. */
  28. abstract class Zend_Search_Lucene_Storage_Directory
  29. {
  30. /**
  31. * Closes the store.
  32. *
  33. * @return void
  34. */
  35. abstract public function close();
  36. /**
  37. * Returns an array of strings, one for each file in the directory.
  38. *
  39. * @return array
  40. */
  41. abstract public function fileList();
  42. /**
  43. * Creates a new, empty file in the directory with the given $filename.
  44. *
  45. * @param string $filename
  46. * @return Zend_Search_Lucene_Storage_File
  47. */
  48. abstract public function createFile($filename);
  49. /**
  50. * Removes an existing $filename in the directory.
  51. *
  52. * @param string $filename
  53. * @return void
  54. */
  55. abstract public function deleteFile($filename);
  56. /**
  57. * Purge file if it's cached by directory object
  58. *
  59. * Method is used to prevent 'too many open files' error
  60. *
  61. * @param string $filename
  62. * @return void
  63. */
  64. abstract public function purgeFile($filename);
  65. /**
  66. * Returns true if a file with the given $filename exists.
  67. *
  68. * @param string $filename
  69. * @return boolean
  70. */
  71. abstract public function fileExists($filename);
  72. /**
  73. * Returns the length of a $filename in the directory.
  74. *
  75. * @param string $filename
  76. * @return integer
  77. */
  78. abstract public function fileLength($filename);
  79. /**
  80. * Returns the UNIX timestamp $filename was last modified.
  81. *
  82. * @param string $filename
  83. * @return integer
  84. */
  85. abstract public function fileModified($filename);
  86. /**
  87. * Renames an existing file in the directory.
  88. *
  89. * @param string $from
  90. * @param string $to
  91. * @return void
  92. */
  93. abstract public function renameFile($from, $to);
  94. /**
  95. * Sets the modified time of $filename to now.
  96. *
  97. * @param string $filename
  98. * @return void
  99. */
  100. abstract public function touchFile($filename);
  101. /**
  102. * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
  103. *
  104. * If $shareHandler option is true, then file handler can be shared between File Object
  105. * requests. It speed-ups performance, but makes problems with file position.
  106. * Shared handler are good for short atomic requests.
  107. * Non-shared handlers are useful for stream file reading (especial for compound files).
  108. *
  109. * @param string $filename
  110. * @param boolean $shareHandler
  111. * @return Zend_Search_Lucene_Storage_File
  112. */
  113. abstract public function getFileObject($filename, $shareHandler = true);
  114. }