refmappers

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefInfo

type RefInfo struct {
	TopicName          string
	GroupId            string
	ConnectionPoolKey  string
	DataPlaneNamespace string
	DataPlaneLabels    map[string]string
}

RefInfo contains the data necessary for ResetOffset reconciliation which is specific to a particular use-case, as provided by a customized ResetOffsetRefMapper implementation. This allows implementations of Kafka Channels/Brokers/etc to differ from one another and still make use of the shared ResetOffset Controller.

type ResetOffsetRefMapper

type ResetOffsetRefMapper interface {
	MapRef(*kafkav1alpha1.ResetOffset) (*RefInfo, error)
}

ResetOffsetRefMapper defines the interface for the capability to map ResetOffset.Spec.Ref to Kafka Topic, Group and ConnectionPool Key. This abstraction allows for future extensibility to support additional KRef types, such as Triggers, instead of just Subscriptions.

type ResetOffsetRefMapperFactory

type ResetOffsetRefMapperFactory interface {
	Create(context.Context) ResetOffsetRefMapper
}

ResetOffsetRefMapperFactory defines the interface for creating ResetOffsetRefMapper instances based on the provided Context which comes from SharedMain and includes the injected Informers. It is necessary for delayed initialization against that Context.

type SubscriptionConnectionPoolKeyMapper

type SubscriptionConnectionPoolKeyMapper func(*messagingv1.Subscription) (string, error)

SubscriptionConnectionPoolKeyMapper defines a function signature for mapping a Subscription to a control-protocol ControlPlaneConnectionPool Key.

type SubscriptionConsumerGroupIdMapper

type SubscriptionConsumerGroupIdMapper func(*messagingv1.Subscription) (string, error)

SubscriptionConsumerGroupIdMapper defines a function signature for mapping a Subscription to a Kafka ConsumerGroup ID.

type SubscriptionDataPlaneLabelsMapper

type SubscriptionDataPlaneLabelsMapper func(subscription *messagingv1.Subscription) (map[string]string, error)

SubscriptionDataPlaneLabelsMapper defines a function signature for mapping a Subscription to the Kubernetes labels of the DataPlane Pods.

type SubscriptionDataPlaneNamespaceMapper

type SubscriptionDataPlaneNamespaceMapper func(subscription *messagingv1.Subscription) (string, error)

SubscriptionDataPlaneNamespaceMapper defines a function signature for mapping a Subscription to the Kubernetes namespace of the DataPlane components.

type SubscriptionRefMapper

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

SubscriptionRefMapper implements the ResetOffsetRefMapper for Knative Subscriptions

func NewSubscriptionRefMapper

func NewSubscriptionRefMapper(ctx context.Context,
	topicNameMapper SubscriptionTopicNameMapper,
	groupIdMapper SubscriptionConsumerGroupIdMapper,
	connectionPoolKeyMapper SubscriptionConnectionPoolKeyMapper,
	dataPlaneNamespaceMapper SubscriptionDataPlaneNamespaceMapper,
	dataPlaneLabelsMapper SubscriptionDataPlaneLabelsMapper) *SubscriptionRefMapper

NewSubscriptionRefMapper returns an initialized ResetOffsetSubscriptionRefMapper

func (*SubscriptionRefMapper) MapRef

func (m *SubscriptionRefMapper) MapRef(resetOffset *kafkav1alpha1.ResetOffset) (*RefInfo, error)

MapRef implements the ResetOffsetRefMapper interface for Subscription references. It will return an error in all cases other than successfully mapping the ResetOffset.Spec.Ref to a Kafka Topic / Group.

type SubscriptionRefMapperFactory

type SubscriptionRefMapperFactory struct {
	TopicNameMapper          SubscriptionTopicNameMapper
	GroupIdMapper            SubscriptionConsumerGroupIdMapper
	ConnectionPoolKeyMapper  SubscriptionConnectionPoolKeyMapper
	DataPlaneNamespaceMapper SubscriptionDataPlaneNamespaceMapper
	DataPlaneLabelsMapper    SubscriptionDataPlaneLabelsMapper
}

SubscriptionRefMapperFactory implements the ResetOffsetRefMapperFactory for Knative Subscriptions

func NewSubscriptionRefMapperFactory

func NewSubscriptionRefMapperFactory(topicNameMapper SubscriptionTopicNameMapper,
	groupIdMapper SubscriptionConsumerGroupIdMapper,
	connectionPoolKeyMapper SubscriptionConnectionPoolKeyMapper,
	dataPlaneNamespaceMapper SubscriptionDataPlaneNamespaceMapper,
	dataPlaneLabelsMapper SubscriptionDataPlaneLabelsMapper) *SubscriptionRefMapperFactory

NewSubscriptionRefMapperFactory returns an initialized SubscriptionRefMapperFactory

func (*SubscriptionRefMapperFactory) Create

Create implements the ResetOffsetRefMapperFactory interface for Subscription references. It will return a new SubscriptionRefMapper instance using the specific TopicName / GroupId mappers. It also relies on the Context having injected informers (SubscriptionInformer).

type SubscriptionTopicNameMapper

type SubscriptionTopicNameMapper func(*messagingv1.Subscription) (string, error)

SubscriptionTopicNameMapper defines a function signature for mapping a Subscription to a Kafka Topic name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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