clusterlink

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Mirror topic status constants
	MirrorStatusActive = "ACTIVE"
)

Variables

This section is empty.

Functions

func ClassifyMirrorTopics

func ClassifyMirrorTopics(mirrors []MirrorTopic) (topicNames []string, inactiveTopics []string)

func CountActiveMirrorTopics

func CountActiveMirrorTopics(mirrors []MirrorTopic) int

CountActiveMirrorTopics returns the count of active mirror topics

func GetActiveTopicsWithZeroLag

func GetActiveTopicsWithZeroLag(mirrors []MirrorTopic) []string

GetActiveTopicsWithZeroLag returns topic names that are active and have zero lag across all partitions

func HasActiveTopicsWithNonZeroLag

func HasActiveTopicsWithNonZeroLag(mirrors []MirrorTopic) bool

HasActiveTopicsWithNonZeroLag checks if there are any active topics with non-zero lag

Types

type Config

type Config struct {
	RestEndpoint string
	ClusterID    string
	LinkName     string
	APIKey       string
	APISecret    string
	Topics       []string
}

Config holds cluster link configuration

type ConfluentCloudService

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

ConfluentCloudService implements cluster link operations using Confluent Cloud REST API

func NewConfluentCloudService

func NewConfluentCloudService(httpClient HTTPClient) *ConfluentCloudService

NewConfluentCloudService creates a new cluster link service

func (*ConfluentCloudService) ListConfigs

func (s *ConfluentCloudService) ListConfigs(ctx context.Context, config Config) (map[string]string, error)

ListConfigs retrieves cluster link configurations

func (*ConfluentCloudService) ListMirrorTopics

func (s *ConfluentCloudService) ListMirrorTopics(ctx context.Context, config Config) ([]MirrorTopic, error)

func (*ConfluentCloudService) PromoteMirrorTopics

func (s *ConfluentCloudService) PromoteMirrorTopics(ctx context.Context, config Config, topicNames []string) (*PromoteMirrorTopicsResponse, error)

PromoteMirrorTopics promotes the specified mirror topics

func (*ConfluentCloudService) ValidateTopics

func (s *ConfluentCloudService) ValidateTopics(topics []string, clusterLinkTopics []string) error

ValidateTopics validates that all specified topics exist in cluster link

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface for HTTP operations

type MirrorLag

type MirrorLag struct {
	Partition             int `json:"partition"`
	Lag                   int `json:"lag"`
	LastSourceFetchOffset int `json:"last_source_fetch_offset"`
}

type MirrorTopic

type MirrorTopic struct {
	MirrorTopicName string      `json:"mirror_topic_name"`
	MirrorStatus    string      `json:"mirror_status"`
	MirrorLags      []MirrorLag `json:"mirror_lags"`
}

type PromoteMirrorTopicsResponse

type PromoteMirrorTopicsResponse struct {
	Data []struct {
		MirrorTopicName string `json:"mirror_topic_name"`
		ErrorMessage    string `json:"error_message,omitempty"`
		ErrorCode       int    `json:"error_code,omitempty"`
	} `json:"data"`
}

PromoteMirrorTopicsResponse represents the response from promoting mirror topics

type Service

type Service interface {
	ListMirrorTopics(ctx context.Context, config Config) ([]MirrorTopic, error)
	ListConfigs(ctx context.Context, config Config) (map[string]string, error)
	ValidateTopics(topics []string, clusterLinkTopics []string) error
	PromoteMirrorTopics(ctx context.Context, config Config, topicNames []string) (*PromoteMirrorTopicsResponse, error)
}

Service defines cluster link operations

Jump to

Keyboard shortcuts

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