Documentation
¶
Overview ¶
Package redis implements the storage interface for a BitTorrent tracker.
The client whitelist is represented as a set with the key name "whitelist" with an optional prefix. Torrents and users are JSON-formatted strings. Torrents' keys are named "torrent:<infohash>" with an optional prefix. Users' keys are named "user:<passkey>" with an optional prefix.
Index ¶
- type Pool
- type Tx
- func (tx *Tx) ClientWhitelisted(peerID string) (exists bool, err error)
- func (tx *Tx) Commit() error
- func (tx *Tx) DecrementSlots(u *storage.User) error
- func (tx *Tx) FindTorrent(infohash string) (*storage.Torrent, bool, error)
- func (tx *Tx) FindUser(passkey string) (*storage.User, bool, error)
- func (tx *Tx) IncrementSlots(u *storage.User) error
- func (tx *Tx) MarkActive(t *storage.Torrent) error
- func (tx *Tx) NewLeecher(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) NewSeeder(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) RmLeecher(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) RmSeeder(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) Rollback() error
- func (tx *Tx) SetLeecher(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) SetSeeder(t *storage.Torrent, p *storage.Peer) error
- func (tx *Tx) Snatch(user *storage.User, torrent *storage.Torrent) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tx ¶
Tx represents a transaction for Redis with one gotcha: all reads must be done prior to any writes. Writes will check if the MULTI command has been sent to redis and will send it if it hasn't.
Internally a transaction looks like: WATCH keyA GET keyA WATCH keyB GET keyB MULTI SET keyA SET keyB EXEC