pubsub

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package pubsub provides an interface and implementations for publishing notifications for Rekor updates to a Pub/Sub system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProvider

func AddProvider(uri string, init ProviderInit)

AddProvider adds the provider implementation into the local cache

func SupportedProviders

func SupportedProviders() []string

SupportedProviders returns list of initialized providers

Types

type ProviderInit

type ProviderInit func(ctx context.Context, topicResourceID string) (Publisher, error)

ProviderInit is a function that initializes provider-specific Publisher.

type ProviderNotFoundError

type ProviderNotFoundError struct {
	// contains filtered or unexported fields
}

ProviderNotFoundError indicates that no matching PubSub provider was found.

func (*ProviderNotFoundError) Error

func (e *ProviderNotFoundError) Error() string

type Publisher

type Publisher interface {
	// Publish publishes a CloudEvent to the configured Pub/Sub topic serialized
	// using the specified encoding type.
	Publish(ctx context.Context, event *events.Event, encoding events.EventContentType) error
	// Close safely closes any active connections.
	Close() error
}

Publisher provides methods for publishing events to a Pub/Sub topic.

func Get

func Get(ctx context.Context, topicResourceID string) (Publisher, error)

Get returns a Publisher for the given resource string and hash function. If no matching provider is found, Get returns a ProviderNotFoundError. It also returns an error if initializing the Publisher fails. If no resource is supplied, it returns a nil Publisher and no error.

Directories

Path Synopsis
Package gcp implements the pubsub.Publisher with Google Cloud Pub/Sub.
Package gcp implements the pubsub.Publisher with Google Cloud Pub/Sub.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL