@param $listUuid
@param $numberOfChunks

@return array
973784
private function getArrayChunksKeys($listUuid, $numberOfChunks)
    {
        $arrayChunksKeys = [];
        for ($i = 0; $i < $numberOfChunks; ++$i) {
            $arrayChunksKeys[] = $listUuid.self::SEPARATOR.self::CHUNK.'-'.($i + 1);
        }

        return $arrayChunksKeys;
    }
1160190
private function insertChunk($fileId, $data, $chunkNumber)
    {
        $chunk = [
            'files_id' => $fileId,
            'n' => $chunkNumber,
            'data' => new MongoBinData($data),
        ];

        $result = $this->chunks->insert($chunk);

        if (! $this->isOKResult($result)) {
            throw new \MongoException('error inserting chunk');
        }

        return $result;
    }
446954
protected function buildShuffleProfileUpdatesPayload($count, $utc)
    {
        $payload = array();

        if (is_numeric($count)) {
            $payload['count'] = $count;
        }

        if ($utc) {
            $payload['utc'] = true;
        }

        return $payload;
    }
1049682
public function getHeaders($listUuid)
    {
        return $this->client->hgetall($listUuid.self::SEPARATOR.self::HEADERS);
    }
212039
function uuids (count, callback) {
    if (typeof count === 'function') {
      callback = count
      count = 1
    }
    return relax({ method: 'GET', path: '_uuids', qs: { count: count } }, callback)
  }
124770
public function exists($listUuid)
    {
        $listFirstChunk = $this->memcached->get($listUuid.self::SEPARATOR.self::CHUNK.'-1');

        if (false === $listFirstChunk) {
            return false;
        }

        return true;
    }
255560
function listAccountsInfoByUIDs(array $uids)
    {
        $response = $this->call( new Command\ListAccountsInfo($uids) );
        if ( $ex = $response->hasException() )
            throw $ex;

        $r = $response->expected();
        $r = ($r instanceof iDataEntity) ? $r->get('result') : $r;
        return $r;
    }
872184
public function findByUuid($uuid, $columns = ['*'])
    {
        if (is_array($uuid) || $uuid instanceof Arrayable) {
            return $this->findManyByUuid($uuid, $columns);
        }

        return $this->whereUuidKey($uuid)->first($columns);
    }
862765
public function updateElement($listUuid, $elementUuid, $data)
    {
        $numberOfChunks = $this->getNumberOfChunks($listUuid);
        $ttl = ($this->getTtl($listUuid) > 0) ? $this->getTtl($listUuid) : null;

        for ($i = 1; $i <= $numberOfChunks; ++$i) {
            $chunkNumber = $listUuid.self::SEPARATOR.self::CHUNK.'-'.$i;
            $chunk = $this->memcached->get($chunkNumber);

            if (array_key_exists($elementUuid, $chunk)) {
                $listElement = $this->findElement(
                    (string) $listUuid,
                    (string) $elementUuid
                );

                $updatedElementBody = $this->updateListElementBody($listElement, $data);
                if (!ListElementConsistencyChecker::isConsistent($updatedElementBody, $this->findListByUuid($listUuid))) {
                    throw new ListElementNotConsistentException('Element '.(string) $elementUuid.' is not consistent with list data.');
                }

                $arrayOfElements = $this->memcached->get($listUuid);
                $updatedElement = new ListElement(
                    new ListElementUuid($elementUuid),
                    $updatedElementBody
                );
                $body = $updatedElement->getBody();
                $arrayOfElements[(string) $elementUuid] = $body;

                $this->memcached->replace(
                    (string) $chunkNumber,
                    $arrayOfElements,
                    $ttl
                );

                break;
            }
        }
    }
1048463
public function chunk($amount, callable $fn = null)
    {
        $this->prepare();

        $chunk_value = array_chunk($this->_map, $amount);
        $chunks = [];

        if (!is_null($fn) && is_callable($fn)) {
            foreach ($chunk_value as $chunk) {
                $return = $fn($chunk);
                if (!is_null($return)) {
                    $chunks[] = $return;
                }
            }
            return count($chunks) > 0 ? $chunks : null;
        }

        return $chunk_value;
    }
1121490
public function list($offset = 0, $count = 10, $statusList = 'CARD_STATUS_VERIFY_OK')
    {
        $params = [
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        ];

        return $this->httpPostJson('card/batchget', $params);
    }
1178614
def list_chunks(l, n):
    
    if n < 1:
        n = 1
    return [l[i:i + n] for i in range(0, len(l), n)]
921469
public function getMessagesByAggregate($aggregateUuid): array
    {
        $messagesByUuid = [];
        /** @var Message $message */
        foreach ($this->messages as $message) {
            if ($message->aggregateUuid === $aggregateUuid) {
                $messagesByUuid[] = $message;
            }
        }

        return $messagesByUuid;
    }
318552
private function getSuccessUploadedChunks(): array
    {
        $path = $this->getChunkListFilePath();

        if (!file_exists($path)) {
            return [];
        }

        $data = file_get_contents($path);
        $data = explode(',', $data);
        unset($data[count($data) - 1]);
        sort($data);

        return $data;
    }
337757
private Chunk[] getScoringChunks(Chunk[] allChunks) {
    if (_preds == null)
      return allChunks;
    Chunk[] chks = new Chunk[allChunks.length - _preds.numCols()];
    System.arraycopy(allChunks, 0, chks, 0, chks.length);
    return chks;
  }
382070
public function getLocationList($uuidSafe, $uuidArchive, $count = null, $maxId = null, $sinceId = null)
    {
        $parameters = array(
          'count' => $count,
          'max_id' => $maxId,
          'since_id' => $sinceId,
        );

        $parameters = array_filter($parameters, function($val) {return !is_null($val);});

        return $this->online->call('/storage/c14/safe/'.$uuidSafe.'/archive/'.$uuidArchive.'/location', 'GET', $parameters);
    }
44983
public function getElement(ListElementUuid $uuid)
    {
        if (!$this->hasElement($uuid)) {
            throw new ListElementKeyDoesNotExistException('Invalid key '.$uuid->getUuid());
        }

        return $this->elements[$uuid->getUuid()];
    }