PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/vendor/Zend/Search/Lucene/Storage/Directory.php

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