Documentation
¶
Overview ¶
Package events is the in-process bus services use to reach each other.
It exists so they need not: a bucket knows nothing about functions, and a function knows nothing about buckets. Both know this bus, which is the only way anything here crosses a service boundary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus delivers events to subscribers.
func (*Bus) Publish ¶
Publish delivers an event to every interested subscriber, asynchronously.
The publisher is never blocked: an object write must not wait on whatever a function does with the news. Use Sync to wait for delivery.
func (*Bus) Started ¶
Started counts deliveries ever launched. A drain compares it across a Sync to tell whether that pass triggered new work, and so whether to drain again.
type Event ¶
type Event struct {
// Type is the event name a trigger matches on, e.g.
// google.storage.object.finalize.
Type string
// Source identifies what produced it, e.g.
// //storage.googleapis.com/projects/_/buckets/my-bucket. A trigger matches
// its resource against the tail of this.
Source string
// Subject names the thing within the source, e.g. objects/logs/app.log.
Subject string
// Resource, Service and Kind describe the affected resource the way a
// first-generation function's context reports it.
Resource string
Service string
Kind string
Time time.Time
// Data is the payload, in the shape the service's API returns it.
Data map[string]any
}
Event is something that happened.