/**
  * Deletes the profile with given uniqueness.
  *
  * @param string $uniqueness
  *
  * @throws NonExistentUniquenessSharedException
  */
 public function delete($uniqueness)
 {
     $result = $this->connectToStorageInternalWorker->connect()->remove(['uniqueness' => $uniqueness]);
     if ($result['n'] == 0) {
         throw new NonExistentUniquenessSharedException($uniqueness);
     }
     $this->connectToBalanceOperationStorageInternalWorker->connect()->remove(['uniqueness' => $uniqueness]);
 }
 /**
  * Collect operations for given uniqueness.
  *
  * @param string $uniqueness
  *
  * @return \Iterator An array of operations with the following keys:
  *                   uniqueness, amount, impact, description and created
  */
 public function collect($uniqueness)
 {
     return $this->connectToStorageInternalWorker->connect()->find(['uniqueness' => $uniqueness])->fields(['_id' => 0])->sort(['created' => -1]);
 }
 /**
  * Collects operations.
  *
  * @return \Iterator
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }
 /**
  * Logs an operation.
  *
  * @param string $uniqueness
  * @param int    $amount
  * @param string $impact
  * @param string $description
  */
 public function log($uniqueness, $amount, $impact, $description)
 {
     $this->connectToStorageInternalWorker->connect()->insert(['uniqueness' => $uniqueness, 'amount' => $amount, 'impact' => $impact, 'description' => $description, 'created' => time()]);
 }