Class SnapshotManager

Object
io.delta.kernel.internal.snapshot.SnapshotManager

public class SnapshotManager extends Object
  • Constructor Details

    • SnapshotManager

      public SnapshotManager(Path logPath, Path tablePath)
  • Method Details

    • verifyDeltaVersions

      public static void verifyDeltaVersions(List<Long> versions, Optional<Long> expectedStartVersion, Optional<Long> expectedEndVersion)
      - Verify the versions are contiguous. - Verify the versions start with `expectedStartVersion` if it's specified. - Verify the versions end with `expectedEndVersion` if it's specified.
    • buildLatestSnapshot

      public Snapshot buildLatestSnapshot(Engine engine) throws TableNotFoundException
      Construct the latest snapshot for given table.
      Parameters:
      engine - Instance of Engine to use.
      Returns:
      Throws:
      TableNotFoundException
    • getSnapshotAt

      public Snapshot getSnapshotAt(Engine engine, long version) throws TableNotFoundException
      Construct the snapshot for the given table at the version provided.
      Parameters:
      engine - Instance of Engine to use.
      version - The snapshot version to construct
      Returns:
      a Snapshot of the table at version version
      Throws:
      TableNotFoundException
    • getSnapshotForTimestamp

      public Snapshot getSnapshotForTimestamp(Engine engine, long millisSinceEpochUTC) throws TableNotFoundException
      Construct the snapshot for the given table at the provided timestamp.
      Parameters:
      engine - Instance of Engine to use.
      millisSinceEpochUTC - timestamp to fetch the snapshot for in milliseconds since the unix epoch
      Returns:
      a Snapshot of the table at the provided timestamp
      Throws:
      TableNotFoundException
    • checkpoint

      public void checkpoint(Engine engine, long version) throws TableNotFoundException, IOException
      Throws:
      TableNotFoundException
      IOException
    • getLogSegmentForVersion

      public Optional<LogSegment> getLogSegmentForVersion(Engine engine, Optional<Long> startCheckpoint, Optional<Long> versionToLoad)
      Get a list of files that can be used to compute a Snapshot at version `versionToLoad`, If `versionToLoad` is not provided, will generate the list of files that are needed to load the latest version of the Delta table. This method also performs checks to ensure that the delta files are contiguous.
      Parameters:
      startCheckpoint - A potential start version to perform the listing of the DeltaLog, typically that of a known checkpoint. If this version's not provided, we will start listing from version 0.
      versionToLoad - A specific version to load. Typically used with time travel and the Delta streaming source. If not provided, we will try to load the latest version of the table.
      Returns:
      Some LogSegment to build a Snapshot if files do exist after the given startCheckpoint. None, if the delta log directory was missing or empty.