Documentation
¶
Overview ¶
Package storage provides a generic interface for manipulating a BitTorrent tracker's data store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTxDone = errors.New("storage: Transaction has already been committed or rolled back")
)
Functions ¶
Types ¶
type Pool ¶
Pool represents a thread-safe pool of connections to the data store that can be used to obtain transactions.
type Torrent ¶
type Torrent struct { ID uint64 `json:"id"` Infohash string `json:"infohash"` Active bool `json:"active"` Seeders map[string]Peer `json:"seeders"` Leechers map[string]Peer `json:"leechers"` Snatches uint `json:"snatches"` UpMultiplier float64 `json:"up_multiplier"` DownMultiplier float64 `json:"down_multipler"` LastAction int64 `json:"last_action"` }
type Tx ¶
type Tx interface { Commit() error Rollback() error // Reads FindUser(passkey string) (*User, bool, error) FindTorrent(infohash string) (*Torrent, bool, error) ClientWhitelisted(peerID string) (bool, error) // Writes Snatch(u *User, t *Torrent) error MarkActive(t *Torrent) error NewLeecher(t *Torrent, p *Peer) error NewSeeder(t *Torrent, p *Peer) error RmLeecher(t *Torrent, p *Peer) error RmSeeder(t *Torrent, p *Peer) error SetLeecher(t *Torrent, p *Peer) error SetSeeder(t *Torrent, p *Peer) error IncrementSlots(u *User) error DecrementSlots(u *User) error }
Tx represents an in-progress data store transaction. A transaction must end with a call to Commit or Rollback.
After a call to Commit or Rollback, all operations on the transaction must fail with ErrTxDone.
Click to show internal directories.
Click to hide internal directories.