org.apache.hadoop.mapreduce.checkpoint

## Interface CheckpointService

- All Known Implementing Classes:
    FSCheckpointService

      public interface CheckpointService

  The CheckpointService provides a simple API to store and retrieve the state of a task. Checkpoints are atomic, single-writer, write-once, multiple-readers, ready-many type of objects. This is provided by releasing the CheckpointID for a checkpoint only upon commit of the checkpoint, and by preventing a checkpoint to be re-opened for writes. Non-functional properties such as durability, availability, compression, garbage collection, quotas are left to the implementation. This API is envisioned as the basic building block for a checkpoint service, on top of which richer interfaces can be layered (e.g., frameworks providing object-serialization, checkpoint metadata and provenance, etc.)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `CheckpointService.CheckpointReadChannel`
    `static interface` | `CheckpointService.CheckpointWriteChannel`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abort(CheckpointService.CheckpointWriteChannel ch)` Dual to commit, it aborts the current checkpoint.
    `CheckpointID` | `commit(CheckpointService.CheckpointWriteChannel ch)` Used to finalize and existing checkpoint.
    `CheckpointService.CheckpointWriteChannel` | `create()` This method creates a checkpoint and provide a channel to write to it.
    `boolean` | `delete(CheckpointID id)` It discards an existing checkpoint identified by its CheckpointID.
    `CheckpointService.CheckpointReadChannel` | `open(CheckpointID id)` Given a CheckpointID returns a reading channel.

- - ### Method Detail

    - #### create

          CheckpointService.CheckpointWriteChannel create()
                                                   throws IOException,
                                                          InterruptedException

      This method creates a checkpoint and provide a channel to write to it. The name/location of the checkpoint are unknown to the user as of this time, in fact, the CheckpointID is not released to the user until commit is called. This makes enforcing atomicity of writes easy.
      Returns:
        a channel that can be used to write to the checkpoint
      Throws:
        `IOException`
        `InterruptedException`

    - #### commit

          CheckpointID commit(CheckpointService.CheckpointWriteChannel ch)
                       throws IOException,
                              InterruptedException

      Used to finalize and existing checkpoint. It returns the CheckpointID that can be later used to access (read-only) this checkpoint. This guarantees atomicity of the checkpoint.
      Parameters:
        `ch` - the CheckpointWriteChannel to commit
      Returns:
        a CheckpointID
      Throws:
        `IOException`
        `InterruptedException`

    - #### abort

          void abort(CheckpointService.CheckpointWriteChannel ch)
              throws IOException,
                     InterruptedException

      Dual to commit, it aborts the current checkpoint. Garbage collection choices are left to the implementation. The CheckpointID is not generated nor released to the user so the checkpoint is not accessible.
      Parameters:
        `ch` - the CheckpointWriteChannel to abort
      Throws:
        `IOException`
        `InterruptedException`

    - #### open

          CheckpointService.CheckpointReadChannel open(CheckpointID id)
                                                throws IOException,
                                                       InterruptedException

      Given a CheckpointID returns a reading channel.
      Parameters:
        `id` - CheckpointID for the checkpoint to be opened
      Returns:
        a CheckpointReadChannel
      Throws:
        `IOException`
        `InterruptedException`

    - #### delete

          boolean delete(CheckpointID id)
                  throws IOException,
                         InterruptedException

      It discards an existing checkpoint identified by its CheckpointID.
      Parameters:
        `id` - CheckpointID for the checkpoint to be deleted
      Returns:
        a boolean confirming success of the deletion
      Throws:
        `IOException`
        `InterruptedException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.