mirror of
https://github.com/minio/minio.git
synced 2025-11-25 20:16:10 -05:00
Enhance the event store interface to support channeling (#7343)
- Avoids code duplication across the other targets. By having a centralized function call. - Reduce the room for race.
This commit is contained in:
committed by
Nitish Tiwari
parent
ddb0d646aa
commit
47ca411163
@@ -89,8 +89,12 @@ func (target *HTTPClientTarget) start() {
|
||||
}()
|
||||
}
|
||||
|
||||
// Send - sends event to HTTP client.
|
||||
func (target *HTTPClientTarget) Send(eventData event.Event) error {
|
||||
// Save - sends event to HTTP client.
|
||||
func (target *HTTPClientTarget) Save(eventData event.Event) error {
|
||||
return target.send(eventData)
|
||||
}
|
||||
|
||||
func (target *HTTPClientTarget) send(eventData event.Event) error {
|
||||
if atomic.LoadUint32(&target.isRunning) != 0 {
|
||||
return errors.New("closed http connection")
|
||||
}
|
||||
@@ -109,6 +113,11 @@ func (target *HTTPClientTarget) Send(eventData event.Event) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Send - interface compatible method does no-op.
|
||||
func (target *HTTPClientTarget) Send(eventKey string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close - closes underneath goroutine.
|
||||
func (target *HTTPClientTarget) Close() error {
|
||||
atomic.AddUint32(&target.isStopped, 1)
|
||||
|
||||
Reference in New Issue
Block a user