summaryrefslogtreecommitdiff
path: root/srv/src/cfg/radix_client.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-09-13 12:25:45 +0200
committerBrian Picciano <mediocregopher@gmail.com>2022-09-13 12:25:45 +0200
commit5485984e05aebde22819adebfbd5ad51475a6c21 (patch)
treed3a8306755713e488ef23be507eafa3b0c574526 /srv/src/cfg/radix_client.go
parentb1641d1af92eca6e475ea76aaed21a5dab0df185 (diff)
remove redis and circus
Diffstat (limited to 'srv/src/cfg/radix_client.go')
-rw-r--r--srv/src/cfg/radix_client.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/srv/src/cfg/radix_client.go b/srv/src/cfg/radix_client.go
deleted file mode 100644
index 55ff5d7..0000000
--- a/srv/src/cfg/radix_client.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package cfg
-
-import (
- "context"
- "fmt"
-
- "github.com/mediocregopher/mediocre-go-lib/v2/mctx"
- "github.com/mediocregopher/radix/v4"
-)
-
-// RadixClient is a single redis client which can be configured.
-type RadixClient struct {
- radix.Client
-
- proto, addr string
- poolSize int
-}
-
-// SetupCfg implement the cfg.Cfger interface.
-func (c *RadixClient) SetupCfg(cfg *Cfg) {
-
- cfg.StringVar(&c.proto, "redis-proto", "tcp", "Network protocol to connect to redis over, can be tcp or unix")
- cfg.StringVar(&c.addr, "redis-addr", "127.0.0.1:6379", "Address redis is expected to listen on")
- cfg.IntVar(&c.poolSize, "redis-pool-size", 5, "Number of connections in the redis pool to keep")
-
- cfg.OnInit(func(ctx context.Context) error {
- client, err := (radix.PoolConfig{
- Size: c.poolSize,
- }).New(
- ctx, c.proto, c.addr,
- )
-
- if err != nil {
- return fmt.Errorf(
- "initializing redis pool of size %d at %s://%s: %w",
- c.poolSize, c.proto, c.addr, err,
- )
- }
-
- c.Client = client
- return nil
- })
-}
-
-// Annotate implements mctx.Annotator interface.
-func (c *RadixClient) Annotate(a mctx.Annotations) {
- a["redisProto"] = c.proto
- a["redisAddr"] = c.addr
- a["redisPoolSize"] = c.poolSize
-}
-
-// Close cleans up the radix client.
-func (c *RadixClient) Close() error {
- return c.Client.Close()
-}