2017-08-04 11:24:18 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Duplicati.Library.Main.Operation
|
|
|
|
|
{
|
|
|
|
|
internal class VacuumHandler
|
|
|
|
|
{
|
2018-05-23 21:18:01 -07:00
|
|
|
private readonly Options m_options;
|
2019-07-29 17:56:43 -07:00
|
|
|
private readonly VacuumResults m_result;
|
2017-08-04 11:24:18 +01:00
|
|
|
|
2019-07-29 17:56:43 -07:00
|
|
|
public VacuumHandler(Options options, VacuumResults result)
|
2017-08-04 11:24:18 +01:00
|
|
|
{
|
|
|
|
|
m_options = options;
|
|
|
|
|
m_result = result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Run()
|
|
|
|
|
{
|
|
|
|
|
using (var db = new Database.LocalDatabase(m_options.Dbpath, "Vacuum", false))
|
|
|
|
|
{
|
|
|
|
|
m_result.SetDatabase(db);
|
2019-05-13 21:27:37 -07:00
|
|
|
m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Vacuum_Running);
|
2017-08-04 11:24:18 +01:00
|
|
|
db.Vacuum();
|
2019-07-29 17:56:43 -07:00
|
|
|
m_result.EndTime = DateTime.UtcNow;
|
2017-08-04 11:24:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|