piecestate.go 689 B

123456789101112131415161718192021222324252627282930
  1. package torrent
  2. import (
  3. "github.com/anacrolix/torrent/storage"
  4. )
  5. // The current state of a piece.
  6. type PieceState struct {
  7. Priority PiecePriority
  8. storage.Completion
  9. // The piece is being hashed, or is queued for hash. Deprecated: Use those fields instead.
  10. Checking bool
  11. Hashing bool
  12. QueuedForHash bool
  13. // The piece state is being marked in the storage.
  14. Marking bool
  15. // Some of the piece has been obtained.
  16. Partial bool
  17. // The v2 hash for the piece layer is missing.
  18. MissingPieceLayerHash bool
  19. }
  20. // Represents a series of consecutive pieces with the same state.
  21. type PieceStateRun struct {
  22. PieceState
  23. Length int // How many consecutive pieces have this state.
  24. }