mirror of
https://github.com/LBRYFoundation/tracker.git
synced 2025-08-23 17:47:29 +00:00
docs updated
This commit is contained in:
parent
b8a927d26c
commit
4226ecc59d
3 changed files with 7 additions and 15 deletions
2
cache/cache.go
vendored
2
cache/cache.go
vendored
|
@ -3,7 +3,7 @@
|
||||||
// which can be found in the LICENSE file.
|
// which can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package storage provides a generic interface for manipulating a
|
// Package storage provides a generic interface for manipulating a
|
||||||
// BitTorrent tracker's cache.
|
// BitTorrent tracker's fast moving data.
|
||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
17
cache/redis/redis.go
vendored
17
cache/redis/redis.go
vendored
|
@ -5,9 +5,12 @@
|
||||||
// Package redis implements the storage interface for a BitTorrent tracker.
|
// Package redis implements the storage interface for a BitTorrent tracker.
|
||||||
//
|
//
|
||||||
// The client whitelist is represented as a set with the key name "whitelist"
|
// The client whitelist is represented as a set with the key name "whitelist"
|
||||||
// with an optional prefix. Torrents and users are JSON-formatted strings.
|
// with an optional prefix. Torrents and users are represented as hashes.
|
||||||
// Torrents' keys are named "torrent:<infohash>" with an optional prefix.
|
// Torrents' keys are named "torrent:<infohash>" with an optional prefix.
|
||||||
// Users' keys are named "user:<passkey>" with an optional prefix.
|
// Users' keys are named "user:<passkey>" with an optional prefix. The
|
||||||
|
// seeders and leechers attributes of torrent hashes are strings that represent
|
||||||
|
// the key for those hashes within redis. This is done because redis cannot
|
||||||
|
// nest their hash data type.
|
||||||
package redis
|
package redis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -38,17 +41,7 @@ func (d *driver) New(conf *config.Cache) cache.Pool {
|
||||||
|
|
||||||
func makeDialFunc(conf *config.Cache) func() (redis.Conn, error) {
|
func makeDialFunc(conf *config.Cache) func() (redis.Conn, error) {
|
||||||
return func() (conn redis.Conn, err error) {
|
return func() (conn redis.Conn, err error) {
|
||||||
if conf.ConnTimeout != nil {
|
|
||||||
conn, err = redis.DialTimeout(
|
|
||||||
conf.Network,
|
|
||||||
conf.Addr,
|
|
||||||
conf.ConnTimeout.Duration, // Connect Timeout
|
|
||||||
conf.ConnTimeout.Duration, // Read Timeout
|
|
||||||
conf.ConnTimeout.Duration, // Write Timeout
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
conn, err = redis.Dial(conf.Network, conf.Addr)
|
conn, err = redis.Dial(conf.Network, conf.Addr)
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ type Cache struct {
|
||||||
|
|
||||||
MaxIdleConn int `json:"max_idle_conn"`
|
MaxIdleConn int `json:"max_idle_conn"`
|
||||||
IdleTimeout *Duration `json:"idle_timeout"`
|
IdleTimeout *Duration `json:"idle_timeout"`
|
||||||
ConnTimeout *Duration `json:"conn_timeout"`
|
|
||||||
TxRetries int `json:"tx_retries"`
|
TxRetries int `json:"tx_retries"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue