SnapShot (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.persistence

## Interface SnapShot

- All Known Implementing Classes:
    FileSnap

      public interface SnapShot

  snapshot interface for the persistence layer. implement this interface for implementing snapshots.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` free resources from this snapshot immediately
    `long` | `deserialize(DataTree dt, Map<Long,Integer> sessions)` deserialize a data tree from the last valid snapshot and return the last zxid that was deserialized
    `File` | `findMostRecentSnapshot()` find the most recent snapshot file
    `SnapshotInfo` | `getLastSnapshotInfo()` get information of the last saved/restored snapshot
    `void` | `serialize(DataTree dt, Map<Long,Integer> sessions, File name, boolean fsync)` persist the datatree and the sessions into a persistence storage

- - ### Method Detail

    - #### deserialize

          long deserialize(DataTree dt,
                           Map<Long,Integer> sessions)
                    throws IOException

      deserialize a data tree from the last valid snapshot and return the last zxid that was deserialized
      Parameters:
        `dt` - the datatree to be deserialized into
        `sessions` - the sessions to be deserialized into
      Returns:
        the last zxid that was deserialized from the snapshot
      Throws:
        `IOException`

    - #### serialize

          void serialize(DataTree dt,
                         Map<Long,Integer> sessions,
                         File name,
                         boolean fsync)
                  throws IOException

      persist the datatree and the sessions into a persistence storage
      Parameters:
        `dt` - the datatree to be serialized
        `sessions` - the session timeouts to be serialized
        `name` - the object name to store snapshot into
        `fsync` - sync the snapshot immediately after write
      Throws:
        `IOException`

    - #### findMostRecentSnapshot

          File findMostRecentSnapshot()
                               throws IOException

      find the most recent snapshot file
      Returns:
        the most recent snapshot file
      Throws:
        `IOException`

    - #### getLastSnapshotInfo

          SnapshotInfo getLastSnapshotInfo()

      get information of the last saved/restored snapshot
      Returns:
        info of last snapshot

    - #### close

          void close()
              throws IOException

      free resources from this snapshot immediately
      Throws:
        `IOException`

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.