2022-02-17 12:42:07 +00:00
|
|
|
package notificator
|
|
|
|
|
2022-05-31 17:00:41 +00:00
|
|
|
import (
|
2023-03-13 11:37:35 +00:00
|
|
|
"context"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
2022-05-31 17:00:41 +00:00
|
|
|
)
|
2022-02-17 12:42:07 +00:00
|
|
|
|
|
|
|
// NotificationSource is a source of object notifications.
|
|
|
|
type NotificationSource interface {
|
|
|
|
// Iterate must iterate over all notifications for the
|
|
|
|
// provided epoch and call handler for all of them.
|
2023-03-13 11:37:35 +00:00
|
|
|
Iterate(ctx context.Context, epoch uint64, handler func(topic string, addr oid.Address))
|
2022-02-17 12:42:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NotificationWriter notifies all the subscribers
|
|
|
|
// about new object notifications.
|
|
|
|
type NotificationWriter interface {
|
2022-02-17 12:43:09 +00:00
|
|
|
// Notify must notify about an event generated
|
|
|
|
// from an object with a specific topic.
|
2022-05-31 17:00:41 +00:00
|
|
|
Notify(topic string, address oid.Address)
|
2022-02-17 12:42:07 +00:00
|
|
|
}
|