/** * {@inheritdoc} */ public function upload($filePath, $mimeType, $size) { $fileHash = $this->factory->createFileHash($filePath); $chunks = array(); $this->fileSplitter->split($filePath, function ($index, $data) use(&$chunks) { $chunk = $this->uploadChunk($data); $chunks[$index] = $this->chunkManager->downloadProxy($chunk->getHash()); // unset chunk to save memory unset($chunk); }); $file = new ChunkFile(); $file->setHash($fileHash); $file->setSize($size); $file->setMimetype($mimeType); $file->setChunks($chunks); return $file; }
public function downloadProxy($hash) { return $this->factory->createProxy(ChunkInterface::class, function () use($hash) { return $this->download($hash); }); }
/** * {@inheritdoc} */ public function createHash(UserInterface $user, $name) { return $this->factory->createHash(sprintf('%s@%s/%s', $user->getUsername(), $this->hostName, $name)); }
public function fetchProxy($hash, $className) { return $this->factory->createProxy($className, function () use($hash, $className) { return $this->fetch($hash, $className); }); }