mirror of
https://github.com/minio/minio.git
synced 2025-11-23 11:07:50 -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
@@ -34,7 +34,12 @@ func (target ExampleTarget) ID() TargetID {
|
||||
return target.id
|
||||
}
|
||||
|
||||
func (target ExampleTarget) Send(eventData Event) error {
|
||||
// Save - Sends event directly without persisting.
|
||||
func (target ExampleTarget) Save(eventData Event) error {
|
||||
return target.send(eventData)
|
||||
}
|
||||
|
||||
func (target ExampleTarget) send(eventData Event) error {
|
||||
b := make([]byte, 1)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
panic(err)
|
||||
@@ -49,6 +54,11 @@ func (target ExampleTarget) Send(eventData Event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Send - interface compatible method does no-op.
|
||||
func (target ExampleTarget) Send(eventKey string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (target ExampleTarget) Close() error {
|
||||
if target.closeErr {
|
||||
return errors.New("close error")
|
||||
|
||||
Reference in New Issue
Block a user