Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a public version of Torrent.numPiecesCompleted() #352

Closed
nektro opened this issue Dec 5, 2019 · 8 comments
Closed

add a public version of Torrent.numPiecesCompleted() #352

nektro opened this issue Dec 5, 2019 · 8 comments

Comments

@nektro
Copy link

nektro commented Dec 5, 2019

No description provided.

@anacrolix
Copy link
Owner

Was there a PR with this? Have you tried using Torrent.Piece? Maybe a Torrent.Pieces should be added?

@nektro
Copy link
Author

nektro commented Dec 12, 2019

There's Torrent.NumPieces but that's the total number of pieces, not the number of completed ones.

@anacrolix
Copy link
Owner

What I mean is that you could collect this data yourself by checking each Piece. Something like

for i := 0; i < t.NumPieces(); i++ {
    do something with t.Piece(i).Storage().Completion()
}

@james-lawrence
Copy link
Contributor

imo could be added to torrent stats.

@anacrolix
Copy link
Owner

anacrolix commented Jan 4, 2020

@nektro any update on this? Is the suggested workaround okay for you?

@nektro
Copy link
Author

nektro commented Jan 4, 2020

If it returns the same number then I can copy/paste the internal implementation sure, but the issue was asking if this method would be exposed publicly without having to make my own function (since it already exists privately (lowercase name)).

@anacrolix
Copy link
Owner

@nektro I wouldn't want to expose a method just for this, if it can be bundled into some other method that requires a lock (like torrent stats per @james-lawrence suggestion).

@anacrolix
Copy link
Owner

Added this to stats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants