in simpleProviderManaged/SimpleProvider.cs [35:107]
public SimpleProvider(ProviderOptions options)
{
this.scratchRoot = options.VirtRoot;
this.layerRoot = options.SourceRoot;
this.Options = options;
// If in test mode, enable notification callbacks.
if (this.Options.TestMode)
{
this.Options.EnableNotifications = true;
}
// Enable notifications if the user requested them.
List<NotificationMapping> notificationMappings;
if (this.Options.EnableNotifications)
{
string rootName = string.Empty;
notificationMappings = new List<NotificationMapping>()
{
new NotificationMapping(
NotificationType.FileOpened
| NotificationType.NewFileCreated
| NotificationType.FileOverwritten
| NotificationType.PreDelete
| NotificationType.PreRename
| NotificationType.PreCreateHardlink
| NotificationType.FileRenamed
| NotificationType.HardlinkCreated
| NotificationType.FileHandleClosedNoModification
| NotificationType.FileHandleClosedFileModified
| NotificationType.FileHandleClosedFileDeleted
| NotificationType.FilePreConvertToFull,
rootName)
};
}
else
{
notificationMappings = new List<NotificationMapping>();
}
try
{
// This will create the virtualization root directory if it doesn't already exist.
this.virtualizationInstance = new VirtualizationInstance(
this.scratchRoot,
poolThreadCount: 0,
concurrentThreadCount: 0,
enableNegativePathCache: false,
notificationMappings: notificationMappings);
}
catch (Exception ex)
{
Log.Fatal(ex, "Failed to create VirtualizationInstance.");
throw;
}
// Set up notifications.
notificationCallbacks = new NotificationCallbacks(
this,
this.virtualizationInstance,
notificationMappings);
Log.Information("Created instance. Layer [{Layer}], Scratch [{Scratch}]", this.layerRoot, this.scratchRoot);
if (this.Options.TestMode)
{
Log.Information("Provider started in TEST MODE.");
}
this.activeEnumerations = new ConcurrentDictionary<Guid, ActiveEnumeration>();
this.isSymlinkSupportAvailable = EnvironmentHelper.IsFullSymlinkSupportAvailable();
}