Class TorrentStatus
java.lang.Object
com.frostwire.jlibtorrent.TorrentStatus
- All Implemented Interfaces:
Cloneable
Holds a snapshot of the status of a torrent, as queried by
TorrentHandle.status()-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumthe different overall states a torrent can be in. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglongThe posix-time (in milliseconds) when this torrent was added.longThis is the accumulated download payload byte counters.longThis is the accumulated upload payload byte counter.booleanThese are set to true if this torrent is allowed to announce to the respective peer source.booleanThese are set to true if this torrent is allowed to announce to the respective peer source.booleanThese are set to true if this torrent is allowed to announce to the respective peer source.intthe size of a block, in bytes.protected TorrentStatusclone()longThe posix-time (in milliseconds) when this torrent was finished.intthe number of peers in this torrent's peer list that is a candidate to be connected to.intget limit of number of connections for this torrent.the URL of the last working tracker.floatthe number of distributed copies of the file.inttells the share of pieces that have more copies than the rarest // piece(s).intthe number of distributed copies of the torrent.intthe number of peers in this torrent that are waiting for more bandwidth quota from the torrent rate limiter.intThe total transfer rate of payload only, not counting protocol chatter.intThe total rates for all peers for this torrent.May be set to an error message describing why the torrent was paused, in case it was paused by an error.longflags()booleantrue if there has ever been an incoming connection attempt to this torrent.booleantrue if this torrent has metadata (either it was started from a .torrent file or the metadata has been downloaded).infoHash()the info-hash for this torrent.booleanReturnstrueif all pieces that have apriority > 0are downloaded.booleanthis is true if this torrent's storage is currently being moved from one location to another.booleantrue if all pieces have been downloaded.longlongThe time (in milliseconds) when we, or one of our peers, last saw a complete copy of this torrent.longintThe number of seeds in our peer list and the total number of peers (including seeds).intThe number of seeds in our peer list and the total number of peers (including seeds).name()Returns the name of the torrent.booleantrue if this torrent has unsaved changes to its download state and statistics since the last resume data was saved.longThe time until the torrent will announce itself to the tracker (in milliseconds).intIf the tracker sends scrape info in its announce reply, these fields will be set to the total number of peers that have the whole file and the total number of peers that are still downloading.intReturns the number of peer connections this torrent has, including half-open connections that hasn't completed the bittorrent handshake yet.intIf the tracker sends scrape info in its announce reply, these fields will be set to the total number of peers that have the whole file and the total number of peers that are still downloading.intnumPeers()The number of peers this torrent currently is connected to.intReturns the number of pieces that has been downloaded so you don't have to count yourself.intnumSeeds()The number of peers that are seeding that this client is currently connected to.intthe number of unchoked peers in this torrent.pieces()IMPORTANT: If you are not getting up to date information about pieces remember that PieceIndexBitfield data is considered augmented data for a torrentHandle.status() call, meaning, if you want to get the latest piece data, you must use the TorrentHandle.QUERY_PIECES flag when invoking torrentHandle.status(TorrentHandle.QUERY_PIECES).floatprogress()A value in the range [0, 1], that represents the progress of the torrent's current task.intprogress parts per million (progress * 1000000) when disabling floating point operations, this is the only option to query progressintthe position this torrent has in the download queue.longintseedRank()A rank of how important it is to seed the torrent, it is used to determine which torrents to seed and which to queue.state()The main state the torrent is in.final StorageModeThe allocation mode for the torrent.swig()longtotal()The total number of bytes to download for this torrent.longThe total number of bytes of the file(s) that we have.longThe number of bytes downloaded and uploaded to all peers, accumulated, this session only.longThe number of bytes that has been downloaded and that has failed the piece hash test.longCounts the amount of bytes received this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.longCounts the amount of bytes send this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.longThe number of bytes that has been downloaded even though that data already was downloaded.longThe number of bytes downloaded and uploaded to all peers, accumulated, this session only.longThe total number of bytes we want to download.longThe number of bytes we have downloaded, only counting the pieces that we actually want to download.intthe number of peers in this torrent that are waiting for more bandwidth quota from the torrent rate limiter.intThe total transfer rate of payload only, not counting protocol chatter.intThe total rates for all peers for this torrent.intget limit of upload slots (unchoked peers) for this torrent.A bitmask representing which pieces has had their hash checked.
-
Constructor Details
-
TorrentStatus
-
-
Method Details
-
swig
- Returns:
- the native object
-
errorCode
May be set to an error message describing why the torrent was paused, in case it was paused by an error. If the torrent is not paused or if it's paused but not because of an error, this string is empty.- Returns:
- the error code
-
name
Returns the name of the torrent. Typically this is derived from the .torrent file. In case the torrent was started without metadata, and hasn't completely received it yet, it returns the name given to it when added to the session. See ``session::add_torrent``. This field is only included if the torrent status is queried with ``torrent_handle::query_name``.- Returns:
- the name
-
nextAnnounce
public long nextAnnounce()The time until the torrent will announce itself to the tracker (in milliseconds).- Returns:
- the next announce time
-
currentTracker
the URL of the last working tracker. If no tracker request has been successful yet, it's set to an empty string.- Returns:
-
totalDownload
public long totalDownload()The number of bytes downloaded and uploaded to all peers, accumulated, this session only. The session is considered to restart when a torrent is paused and restarted again. When a torrent is paused, these counters are reset to 0. If you want complete, persistent, stats, see allTimeUpload and allTimeDownload. -
totalUpload
public long totalUpload()The number of bytes downloaded and uploaded to all peers, accumulated, this session only. The session is considered to restart when a torrent is paused and restarted again. When a torrent is paused, these counters are reset to 0. If you want complete, persistent, stats, see allTimeUpload and allTimeDownload. -
totalPayloadDownload
public long totalPayloadDownload()Counts the amount of bytes received this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.- Returns:
-
totalPayloadUpload
public long totalPayloadUpload()Counts the amount of bytes send this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.- Returns:
-
totalFailedBytes
public long totalFailedBytes()The number of bytes that has been downloaded and that has failed the piece hash test. In other words, this is just how much crap that has been downloaded.- Returns:
-
totalRedundantBytes
public long totalRedundantBytes()The number of bytes that has been downloaded even though that data already was downloaded. The reason for this is that in some situations the same data can be downloaded by mistake. When libtorrent sends requests to a peer, and the peer doesn't send a response within a certain timeout, libtorrent will re-request that block. Another situation when libtorrent may re-request blocks is when the requests it sends out are not replied in FIFO-order (it will re-request blocks that are skipped by an out of order block). This is supposed to be as low as possible.- Returns:
- the value
-
pieces
IMPORTANT: If you are not getting up to date information about pieces remember that PieceIndexBitfield data is considered augmented data for a torrentHandle.status() call, meaning, if you want to get the latest piece data, you must use the TorrentHandle.QUERY_PIECES flag when invoking torrentHandle.status(TorrentHandle.QUERY_PIECES). Keep in mind this is an expensive call, therefore not part of the default flags. A bitmask that represents which pieces we have (set to true) and the pieces we don't have. It's a pointer and may be set to 0 if the torrent isn't downloading or seeding.- Returns:
- the bitfield of pieces
-
verifiedPieces
A bitmask representing which pieces has had their hash checked. This only applies to torrents in *seed mode*. If the torrent is not in seed mode, this bitmask may be empty.- Returns:
- the bitfield of verified pieces
-
totalDone
public long totalDone()The total number of bytes of the file(s) that we have. All this does not necessarily has to be downloaded during this session (that's total_payload_download).- Returns:
- the value
-
total
public long total()The total number of bytes to download for this torrent. This may be less than the size of the torrent in case there are pad files. This number only counts bytes that will actually be requested from peers. -
totalWantedDone
public long totalWantedDone()The number of bytes we have downloaded, only counting the pieces that we actually want to download. i.e. excluding any pieces that we have but have priority 0 (i.e. not wanted). -
totalWanted
public long totalWanted()The total number of bytes we want to download. This may be smaller than the total torrent size in case any pieces are prioritized to 0, i.e. not wanted. -
allTimeUpload
public long allTimeUpload()This is the accumulated upload payload byte counter. They are saved in and restored from resume data to keep totals across sessions. -
allTimeDownload
public long allTimeDownload()This is the accumulated download payload byte counters. They are saved in and restored from resume data to keep totals across sessions. -
addedTime
public long addedTime()The posix-time (in milliseconds) when this torrent was added. i.e. what time(NULL) returned at the time. -
completedTime
public long completedTime()The posix-time (in milliseconds) when this torrent was finished. If the torrent is not yet finished, this is 0. -
lastSeenComplete
public long lastSeenComplete()The time (in milliseconds) when we, or one of our peers, last saw a complete copy of this torrent. -
storageMode
-
progress
public float progress()A value in the range [0, 1], that represents the progress of the torrent's current task. It may be checking files or downloading.- Returns:
- the progress in [0, 1]
-
progressPpm
public int progressPpm()progress parts per million (progress * 1000000) when disabling floating point operations, this is the only option to query progressreflects the same value as ``progress``, but instead in a range [0, 1000000] (ppm = parts per million). When floating point operations are disabled, this is the only alternative to the floating point value in.
- Returns:
- the progress in parts per million (progress * 1000000)
-
queuePosition
public int queuePosition()the position this torrent has in the download queue. If the torrent is a seed or finished, this is -1.- Returns:
-
downloadRate
public int downloadRate()The total rates for all peers for this torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second. -
uploadRate
public int uploadRate()The total rates for all peers for this torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second. -
downloadPayloadRate
public int downloadPayloadRate()The total transfer rate of payload only, not counting protocol chatter. This might be slightly smaller than the other rates, but if projected over a long time (e.g. when calculating ETA:s) the difference may be noticeable. -
uploadPayloadRate
public int uploadPayloadRate()The total transfer rate of payload only, not counting protocol chatter. This might be slightly smaller than the other rates, but if projected over a long time (e.g. when calculating ETA:s) the difference may be noticeable. -
numSeeds
public int numSeeds()The number of peers that are seeding that this client is currently connected to. -
numPeers
public int numPeers()The number of peers this torrent currently is connected to. Peer connections that are in the half-open state (is attempting to connect) or are queued for later connection attempt do not count. Although they are visible in the peer list when you call get_peer_info(). -
numComplete
public int numComplete()If the tracker sends scrape info in its announce reply, these fields will be set to the total number of peers that have the whole file and the total number of peers that are still downloading. set to -1 if the tracker did not send any scrape data in its announce reply.- Returns:
-
numIncomplete
public int numIncomplete()If the tracker sends scrape info in its announce reply, these fields will be set to the total number of peers that have the whole file and the total number of peers that are still downloading. set to -1 if the tracker did not send any scrape data in its announce reply.- Returns:
-
listSeeds
public int listSeeds()The number of seeds in our peer list and the total number of peers (including seeds). We are not necessarily connected to all the peers in our peer list. This is the number of peers we know of in total, including banned peers and peers that we have failed to connect to. -
listPeers
public int listPeers()The number of seeds in our peer list and the total number of peers (including seeds). We are not necessarily connected to all the peers in our peer list. This is the number of peers we know of in total, including banned peers and peers that we have failed to connect to. -
connectCandidates
public int connectCandidates()the number of peers in this torrent's peer list that is a candidate to be connected to. i.e. It has fewer connect attempts than the max fail count, it is not a seed if we are a seed, it is not banned etc. If this is 0, it means we don't know of any more peers that we can try.- Returns:
-
numPieces
public int numPieces()Returns the number of pieces that has been downloaded so you don't have to count yourself. This can be used to see if anything has updated since last time if you want to keep a graph of the pieces up to date.- Returns:
- the number of pieces that has been downloaded
-
distributedFullCopies
public int distributedFullCopies()the number of distributed copies of the torrent. Note that one copy may be spread out among many peers. It tells how many copies there are currently of the rarest piece(s) among the peers this client is connected to.- Returns:
-
distributedFraction
public int distributedFraction()tells the share of pieces that have more copies than the rarest // piece(s). Divide this number by 1000 to get the fraction. // // For example, if ``distributed_full_copies`` is 2 and // ``distributed_fraction`` is 500, it means that the rarest pieces have // only 2 copies among the peers this torrent is connected to, and that // 50% of all the pieces have more than two copies. // // If we are a seed, the piece picker is deallocated as an optimization, // and piece availability is no longer tracked. In this case the // distributed copies members are set to -1.- Returns:
-
distributedCopies
public float distributedCopies()the number of distributed copies of the file. note that one copy may be spread out among many peers. This is a floating point representation of the distributed copies.the integer part tells how many copies there are of the rarest piece(s)
the fractional part tells the fraction of pieces that have more copies than the rarest piece(s).
- Returns:
-
blockSize
public int blockSize()the size of a block, in bytes. A block is a sub piece, it is the number of bytes that each piece request asks for and the number of bytes that each bit in the ``partial_piece_info``'s bitset represents, see get_download_queue(). This is typically 16 kB, but it may be larger if the pieces are larger.- Returns:
-
numUploads
public int numUploads()the number of unchoked peers in this torrent.- Returns:
-
numConnections
public int numConnections()Returns the number of peer connections this torrent has, including half-open connections that hasn't completed the bittorrent handshake yet.This is always
>= num_peers.- Returns:
- the number of peer connections
-
uploadsLimit
public int uploadsLimit()get limit of upload slots (unchoked peers) for this torrent.- Returns:
-
connectionsLimit
public int connectionsLimit()get limit of number of connections for this torrent.- Returns:
-
upBandwidthQueue
public int upBandwidthQueue()the number of peers in this torrent that are waiting for more bandwidth quota from the torrent rate limiter. This can determine if the rate you get from this torrent is bound by the torrents limit or not. If there is no limit set on this torrent, the peers might still be waiting for bandwidth quota from the global limiter, but then they are counted in the ``session_status`` object.- Returns:
-
downBandwidthQueue
public int downBandwidthQueue()the number of peers in this torrent that are waiting for more bandwidth quota from the torrent rate limiter. This can determine if the rate you get from this torrent is bound by the torrents limit or not. If there is no limit set on this torrent, the peers might still be waiting for bandwidth quota from the global limiter, but then they are counted in the ``session_status`` object.- Returns:
-
seedRank
public int seedRank()A rank of how important it is to seed the torrent, it is used to determine which torrents to seed and which to queue. It is based on the peer to seed ratio from the tracker scrape. Higher value means more important to seed.- Returns:
- the seed rank
-
state
The main state the torrent is in. See torrent_status::state_t.- Returns:
- the state
-
needSaveResume
public boolean needSaveResume()true if this torrent has unsaved changes to its download state and statistics since the last resume data was saved.- Returns:
-
isSeeding
public boolean isSeeding()true if all pieces have been downloaded.- Returns:
-
isFinished
public boolean isFinished()Returnstrueif all pieces that have apriority > 0are downloaded. There is only a distinction between finished and seeding if some pieces or files have been set to priority 0, i.e. are not downloaded.- Returns:
trueif all pieces that have apriority > 0are downloaded.
-
hasMetadata
public boolean hasMetadata()true if this torrent has metadata (either it was started from a .torrent file or the metadata has been downloaded). The only scenario where this can be false is when the torrent was started torrent-less (i.e. with just an info-hash and tracker ip, a magnet link for instance).- Returns:
-
hasIncoming
public boolean hasIncoming()true if there has ever been an incoming connection attempt to this torrent.- Returns:
-
isMovingStorage
public boolean isMovingStorage()this is true if this torrent's storage is currently being moved from one location to another. This may potentially be a long operation if a large file ends up being copied from one drive to another.- Returns:
-
announcingToTrackers
public boolean announcingToTrackers()These are set to true if this torrent is allowed to announce to the respective peer source. Whether they are true or false is determined by the queue logic/auto manager. Torrents that are not auto managed will always be allowed to announce to all peer sources.- Returns:
-
announcingToLsd
public boolean announcingToLsd()These are set to true if this torrent is allowed to announce to the respective peer source. Whether they are true or false is determined by the queue logic/auto manager. Torrents that are not auto managed will always be allowed to announce to all peer sources.- Returns:
-
announcingToDht
public boolean announcingToDht()These are set to true if this torrent is allowed to announce to the respective peer source. Whether they are true or false is determined by the queue logic/auto manager. Torrents that are not auto managed will always be allowed to announce to all peer sources.- Returns:
-
infoHash
-
infoHashV1
-
infoHashV2
-
lastUpload
public long lastUpload() -
lastDownload
public long lastDownload() -
activeDuration
public long activeDuration() -
finishedDuration
public long finishedDuration() -
seedingDuration
public long seedingDuration() -
flags
-
clone
-