Ver Fonte

Implement MongoPool

The MongoPool class does nothing besides throwing E_DEPRECATED around, so we'll do just that.
Andreas Braun há 10 anos atrás
pai
commit
7758b5604e
1 ficheiros alterados com 23 adições e 31 exclusões
  1. 23 31
      lib/Mongo/MongoPool.php

+ 23 - 31
lib/Mongo/MongoPool.php

@@ -13,53 +13,45 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-class MongoPool {
+/**
+ * @deprecated The current (1.3.0+) releases of the driver no longer implements pooling. This class and its methods are therefore deprecated and should not be used.
+ */
+class MongoPool
+{
     /**
      * Returns an array of information about all connection pools.
      *
      * @link http://php.net/manual/en/mongopool.info.php
-     * @static
-     * @return array Each connection pool has an identifier, which starts with the host. For
-     *         each pool, this function shows the following fields: $in use The number of
-     *         connections currently being used by Mongo instances. $in pool The number of
-     *         connections currently in the pool (not being used). $remaining The number of
-     *         connections that could be created by this pool. For example, suppose a pool had
-     *         5 connections remaining and 3 connections in the pool. We could create 8 new
-     *         instances of Mongo before we exhausted this pool (assuming no instances of Mongo
-     *         went out of scope, returning their connections to the pool). A negative number
-     *         means that this pool will spawn unlimited connections. Before a pool is created,
-     *         you can change the max number of connections by calling Mongo::setPoolSize. Once
-     *         a pool is showing up in the output of this function, its size cannot be changed.
-     *         $total The total number of connections allowed for this pool. This should be
-     *         greater than or equal to "in use" + "in pool" (or -1). $timeout The socket
-     *         timeout for connections in this pool. This is how long connections in this pool
-     *         will attempt to connect to a server before giving up. $waiting If you have
-     *         capped the pool size, workers requesting connections from the pool may block
-     *         until other workers return their connections. This field shows how many
-     *         milliseconds workers have blocked for connections to be released. If this number
-     *         keeps increasing, you may want to use MongoPool::setSize to add more connections
-     *         to your pool
+     * @return array
      */
-    public static function info() {}
+    public static function info()
+    {
+        trigger_error('Function MongoPool::info() is deprecated', E_DEPRECATED);
+        return [];
+    }
 
     /**
      * Sets the max number of connections new pools will be able to create.
      *
      * @link http://php.net/manual/en/mongopool.setsize.php
-     * @static
-     * @param int $size The max number of connections future pools will be able to
-     *        create. Negative numbers mean that the pool will spawn an infinite number of
-     *        connections
+     * @param int $size
      * @return boolean Returns the former value of pool size
      */
-    public static function setSize($size) {}
+    public static function setSize($size)
+    {
+        trigger_error('Function MongoPool::info() is deprecated', E_DEPRECATED);
+        return 1;
+    }
 
     /**
-     * .
+     * Get pool size for connection pools
      *
      * @link http://php.net/manual/en/mongopool.getsize.php
-     * @static
      * @return int Returns the current pool size
      */
-    public static function getSize() {}
+    public static function getSize()
+    {
+        trigger_error('Function MongoPool::info() is deprecated', E_DEPRECATED);
+        return 1;
+    }
 }