1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Move Select to stateful commands and make it available only via Pipeline and Tx.

This commit is contained in:
Vladimir Mihailenco
2016-06-05 09:45:39 +00:00
parent 5a2dda6d40
commit ac162eb843
13 changed files with 481 additions and 485 deletions

View File

@ -25,7 +25,7 @@ type FailoverOptions struct {
// Following options are copied from Options struct.
Password string
DB int64
DB int
MaxRetries int
@ -70,43 +70,41 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
opt: opt,
}
base := baseClient{
opt: opt,
connPool: failover.Pool(),
client := Client{
baseClient: baseClient{
opt: opt,
connPool: failover.Pool(),
onClose: func() error {
return failover.Close()
},
}
return &Client{
baseClient: base,
commandable: commandable{
process: base.process,
onClose: func() error {
return failover.Close()
},
},
}
client.cmdable.process = client.Process
return &client
}
//------------------------------------------------------------------------------
type sentinelClient struct {
cmdable
baseClient
commandable
}
func newSentinel(opt *Options) *sentinelClient {
base := baseClient{
opt: opt,
connPool: newConnPool(opt),
}
return &sentinelClient{
baseClient: base,
commandable: commandable{process: base.process},
client := sentinelClient{
baseClient: baseClient{
opt: opt,
connPool: newConnPool(opt),
},
}
client.cmdable = cmdable{client.Process}
return &client
}
func (c *sentinelClient) PubSub() *PubSub {
return &PubSub{
base: &baseClient{
base: baseClient{
opt: c.opt,
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), false),
},