mirror of
https://github.com/minio/minio.git
synced 2025-11-25 12:06: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
@@ -107,8 +107,12 @@ func (target *AMQPTarget) channel() (*amqp.Channel, error) {
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
// Send - sends event to AMQP.
|
||||
func (target *AMQPTarget) Send(eventData event.Event) error {
|
||||
// Save - Sends event directly without persisting.
|
||||
func (target *AMQPTarget) Save(eventData event.Event) error {
|
||||
return target.send(eventData)
|
||||
}
|
||||
|
||||
func (target *AMQPTarget) send(eventData event.Event) error {
|
||||
ch, err := target.channel()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -142,6 +146,11 @@ func (target *AMQPTarget) Send(eventData event.Event) error {
|
||||
})
|
||||
}
|
||||
|
||||
// Send - interface compatible method does no-op.
|
||||
func (target *AMQPTarget) Send(eventKey string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close - does nothing and available for interface compatibility.
|
||||
func (target *AMQPTarget) Close() error {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user