Documentation
¶
Overview ¶
Package pubsub emulates Cloud Pub/Sub (SRS 5.5): topics, subscriptions, publish, pull, streaming pull and push delivery, ordering, dead-letter topics, filters, exactly-once delivery, snapshots, seek and schemas.
The gRPC services google.pubsub.v1.{Publisher,Subscriber,SchemaService} are served on the gateway and on the dedicated Pub/Sub port (default 8085, for PUBSUB_EMULATOR_HOST); the REST v1 surface is mounted on the gateway under /pubsub/ and served on the dedicated port too.
Index ¶
- func New(env *emu.Env) emu.Service
- type Service
- func (s *Service) ApplySeed(ctx context.Context, section *yaml.Node, baseDir string) error
- func (s *Service) ClockAdvanced(ctx context.Context) error
- func (s *Service) DeleteSubscriptionInternal(ctx context.Context, name string) error
- func (s *Service) EnsurePushSubscription(ctx context.Context, name, topic, endpoint string) error
- func (s *Service) EnvVars(gw string, endpoints map[string]string) map[string]string
- func (s *Service) ExportSeed(ctx context.Context) (any, error)
- func (s *Service) Name() string
- func (s *Service) PublishInternal(ctx context.Context, topicName string, data []byte, attrs map[string]string) (string, error)
- func (s *Service) Ready() error
- func (s *Service) Register(r emu.Router) error
- func (s *Service) Reset(ctx context.Context) error
- func (s *Service) ResourceCounts() map[string]int
- func (s *Service) Restore(ctx context.Context, dir string) error
- func (s *Service) ServePushHost(host string, h http.Handler)
- func (s *Service) Snapshot(ctx context.Context, dir string) error
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(ctx context.Context) error
- func (s *Service) TopicExists(ctx context.Context, topicName string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the Pub/Sub service module.
func (*Service) ClockAdvanced ¶
ClockAdvanced re-applies message retention and snapshot expiry after `gcpemu time advance`.
func (*Service) DeleteSubscriptionInternal ¶ added in v0.10.0
DeleteSubscriptionInternal implements emu.Subscriber.
func (*Service) EnsurePushSubscription ¶ added in v0.10.0
EnsurePushSubscription implements emu.Subscriber.
func (*Service) ExportSeed ¶ added in v0.6.0
ExportSeed implements emu.SeedExporter: the latest revision of each schema (with an inline definition), topics and subscriptions, but for those another Service owns and makes again from its own section. Messages, snapshots, older schema revisions and pinned revision IDs are not exported.
func (*Service) PublishInternal ¶
func (s *Service) PublishInternal(ctx context.Context, topicName string, data []byte, attrs map[string]string) (string, error)
PublishInternal implements emu.Publisher for other services (FR-GCS-007).
func (*Service) Register ¶
Register loads persisted state and mounts the gRPC and REST APIs on the gateway (FR-CORE-040), and the subscription statistics on the admin API and as Cloud Monitoring metrics (monitoring.go).
func (*Service) Reset ¶
Reset drops all in-memory state (FR-CORE-002) and waits, bounded by ctx, for background work that changed the state before it to commit, so none of it writes to the store afterwards (#307); the store is wiped by the caller.
func (*Service) ResourceCounts ¶ added in v0.2.0
ResourceCounts implements emu.ResourceCounter.
func (*Service) Restore ¶ added in v0.6.0
Restore implements emu.Snapshotter: it rebuilds the in-memory state from the loaded store and restarts push delivery, as a restart does.
func (*Service) ServePushHost ¶ added in v0.10.0
ServePushHost implements emu.Subscriber.
func (*Service) Snapshot ¶ added in v0.6.0
Snapshot implements emu.Snapshotter: all of Pub/Sub's state is in the store.
func (*Service) Start ¶
Start opens the dedicated Pub/Sub port (FR-CORE-041), which serves gRPC (for PUBSUB_EMULATOR_HOST) and REST, and starts background delivery.