All Known Implementing Classes:
SnarkManager, UpdateRunner

public interface CompleteListener
Callback for Snark events.
  • Method Details

    • torrentComplete

      void torrentComplete(Snark snark)
      Called when all pieces of the torrent have been downloaded and verified.
      Parameters:
      snark - the Snark instance that completed
    • updateStatus

      void updateStatus(Snark snark)
      Called when the torrent status should be updated (e.g., peer count changed).
      Parameters:
      snark - the Snark instance to update status for
    • gotMetaInfo

      String gotMetaInfo(Snark snark)
      We transitioned from magnet mode, we have now initialized our metainfo and storage. The listener should now call getMetaInfo() and save the data to disk.
      Parameters:
      snark - the Snark instance that just initialized its metainfo and storage
      Returns:
      the new name for the torrent or null on error
    • fatal

      void fatal(Snark snark, String error)
      Called when the torrent hits an unrecoverable error and has stopped.
      Parameters:
      snark - the Snark instance that stopped
      error - the description of the failure, already localized for display
    • addMessage

      void addMessage(Snark snark, String message)
      Called to display a status or error message in the torrent's UI.
      Parameters:
      snark - the Snark instance raising the message
      message - the text to show in the torrent UI, already localized
    • gotPiece

      void gotPiece(Snark snark)
      Called each time a single piece is downloaded and verified.
      Parameters:
      snark - the Snark instance that downloaded the piece
    • getSavedTorrentTime

      long getSavedTorrentTime(Snark snark)
      Returns the saved time for the torrent's last modification.
      Parameters:
      snark - the Snark instance holding the stored timestamp
      Returns:
      the saved torrent time in milliseconds
    • getSavedTorrentBitField

      BitField getSavedTorrentBitField(Snark snark)
      Returns the saved bitfield for the torrent.
      Parameters:
      snark - the Snark instance holding the stored bitfield
      Returns:
      the saved bitfield, or null if none
    • getSavedUploaded

      long getSavedUploaded(Snark snark)
      The saved uploaded bytes.
      Parameters:
      snark - the Snark instance to read the uploaded byte count from
      Returns:
      the saved uploaded
    • getSavedComments

      CommentSet getSavedComments(Snark snark)
      The saved comments.
      Parameters:
      snark - the Snark instance to read the comment set from
      Returns:
      the comment text as saved, or null
    • locked_saveComments

      void locked_saveComments(Snark snark, CommentSet comments)
      Persist a comment set under the torrent's own lock, so a comment fetched from a tracker is not written concurrently with the torrenting thread.
      Parameters:
      snark - the Snark instance whose torrent lock is held
      comments - the comment set to write out while the lock is held
    • shouldAutoStart

      boolean shouldAutoStart()
      Whether the torrent should auto-start.
      Returns:
      whether auto start
    • getBandwidthListener

      BandwidthListener getBandwidthListener()
      The bandwidth listener for the torrent.
      Returns:
      the bandwidth listener