objectcache: move ERR_* constants to IExpiringStore
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 8 Mar 2019 21:11:54 +0000 (13:11 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 8 Mar 2019 21:12:01 +0000 (13:12 -0800)
Also removed unused ERR_* constant from WANObjectCache and fixed
comment in the constructor.

Change-Id: I4377fc3f533113a459b648fad084ba097ff51762

includes/libs/objectcache/BagOStuff.php
includes/libs/objectcache/IExpiringStore.php
includes/libs/objectcache/WANObjectCache.php

index a3c020e..6f1fa69 100644 (file)
@@ -87,12 +87,6 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
        /** @var int[] Map of (ATTR_* class constant => QOS_* class constant) */
        protected $attrMap = [];
 
-       /** Possible values for getLastError() */
-       const ERR_NONE = 0; // no error
-       const ERR_NO_RESPONSE = 1; // no response
-       const ERR_UNREACHABLE = 2; // can't connect
-       const ERR_UNEXPECTED = 3; // response gave some error
-
        /** Bitfield constants for get()/getMulti() */
        const READ_LATEST = 1; // use latest data for replicated stores
        const READ_VERIFIED = 2; // promise that caller can tell when keys are stale
index 7bab20a..c1edff7 100644 (file)
@@ -56,4 +56,9 @@ interface IExpiringStore {
        const QOS_SYNCWRITES_SS = 4; // strict-serializable, nodes refuse reads if possible stale
        // Generic "unknown" value that is useful for comparisons (e.g. always good enough)
        const QOS_UNKNOWN = INF;
+
+       const ERR_NONE = 0; // no error
+       const ERR_NO_RESPONSE = 1; // no response
+       const ERR_UNREACHABLE = 2; // can't connect
+       const ERR_UNEXPECTED = 3; // response gave some error
 }
index bed7965..69c2a4d 100644 (file)
@@ -214,12 +214,6 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
        const FLD_FLAGS = 4; // key to the flags bitfield (reserved number)
        const FLD_HOLDOFF = 5; // key to any hold-off TTL
 
-       const ERR_NONE = 0; // no error
-       const ERR_NO_RESPONSE = 1; // no response
-       const ERR_UNREACHABLE = 2; // can't connect
-       const ERR_UNEXPECTED = 3; // response gave some error
-       const ERR_RELAY = 4; // relay broadcast failed
-
        const VALUE_KEY_PREFIX = 'WANCache:v:';
        const INTERIM_KEY_PREFIX = 'WANCache:i:';
        const TIME_KEY_PREFIX = 'WANCache:t:';
@@ -237,7 +231,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @param array $params
         *   - cache    : BagOStuff object for a persistent cache
         *   - logger   : LoggerInterface object
-        *   - stats    : LoggerInterface object
+        *   - stats    : StatsdDataFactoryInterface object
         *   - asyncHandler : A function that takes a callback and runs it later. If supplied,
         *       whenever a preemptive refresh would be triggered in getWithSetCallback(), the
         *       current cache value is still used instead. However, the async-handler function