From 1574341dbabddf31584a1ff9ac230a7009b66f00 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Thu, 13 Feb 2014 14:54:39 -0600 Subject: [PATCH] Add etcd node flag to nexter --- commands/pilosa-nexter/nexter.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/commands/pilosa-nexter/nexter.go b/commands/pilosa-nexter/nexter.go index d5f735dbc..a7a6d3d77 100644 --- a/commands/pilosa-nexter/nexter.go +++ b/commands/pilosa-nexter/nexter.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "flag" + "fmt" "log" "net/http" "strconv" @@ -12,12 +13,25 @@ import ( "github.com/coreos/go-etcd/etcd" ) +type stringslice []string + +func (self *stringslice) String() string { + return fmt.Sprintf("%d", *self) +} + +func (self *stringslice) Set(value string) error { + *self = append(*self, value) + return nil +} + var port uint var blocksize uint64 +var etcd_nodes stringslice func init() { flag.UintVar(&port, "port", 9000, "Port to run HTTP server on") flag.Uint64Var(&blocksize, "blocksize", 64, "Block size") + flag.Var(&etcd_nodes, "etcd", "Etcd server") flag.Parse() } @@ -90,7 +104,7 @@ func (self *Nexter) countloop(ch chan uint64, id int, client *etcd.Client) { func (self *Nexter) loop() { counters := make(map[int]chan uint64) - client := etcd.NewClient(nil) + client := etcd.NewClient(etcd_nodes) for { select { case req := <-self.reqchan: