Skip to content

Commit

Permalink
Make checkpointing pluggable (#161)
Browse files Browse the repository at this point in the history
We make FASTER C# checkpointing use a pluggable user-specified interface (ICheckpointManager) for providing devices such as for index and snapshot and for performing the atomic metadata commit. We refactor the current implementation (currently hard coded to use LocalStorageDevice and C# Streams) as a default and reference implementation.
  • Loading branch information
badrishc authored Jul 26, 2019
1 parent 132c2b1 commit c617beb
Show file tree
Hide file tree
Showing 14 changed files with 600 additions and 380 deletions.
10 changes: 6 additions & 4 deletions cs/src/core/Allocator/MallocFixedPageSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,11 @@ public void Dispose()
/// Public facing persistence API
/// </summary>
/// <param name="device"></param>
/// <param name="start_offset"></param>
/// <param name="numBytes"></param>
public void TakeCheckpoint(IDevice device, out ulong numBytes)
public void TakeCheckpoint(IDevice device, ulong start_offset, out ulong numBytes)
{
BeginCheckpoint(device, 0UL, out numBytes);
BeginCheckpoint(device, start_offset, out numBytes);
}

/// <summary>
Expand Down Expand Up @@ -563,9 +564,10 @@ public int GetPageSize()
/// <param name="device"></param>
/// <param name="buckets"></param>
/// <param name="numBytes"></param>
public void Recover(IDevice device, int buckets, ulong numBytes)
/// <param name="offset"></param>
public void Recover(IDevice device, ulong offset, int buckets, ulong numBytes)
{
BeginRecovery(device, 0UL, buckets, numBytes, out ulong numBytesRead);
BeginRecovery(device, offset, buckets, numBytes, out ulong numBytesRead);
}

/// <summary>
Expand Down
13 changes: 11 additions & 2 deletions cs/src/core/Index/Common/CheckpointSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Licensed under the MIT license.


using System;

namespace FASTER.core
{
/// <summary>
Expand All @@ -27,13 +29,20 @@ public enum CheckpointType
public class CheckpointSettings
{
/// <summary>
/// Directory where checkpoints are stored
/// Checkpoint manager
/// </summary>
public string CheckpointDir = "";
public ICheckpointManager CheckpointManager = null;

/// <summary>
/// Type of checkpoint
/// </summary>
public CheckpointType CheckPointType = CheckpointType.Snapshot;

/// <summary>
/// Use specified directory for storing and retrieving checkpoints
/// This is a shortcut to providing the following:
/// CheckpointSettings.CheckpointManager = new LocalCheckpointManager(CheckpointDir)
/// </summary>
public string CheckpointDir = null;
}
}
Loading

0 comments on commit c617beb

Please sign in to comment.