Open-Source Wikis

/

MinIO

/

Packages

/

event and store

minio/minio

event and store

The eventing pipeline. internal/event builds the in-memory model of S3 events and target lists; internal/event/target/ adapters deliver to specific brokers; internal/store is the disk-backed FIFO queue every adapter falls back to when the broker is slow or down.

internal/event

File What it does
event.go The Event type (S3 record schema).
name.go Enum + parsing of S3 event names (s3:ObjectCreated:Put, ...).
arn.go Target ARN parsing.
targetid.go, targetidset.go Target identifier + set helpers.
targetlist.go The multiplex layer that fans out to many targets in parallel.
rules.go, rulesmap.go Per-bucket filter rules: prefix, suffix, event types.
config.go XML model used by PutBucketNotificationConfiguration.
errors.go Common errors.

TargetList holds all configured targets and forwards each event to those whose ARN matches a bucket rule. Failures are kept per-target; a slow target never blocks fast ones.

internal/event/target/

One file per target type: Kafka, NATS, MQTT, AMQP, MySQL, PostgreSQL, Redis, NSQ, ElasticSearch, webhook. Each file implements the small Target interface:

type Target interface {
    ID() TargetID
    HasQueueStore() bool
    IsActive() (bool, error)
    Save(Event) error
    SendFromStore(key store.Key) error
    Close() error
}

Save is called for every event; the target may persist via store.Store and respond immediately or push to the broker synchronously. SendFromStore is invoked by the per-target drainer goroutine.

internal/store

A disk-backed FIFO queue used by every notification target (and by audit + logger targets). Files:

  • store.go — public Store interface and Key type.
  • *.go — the file-based implementation that lives under the per-target directory under .minio.sys/buckets/<bucket>/.notifications/<target-id>/.

Entries are JSON; each entry has a unique key. The drainer loops over the keys, attempts to send, deletes on success.

Integration points

graph LR
    H[Handlers] --> N[cmd/event-notification.go]
    N --> EVT[internal/event]
    EVT --> TARGET[Target adapter]
    TARGET --> STORE[internal/store]
    TARGET --> BROKER[Kafka / NATS / ...]
  • Source-side: cmd/event-notification.go and cmd/notification.go build events and call TargetList.Send.
  • Sink-side: external brokers via the per-target SDKs.
  • Configuration: internal/config/notify/notify_<x>.go.

Entry points for modification

  • New target type. Add a file in internal/event/target/, implement the interface, register a config block in internal/config/notify/notify_<x>.go.
  • New event filter. Extend internal/event/rules.go and the XML parser in internal/event/config.go.
  • Switch store backend. internal/store is filesystem-only today. A new backend would slot in behind Store.

See Notifications for the runtime view.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

event and store – MinIO wiki | Factory