org.klomp.snark

## Interface StorageListener

- All Known Implementing Classes:
    FetchAndAdd, Snark

      interface StorageListener

  Callback interface for monitoring Storage state changes and progress.

  This interface is used by Storage to report:

  - File creation and allocation events
  - Piece verification progress and results
  - Storage completion status
  - Status messages for user display
  See Also:
    `Storage`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMessage(String message)`
    `void` | `setWantedPieces(Storage storage)` Reset the peer's wanted pieces table Call after the storage double-check fails
    `void` | `storageAllChecked(Storage storage)` Called when all pieces in the storage have been checked.
    `void` | `storageAllocated(Storage storage, long length)` Called to indicate that length bytes have been allocated.
    `void` | `storageChecked(Storage storage, int num, boolean checked)` Called when storage is being checked and the num piece of that total pieces has been checked.
    `void` | `storageCompleted(Storage storage)` Called the one time when the data is completely received and checked.
    `void` | `storageCreateFile(Storage storage, String name, long length)` Called when the storage creates a new file of a given length.

- - ### Method Detail

    - #### addMessage

          void addMessage(String message)

    - #### setWantedPieces

          void setWantedPieces(Storage storage)

      Reset the peer's wanted pieces table Call after the storage double-check fails

    - #### storageAllChecked

          void storageAllChecked(Storage storage)

      Called when all pieces in the storage have been checked. Does not mean that the storage is complete, just that the state of the storage is known.

    - #### storageAllocated

          void storageAllocated(Storage storage,
                                long length)

      Called to indicate that length bytes have been allocated.

    - #### storageChecked

          void storageChecked(Storage storage,
                              int num,
                              boolean checked)

      Called when storage is being checked and the num piece of that total pieces has been checked. When the piece hash matches the expected piece hash checked will be true, otherwise it will be false.

    - #### storageCompleted

          void storageCompleted(Storage storage)

      Called the one time when the data is completely received and checked.

    - #### storageCreateFile

          void storageCreateFile(Storage storage,
                                 String name,
                                 long length)

      Called when the storage creates a new file of a given length.