From 4226ecc59d07c9ca8c3441cebf3bfaa2430b2111 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Sat, 24 Aug 2013 00:24:42 -0400 Subject: [PATCH] docs updated --- cache/cache.go | 2 +- cache/redis/redis.go | 19 ++++++------------- config/config.go | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/cache/cache.go b/cache/cache.go index ed11ab3..8ead108 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -3,7 +3,7 @@ // which can be found in the LICENSE file. // Package storage provides a generic interface for manipulating a -// BitTorrent tracker's cache. +// BitTorrent tracker's fast moving data. package cache import ( diff --git a/cache/redis/redis.go b/cache/redis/redis.go index 49bdded..bd09fab 100644 --- a/cache/redis/redis.go +++ b/cache/redis/redis.go @@ -5,9 +5,12 @@ // 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. +// with an optional prefix. Torrents and users are represented as hashes. // Torrents' keys are named "torrent:" with an optional prefix. -// Users' keys are named "user:" with an optional prefix. +// Users' keys are named "user:" 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 import ( @@ -38,17 +41,7 @@ func (d *driver) New(conf *config.Cache) cache.Pool { func makeDialFunc(conf *config.Cache) func() (redis.Conn, 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 { return nil, err } diff --git a/config/config.go b/config/config.go index 3f65876..8f417be 100644 --- a/config/config.go +++ b/config/config.go @@ -40,7 +40,6 @@ type Cache struct { MaxIdleConn int `json:"max_idle_conn"` IdleTimeout *Duration `json:"idle_timeout"` - ConnTimeout *Duration `json:"conn_timeout"` TxRetries int `json:"tx_retries"` }