Documentation ¶
Overview ¶
Package pubsub exports messages for interacting with pubsub.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendGCS ¶
func SendGCS(ctx context.Context, log logrus.FieldLogger, client Subscriber, projectID, subID string, settings *pubsub.ReceiveSettings, receivers chan<- *Notification) error
SendGCS converts GCS pubsub messages into Notification structs and sends them to receivers.
Connects to the specified subscription with optionally specified settings. Receives pubsub messages from this subscription and converts it into a Notification struct.
- Nacks any message it cannot parse.
Sends the notification to the receivers channel.
- Nacks messages associated with any unsent Notifications.
- Acks as soon as the Notification is sent.
More info: https://cloud.google.com/storage/docs/pubsub-notifications#overview
Types ¶
type Client ¶
Client wraps a pubsub client into a Subscriber that creates Senders for pubsub subscriptions.
type Event ¶
type Event string
Event specifies what happened to the GCS object.
See https://cloud.google.com/storage/docs/pubsub-notifications#events
type Notification ¶
Notification captures information about a change to a GCS object.
func (Notification) String ¶
func (n Notification) String() string
type Sender ¶
Sender forwards pubsub messages to the receive function until the send context expires.
type Subscriber ¶
type Subscriber interface {
Subscribe(projID, subID string, setttings *pubsub.ReceiveSettings) Sender
}
Subscriber creates Senders that attach to subscriptions with the specified settings.