/**
  * Deletes the link for given message.
  *
  * @param string $message
  *
  * @throws NonExistentMessageInternalException
  */
 public function delete($message)
 {
     $result = $this->connectToStorageInternalWorker->connect()->remove(['message' => $message]);
     if ($result['n'] == 0) {
         throw new NonExistentMessageInternalException($message);
     }
 }
 /**
  * Picks the link for given message.
  *
  * @param string $message
  *
  * @return array An array with the following keys:
  *               message and info.
  *
  * @throws NonExistentMessageInternalException
  */
 public function pick($message)
 {
     $link = $this->connectToStorageInternalWorker->connect()->findOne(['message' => $message]);
     if (!$link) {
         throw new NonExistentMessageInternalException($message);
     }
     return $link;
 }
 /**
  * Collects links.
  *
  * @return \Iterator
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }
 /**
  * Creates a link between given message and given info.
  *
  * @param string $message
  * @param string $info
  * @param string $subscription
  */
 public function create($message, $info, $subscription)
 {
     $this->connectToStorageInternalWorker->connect()->insert(['message' => $message, 'info' => $info, 'subscription' => $subscription]);
 }