Documentation
¶
Index ¶
- Constants
- func DecodeEvent(event *gateway.Event) (recipients []string, templateData map[string]any, err error)
- func EncodeEvent(eventType string, recipients []string, templateData map[string]any) *gateway.Event
- func RegisterReaperJob(reaper *Reaper) error
- func UserIDString(id *userpb.UserId) string
- type NoopPreferenceResolver
- type PreferenceResolver
- type Reaper
- type ReaperConfig
- type Worker
- type WorkerConfig
Constants ¶
const ReaperJobName = "notifications.reaper"
ReaperJobName is the rjobs periodic job name for accumulator recovery.
Variables ¶
This section is empty.
Functions ¶
func DecodeEvent ¶
func DecodeEvent(event *gateway.Event) (recipients []string, templateData map[string]any, err error)
DecodeEvent extracts the recipients and template data a producer packed into the event with EncodeEvent. It is the inverse of EncodeEvent; the event type is read directly from the event and the identities are resolved by the gateway from the request context.
func EncodeEvent ¶
EncodeEvent packs a notification into a CS3 gateway event. The sender and the submitting user are intentionally absent: the gateway derives them from the authenticated request context, and the CS3 API forbids callers from supplying them.
func RegisterReaperJob ¶
RegisterReaperJob registers the accumulator reaper with Reva's jobs framework. The job runs on every node because lease acquisition is already SQL-coordinated and each node must be able to recover work after a local notification worker dies.
func UserIDString ¶
UserIDString renders a user id as the stable identifier used to attribute notifications to their submitter.
Types ¶
type NoopPreferenceResolver ¶
type NoopPreferenceResolver struct{}
NoopPreferenceResolver applies no recipient preference changes.
func (NoopPreferenceResolver) ResolveHandlers ¶
func (NoopPreferenceResolver) ResolveHandlers(_ context.Context, _ model.Envelope, handlers []string) ([]string, error)
ResolveHandlers implements PreferenceResolver.
type PreferenceResolver ¶
type PreferenceResolver interface {
ResolveHandlers(ctx context.Context, envelope model.Envelope, handlers []string) ([]string, error)
}
PreferenceResolver narrows the configured handler set for a recipient set.
type Reaper ¶
type Reaper struct {
// contains filtered or unexported fields
}
Reaper periodically recovers accumulated event groups that are unleased or have an expired lease.
func NewReaper ¶
func NewReaper(worker *Worker, conf ReaperConfig) *Reaper
NewReaper creates a reaper for the given worker.
type ReaperConfig ¶
ReaperConfig configures the accumulator reaper.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker handles notification envelopes consumed from NATS.
func NewWorker ¶
func NewWorker(store accumulation.Store, dispatcher *handlers.Dispatcher, conf WorkerConfig) (*Worker, error)
NewWorker creates a notification worker.
type WorkerConfig ¶
type WorkerConfig struct {
OwnerID string
EventRules map[string]model.EventRule
Preferences PreferenceResolver
LeaseDuration time.Duration
MaxRenderedItems int
}
WorkerConfig configures a notification worker.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accumulation stores accepted notification events that share a deduplication key and coordinates, through an expiring lease, which box flushes them.
|
Package accumulation stores accepted notification events that share a deduplication key and coordinates, through an expiring lease, which box flushes them. |