eventhubcache

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewHubManagerFromConnectionStringWrapper = func(connectionString string) (HubManagerInterface, error) {
	return eventhub.NewHubManagerFromConnectionString(connectionString)
}

Azure EventHub HubManager Function Reference Variable To Facilitate Mocking In Unit Tests

Functions

This section is empty.

Types

type Cache

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

Azure EventHubs Cache Struct

func (*Cache) AddEventHub

func (c *Cache) AddEventHub(ctx context.Context, eventhub string, namespace *Namespace)

Add The Specified EventHub / Namespace To The Cache

func (*Cache) GetLeastPopulatedNamespace

func (c *Cache) GetLeastPopulatedNamespace() *Namespace

Get The Namespace With The Least Number Of EventHubs

func (*Cache) GetNamespace

func (c *Cache) GetNamespace(eventhub string) *Namespace

Get The Namespace Associated With The Specified EventHub (Topic) Name

func (*Cache) RemoveEventHub

func (c *Cache) RemoveEventHub(ctx context.Context, eventhub string)

Remove The Specified EventHub / Namespace From The Cache

func (*Cache) Update

func (c *Cache) Update(ctx context.Context) error

Update The Cache From K8S & Azure

type CacheInterface

type CacheInterface interface {
	Update(ctx context.Context) error
	AddEventHub(ctx context.Context, eventhub string, namespace *Namespace)
	RemoveEventHub(ctx context.Context, eventhub string)
	GetNamespace(eventhub string) *Namespace
	GetLeastPopulatedNamespace() *Namespace
}

Define An Interface For The EventHub Cache

func NewCache

func NewCache(ctx context.Context, k8sNamespace string) CacheInterface

Azure EventHubs Cache Constructor

type HubManagerInterface

type HubManagerInterface interface {
	Delete(ctx context.Context, name string) error
	List(ctx context.Context) ([]*eventhub.HubEntity, error)
	Put(ctx context.Context, name string, opts ...eventhub.HubManagementOption) (*eventhub.HubEntity, error)
}

Azure EventHub Client Doesn't Code To Interfaces Or Provide Mocks So We're Wrapping Our Usage Of The HubManager For Testing

type Namespace

type Namespace struct {
	Name       string
	Username   string
	Password   string
	Secret     string
	HubManager HubManagerInterface
	Count      int
}

Azure EventHubs Namespace Struct

func NewNamespace

func NewNamespace(logger *zap.Logger, name string, username string, password string, secret string, count int) (*Namespace, error)

Namespace Complete Argument Constructor

func NewNamespaceFromKafkaSecret

func NewNamespaceFromKafkaSecret(logger *zap.Logger, kafkaSecret *corev1.Secret) (*Namespace, error)

Namespace Secret Constructor

Jump to

Keyboard shortcuts

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