Files
Umbraco-CMS/src/Umbraco.Core/IO/ShadowFileSystems.cs
2018-11-19 14:40:59 +01:00

37 lines
847 B
C#

using System;
namespace Umbraco.Core.IO
{
// shadow filesystems is definitively ... too convoluted
internal class ShadowFileSystems : ICompletable
{
private readonly FileSystems _fileSystems;
private bool _completed;
// invoked by the filesystems when shadowing
public ShadowFileSystems(FileSystems fileSystems, Guid id)
{
_fileSystems = fileSystems;
Id = id;
_fileSystems.BeginShadow(id);
}
// for tests
public Guid Id { get; }
// invoked by the scope when exiting, if completed
public void Complete()
{
_completed = true;
}
// invoked by the scope when exiting
public void Dispose()
{
_fileSystems.EndShadow(Id, _completed);
}
}
}