Class: QuartzTorrent::TorrentDataDelegate
- Inherits:
-
Object
- Object
- QuartzTorrent::TorrentDataDelegate
- Defined in:
- lib/quartz_torrent/peerclient.rb
Overview
Data about torrents for use by the end user.
Instance Attribute Summary collapse
-
#alarms ⇒ Object
Array of currently raised alarms.
-
#bytesDownloaded ⇒ Object
Returns the value of attribute bytesDownloaded.
-
#bytesDownloadedDataOnly ⇒ Object
Returns the value of attribute bytesDownloadedDataOnly.
-
#bytesUploaded ⇒ Object
Returns the value of attribute bytesUploaded.
-
#bytesUploadedDataOnly ⇒ Object
Returns the value of attribute bytesUploadedDataOnly.
-
#completedBytes ⇒ Object
readonly
Count of completed bytes of the torrent.
-
#completePieceBitfield ⇒ Object
readonly
Bitfield representing which pieces of the torrent are completed.
-
#downloadRate ⇒ Object
readonly
Download rate in bytes/second.
-
#downloadRateDataOnly ⇒ Object
readonly
Download rate limit in bytes/second if a limit is set, nil otherwise.
-
#downloadRateLimit ⇒ Object
readonly
Download rate limit in bytes/second if a limit is set, nil otherwise.
-
#info ⇒ Object
Torrent Metainfo.info struct.
-
#infoHash ⇒ Object
Infohash of the torrent.
-
#metainfoCompletedLength ⇒ Object
readonly
How much of the metainfo info we have downloaded in bytes.
-
#metainfoLength ⇒ Object
readonly
Length of metainfo info in bytes.
-
#paused ⇒ Object
readonly
Whether or not the torrent is paused.
-
#peers ⇒ Object
readonly
Array of peers for the torrent.
-
#queued ⇒ Object
readonly
Whether or not the torrent is queued.
-
#ratio ⇒ Object
After we have completed downloading a torrent, we will continue to upload until we have uploaded ratio * torrent_size bytes.
-
#recommendedName ⇒ Object
Recommended display name for this torrent.
-
#state ⇒ Object
readonly
State of the torrent.
-
#uploadDuration ⇒ Object
Returns the value of attribute uploadDuration.
-
#uploadRate ⇒ Object
readonly
Upload rate in bytes/second.
-
#uploadRateDataOnly ⇒ Object
readonly
Returns the value of attribute uploadRateDataOnly.
-
#uploadRateLimit ⇒ Object
readonly
Upload rate limit in bytes/second if a limit is set, nil otherwise.
Instance Method Summary collapse
-
#initialize(torrentData, peerClientHandler) ⇒ TorrentDataDelegate
constructor
Create a new TorrentDataDelegate.
-
#internalRefresh ⇒ Object
Set the fields of this TorrentDataDelegate from the passed torrentData.
-
#refresh ⇒ Object
Update the data in this TorrentDataDelegate from the torrentData object that it was created from.
Constructor Details
#initialize(torrentData, peerClientHandler) ⇒ TorrentDataDelegate
Create a new TorrentDataDelegate. This is meant to only be called internally.
130 131 132 133 134 |
# File 'lib/quartz_torrent/peerclient.rb', line 130 def initialize(torrentData, peerClientHandler) fillFrom(torrentData) @torrentData = torrentData @peerClientHandler = peerClientHandler end |
Instance Attribute Details
#alarms ⇒ Object
Array of currently raised alarms
180 181 182 |
# File 'lib/quartz_torrent/peerclient.rb', line 180 def alarms @alarms end |
#bytesDownloaded ⇒ Object
Returns the value of attribute bytesDownloaded.
178 179 180 |
# File 'lib/quartz_torrent/peerclient.rb', line 178 def bytesDownloaded @bytesDownloaded end |
#bytesDownloadedDataOnly ⇒ Object
Returns the value of attribute bytesDownloadedDataOnly.
176 177 178 |
# File 'lib/quartz_torrent/peerclient.rb', line 176 def bytesDownloadedDataOnly @bytesDownloadedDataOnly end |
#bytesUploaded ⇒ Object
Returns the value of attribute bytesUploaded.
177 178 179 |
# File 'lib/quartz_torrent/peerclient.rb', line 177 def bytesUploaded @bytesUploaded end |
#bytesUploadedDataOnly ⇒ Object
Returns the value of attribute bytesUploadedDataOnly.
175 176 177 |
# File 'lib/quartz_torrent/peerclient.rb', line 175 def bytesUploadedDataOnly @bytesUploadedDataOnly end |
#completedBytes ⇒ Object (readonly)
Count of completed bytes of the torrent
155 156 157 |
# File 'lib/quartz_torrent/peerclient.rb', line 155 def completedBytes @completedBytes end |
#completePieceBitfield ⇒ Object (readonly)
Bitfield representing which pieces of the torrent are completed.
162 163 164 |
# File 'lib/quartz_torrent/peerclient.rb', line 162 def completePieceBitfield @completePieceBitfield end |
#downloadRate ⇒ Object (readonly)
Download rate in bytes/second
144 145 146 |
# File 'lib/quartz_torrent/peerclient.rb', line 144 def downloadRate @downloadRate end |
#downloadRateDataOnly ⇒ Object (readonly)
Download rate limit in bytes/second if a limit is set, nil otherwise
152 153 154 |
# File 'lib/quartz_torrent/peerclient.rb', line 152 def downloadRateDataOnly @downloadRateDataOnly end |
#downloadRateLimit ⇒ Object (readonly)
Download rate limit in bytes/second if a limit is set, nil otherwise
148 149 150 |
# File 'lib/quartz_torrent/peerclient.rb', line 148 def downloadRateLimit @downloadRateLimit end |
#info ⇒ Object
Torrent Metainfo.info struct. This is nil if the torrent has no metadata and we haven’t downloaded it yet (i.e. a magnet link).
138 139 140 |
# File 'lib/quartz_torrent/peerclient.rb', line 138 def info @info end |
#infoHash ⇒ Object
Infohash of the torrent. This is binary data.
140 141 142 |
# File 'lib/quartz_torrent/peerclient.rb', line 140 def infoHash @infoHash end |
#metainfoCompletedLength ⇒ Object (readonly)
How much of the metainfo info we have downloaded in bytes. This is only set when the state is :downloading_metainfo
166 167 168 |
# File 'lib/quartz_torrent/peerclient.rb', line 166 def @metainfoCompletedLength end |
#metainfoLength ⇒ Object (readonly)
Length of metainfo info in bytes. This is only set when the state is :downloading_metainfo
164 165 166 |
# File 'lib/quartz_torrent/peerclient.rb', line 164 def @metainfoLength end |
#paused ⇒ Object (readonly)
Whether or not the torrent is paused.
168 169 170 |
# File 'lib/quartz_torrent/peerclient.rb', line 168 def paused @paused end |
#peers ⇒ Object (readonly)
Array of peers for the torrent. These include connected, disconnected, and handshaking peers
157 158 159 |
# File 'lib/quartz_torrent/peerclient.rb', line 157 def peers @peers end |
#queued ⇒ Object (readonly)
Whether or not the torrent is queued.
170 171 172 |
# File 'lib/quartz_torrent/peerclient.rb', line 170 def queued @queued end |
#ratio ⇒ Object
After we have completed downloading a torrent, we will continue to upload until we have uploaded ratio * torrent_size bytes. If nil, no limit on upload.
173 174 175 |
# File 'lib/quartz_torrent/peerclient.rb', line 173 def ratio @ratio end |
#recommendedName ⇒ Object
Recommended display name for this torrent.
142 143 144 |
# File 'lib/quartz_torrent/peerclient.rb', line 142 def recommendedName @recommendedName end |
#state ⇒ Object (readonly)
State of the torrent. This may be one of :downloading_metainfo, :error, :checking_pieces, :running, :downloading_metainfo, or :deleted. The :deleted state indicates that the torrent that this TorrentDataDelegate refers to is no longer being managed by the peer client.
160 161 162 |
# File 'lib/quartz_torrent/peerclient.rb', line 160 def state @state end |
#uploadDuration ⇒ Object
Returns the value of attribute uploadDuration.
174 175 176 |
# File 'lib/quartz_torrent/peerclient.rb', line 174 def uploadDuration @uploadDuration end |
#uploadRate ⇒ Object (readonly)
Upload rate in bytes/second
146 147 148 |
# File 'lib/quartz_torrent/peerclient.rb', line 146 def uploadRate @uploadRate end |
#uploadRateDataOnly ⇒ Object (readonly)
Returns the value of attribute uploadRateDataOnly.
153 154 155 |
# File 'lib/quartz_torrent/peerclient.rb', line 153 def uploadRateDataOnly @uploadRateDataOnly end |
#uploadRateLimit ⇒ Object (readonly)
Upload rate limit in bytes/second if a limit is set, nil otherwise
150 151 152 |
# File 'lib/quartz_torrent/peerclient.rb', line 150 def uploadRateLimit @uploadRateLimit end |
Instance Method Details
#internalRefresh ⇒ Object
Set the fields of this TorrentDataDelegate from the passed torrentData. This is meant to only be called internally.
190 191 192 |
# File 'lib/quartz_torrent/peerclient.rb', line 190 def internalRefresh fillFrom(@torrentData) end |
#refresh ⇒ Object
Update the data in this TorrentDataDelegate from the torrentData object that it was created from. TODO: What if that torrentData is now gone?
184 185 186 |
# File 'lib/quartz_torrent/peerclient.rb', line 184 def refresh @peerClientHandler.updateDelegateTorrentData self end |