/// <summary> /// Create new instance of log commit manager /// </summary> /// <param name="deviceFactory">Factory for getting devices</param> /// <param name="checkpointNamingScheme">Checkpoint naming helper</param> /// <param name="overwriteLogCommits">Overwrite same FASTER log commits each time</param> /// <param name="removeOutdated">Remote older FASTER log commits</param> public DeviceLogCommitCheckpointManager(INamedDeviceFactory deviceFactory, ICheckpointNamingScheme checkpointNamingScheme, bool overwriteLogCommits = true, bool removeOutdated = false) { this.deviceFactory = deviceFactory; this.checkpointNamingScheme = checkpointNamingScheme; this.commitNum = 0; this.semaphore = new SemaphoreSlim(0); this.overwriteLogCommits = overwriteLogCommits; this.removeOutdated = removeOutdated; deviceFactory.Initialize(checkpointNamingScheme.BaseName()); }
/// <summary> /// Create new instance of log commit manager /// </summary> /// <param name="deviceFactory">Factory for getting devices</param> /// <param name="checkpointNamingScheme">Checkpoint naming helper</param> /// <param name="removeOutdated">Remote older FASTER log commits</param> public DeviceLogCommitCheckpointManager(INamedDeviceFactory deviceFactory, ICheckpointNamingScheme checkpointNamingScheme, bool removeOutdated = true) { this.deviceFactory = deviceFactory; this.checkpointNamingScheme = checkpointNamingScheme; this.semaphore = new SemaphoreSlim(0); this.removeOutdated = removeOutdated; if (removeOutdated) { // We keep two index checkpoints as the latest index might not have a // later log checkpoint to work with indexTokenHistory = new Guid[indexTokenCount]; // We only keep the latest log checkpoint logTokenHistory = new Guid[logTokenCount]; // // We only keep the latest FasterLog commit flogCommitHistory = new long[flogCommitCount]; } deviceFactory.Initialize(checkpointNamingScheme.BaseName()); }
/// <summary> /// Create new instance of log commit manager /// </summary> /// <param name="deviceFactory">Factory for getting devices</param> /// <param name="checkpointNamingScheme">Checkpoint naming helper</param> /// <param name="overwriteLogCommits">Overwrite same FASTER log commits each time</param> /// <param name="removeOutdated">Remote older FASTER log commits</param> public DeviceLogCommitCheckpointManager(INamedDeviceFactory deviceFactory, ICheckpointNamingScheme checkpointNamingScheme, bool overwriteLogCommits = true, bool removeOutdated = false) { this.deviceFactory = deviceFactory; this.checkpointNamingScheme = checkpointNamingScheme; this.commitNum = 0; this.semaphore = new SemaphoreSlim(0); this.overwriteLogCommits = overwriteLogCommits; this.removeOutdated = removeOutdated; if (removeOutdated) { // We keep two index checkpoints as the latest index might not have a // later log checkpoint to work with indexTokenHistory = new Guid[2]; // We only keep the latest log checkpoint logTokenHistory = new Guid[2]; } this._disposed = false; deviceFactory.Initialize(checkpointNamingScheme.BaseName()); }
/// <summary> /// Create new instance of log commit manager /// </summary> /// <param name="deviceFactory">Factory for getting devices</param> /// <param name="baseName">Overall location specifier (e.g., local path or cloud container name)</param> /// <param name="overwriteLogCommits">Overwrite same FASTER log commits each time</param> /// <param name="removeOutdated">Remote older FASTER log commits</param> public DeviceLogCommitCheckpointManager(INamedDeviceFactory deviceFactory, string baseName, bool overwriteLogCommits = true, bool removeOutdated = false) : this(deviceFactory, new DefaultCheckpointNamingScheme(baseName), overwriteLogCommits, removeOutdated) { }