Skip to content

Commit

Permalink
use sink name and command name for consule lock key
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaiqoqo committed Nov 6, 2018
1 parent 34da993 commit 860cc6f
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion command/allocations/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewFirehose() (*Firehose, error) {
}

func (f *Firehose) Name() string {
return "allocations"
return "allocations-" + f.sink.Name()
}

func (f *Firehose) UpdateCh() <-chan interface{} {
Expand Down
2 changes: 1 addition & 1 deletion command/deployments/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewFirehose() (*Firehose, error) {
}

func (f *Firehose) Name() string {
return "deployments"
return "deployments-" + f.sink.Name()
}

func (f *Firehose) UpdateCh() <-chan interface{} {
Expand Down
2 changes: 1 addition & 1 deletion command/evaluations/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewFirehose() (*Firehose, error) {
}

func (f *Firehose) Name() string {
return "evaluations"
return "evaluations-" + f.sink.Name()
}

func (f *Firehose) UpdateCh() <-chan interface{} {
Expand Down
2 changes: 1 addition & 1 deletion command/jobs/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewJobFirehose() (*JobFirehose, error) {


func (f *JobFirehose) Name() string {
return "jobs"
return "jobs-" + f.sink.Name()
}

// Publish an update from the firehose
Expand Down
2 changes: 1 addition & 1 deletion command/jobs/jobsliststub.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewJobListStubFirehose() (*JobListStubFirehose, error) {
}

func (f *JobListStubFirehose) Name() string {
return "jobliststub"
return "jobliststub-" + f.sink.Name()
}

func (f *JobListStubFirehose) Start() {
Expand Down
5 changes: 5 additions & 0 deletions sink/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ func (s *HttpSink) send(id int) {
}
}
}

// Name ..
func (s *HttpSink) Name() string {
return "http"
}
5 changes: 5 additions & 0 deletions sink/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,8 @@ func (s *KafkaSink) write() {
}
}
}

// Name ..
func (s *KafkaSink) Name() string {
return "kafka"
}
5 changes: 5 additions & 0 deletions sink/kinesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,8 @@ func (s *KinesisSink) write(id int) {
}
}
}

// Name ..
func (s *KinesisSink) Name() string {
return "kinesis"
}
5 changes: 5 additions & 0 deletions sink/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,8 @@ func (s *MongodbSink) write(id int) {
}
}
}

// Name ..
func (s *MongodbSink) Name() string {
return "mongodb"
}
5 changes: 5 additions & 0 deletions sink/nsq.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ func (s *NSQSink) write(id int) {
}
}
}

// Name ..
func (s *NSQSink) Name() string {
return "nsq"
}
5 changes: 5 additions & 0 deletions sink/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@ func (s *RabbitmqSink) write(id int) {
}
}
}

// RabbitmqSink ..
func (s *RabbitmqSink) Name() string {
return "rabbitmq"
}
5 changes: 5 additions & 0 deletions sink/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,8 @@ func (s *RedisSink) write() {
}
}
}

// Name ..
func (s *RedisSink) Name() string {
return "redis"
}
6 changes: 6 additions & 0 deletions sink/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ func (s *StdoutSink) Put(data []byte) error {
fmt.Println(string(data))
return nil
}

// Name ..
func (s *StdoutSink) Name() string {
return "stdout"
}

1 change: 1 addition & 0 deletions sink/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ type Sink interface {
Start() error
Stop()
Put(data []byte) error
Name() string
}

0 comments on commit 860cc6f

Please sign in to comment.