You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
997 B
45 lines
997 B
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Enums\FileFormatEnum;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class ChunkFile implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(
|
|
public string $uuid,
|
|
public string $path,
|
|
public FileFormatEnum $format
|
|
)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$chunks = $this->format->chunker($this->uuid, $this->path);
|
|
foreach($chunks as $chunk){
|
|
StoreChunk::dispatch($chunk);
|
|
}
|
|
Storage::delete($this->path);
|
|
}
|
|
}
|
|
|