#include "StorageDeleteFileChunkJob.h"
#include "System/Stopwatch.h"
#include "System/FileSystem.h"
#include "StorageFileChunk.h"

StorageDeleteFileChunkJob::StorageDeleteFileChunkJob(StorageFileChunk* chunk_)
{
    chunk = chunk_;
}

void StorageDeleteFileChunkJob::Execute()
{
    Stopwatch   sw;
    Buffer      filename;
    
    Log_Debug("Deleting file chunk %U from disk, starting", chunk->GetChunkID());
    sw.Start();
    
    filename.Write(chunk->GetFilename());
    delete chunk;
    FS_Delete(filename.GetBuffer());

    sw.Stop();
    Log_Debug("Deleted, elapsed: %U", (uint64_t) sw.Elapsed());
}

void StorageDeleteFileChunkJob::OnComplete()
{
    delete this;
}

#include "StorageDeleteFileChunkJob.h"
#include "System/Stopwatch.h"
#include "System/FileSystem.h"
#include "StorageFileChunk.h"

StorageDeleteFileChunkJob::StorageDeleteFileChunkJob(StorageFileChunk* chunk_)
{
    chunk = chunk_;
}

void StorageDeleteFileChunkJob::Execute()
{
    Stopwatch   sw;
    Buffer      filename;
    
    Log_Debug("Deleting file chunk %U from disk, starting", chunk->GetChunkID());
    sw.Start();
    
    filename.Write(chunk->GetFilename());
    delete chunk;

    // EXPERIMENTAL: remove from production!
    //FS_Delete(filename.GetBuffer());

    sw.Stop();
    Log_Debug("Deleted, elapsed: %U", (uint64_t) sw.Elapsed());
}

void StorageDeleteFileChunkJob::OnComplete()
{
    delete this;
}

Test commit for testing EXPERIMENTAL code trigger.
Test commit for testing EXPERIMENTAL code trigger.
