| 1 | <?php |
| 2 | /** |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 | * http://www.gnu.org/copyleft/gpl.html |
| 17 | * |
| 18 | * @file |
| 19 | */ |
| 20 | |
| 21 | namespace Wikimedia\LightweightObjectStore; |
| 22 | |
| 23 | /** |
| 24 | * Generic interface providing error code and quality-of-service constants for object stores |
| 25 | * |
| 26 | * @internal For use by BagOStuff and WANObjectCache |
| 27 | * @ingroup Cache |
| 28 | */ |
| 29 | interface StorageAwareness { |
| 30 | /** No storage medium error */ |
| 31 | public const ERR_NONE = 0; |
| 32 | /** Storage medium failed to yield a complete response to an operation */ |
| 33 | public const ERR_NO_RESPONSE = 1; |
| 34 | /** Storage medium could not be reached to establish a connection */ |
| 35 | public const ERR_UNREACHABLE = 2; |
| 36 | /** Storage medium operation failed due to usage limitations or an I/O error */ |
| 37 | public const ERR_UNEXPECTED = 3; |
| 38 | |
| 39 | /** @deprecated Since 1.41; Emulation/fallback mode; see QOS_EMULATION_*; higher is better */ |
| 40 | public const ATTR_EMULATION = 1; |
| 41 | /** Durability of writes; see QOS_DURABILITY_* (higher means stronger) */ |
| 42 | public const ATTR_DURABILITY = 2; |
| 43 | |
| 44 | /** Data is never saved to begin with (blackhole store) */ |
| 45 | public const QOS_DURABILITY_NONE = 1; |
| 46 | /** Data is lost at the end of the current web request or CLI script */ |
| 47 | public const QOS_DURABILITY_SCRIPT = 2; |
| 48 | /** Data is lost once the service storing the data restarts */ |
| 49 | public const QOS_DURABILITY_SERVICE = 3; |
| 50 | /** Data is saved to disk and writes do not usually block on fsync() */ |
| 51 | public const QOS_DURABILITY_DISK = 4; |
| 52 | /** Data is saved to disk and writes usually block on fsync(), like a standard RDBMS */ |
| 53 | public const QOS_DURABILITY_RDBMS = 5; |
| 54 | |
| 55 | /** Generic "unknown" value; useful for comparisons (always "good enough") */ |
| 56 | public const QOS_UNKNOWN = INF; |
| 57 | } |