types

package
v0.0.0-...-ecba6cc Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package types is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRegistry

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

MockRegistry is a mock of Registry interface.

func NewMockRegistry

func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry

NewMockRegistry creates a new mock instance.

func (*MockRegistry) DeleteNode

func (m *MockRegistry) DeleteNode(ctx context.Context, groupName string, node Node) error

DeleteNode mocks base method.

func (*MockRegistry) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRegistry) GetClient

func (m *MockRegistry) GetClient() *clientv3.Client

GetClient mocks base method.

func (*MockRegistry) GetEtcdBasePath

func (m *MockRegistry) GetEtcdBasePath() string

GetEtcdBasePath mocks base method.

func (*MockRegistry) GetNodes

func (m *MockRegistry) GetNodes(ctx context.Context, groupPath string) ([]Node, error)

GetNodes mocks base method.

func (*MockRegistry) NodePath

func (m *MockRegistry) NodePath(groupName string, node Node) string

NodePath mocks base method.

func (*MockRegistry) RegisterNodeWithRetry

func (m *MockRegistry) RegisterNodeWithRetry(ctx context.Context, groupName string, node Node, ttl time.Duration, done chan<- struct{}, errChan chan error)

RegisterNodeWithRetry mocks base method.

func (*MockRegistry) ServicePath

func (m *MockRegistry) ServicePath(groupName string) string

ServicePath mocks base method.

func (*MockRegistry) WatchGroup

func (m *MockRegistry) WatchGroup(ctx context.Context, groupName string) (<-chan WatchEvent, error)

WatchGroup mocks base method.

func (*MockRegistry) WatchGroupNodes

func (m *MockRegistry) WatchGroupNodes(ctx context.Context, groupName string) (<-chan WatchEvent, error)

WatchGroupNodes mocks base method.

func (*MockRegistry) WatchServices

func (m *MockRegistry) WatchServices(ctx context.Context) (<-chan WatchEvent, error)

WatchServices mocks base method.

type MockRegistryMockRecorder

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

MockRegistryMockRecorder is the mock recorder for MockRegistry.

func (*MockRegistryMockRecorder) DeleteNode

func (mr *MockRegistryMockRecorder) DeleteNode(ctx, groupName, node any) *gomock.Call

DeleteNode indicates an expected call of DeleteNode.

func (*MockRegistryMockRecorder) GetClient

func (mr *MockRegistryMockRecorder) GetClient() *gomock.Call

GetClient indicates an expected call of GetClient.

func (*MockRegistryMockRecorder) GetEtcdBasePath

func (mr *MockRegistryMockRecorder) GetEtcdBasePath() *gomock.Call

GetEtcdBasePath indicates an expected call of GetEtcdBasePath.

func (*MockRegistryMockRecorder) GetNodes

func (mr *MockRegistryMockRecorder) GetNodes(ctx, groupPath any) *gomock.Call

GetNodes indicates an expected call of GetNodes.

func (*MockRegistryMockRecorder) NodePath

func (mr *MockRegistryMockRecorder) NodePath(groupName, node any) *gomock.Call

NodePath indicates an expected call of NodePath.

func (*MockRegistryMockRecorder) RegisterNodeWithRetry

func (mr *MockRegistryMockRecorder) RegisterNodeWithRetry(ctx, groupName, node, ttl, done, errChan any) *gomock.Call

RegisterNodeWithRetry indicates an expected call of RegisterNodeWithRetry.

func (*MockRegistryMockRecorder) ServicePath

func (mr *MockRegistryMockRecorder) ServicePath(groupName any) *gomock.Call

ServicePath indicates an expected call of ServicePath.

func (*MockRegistryMockRecorder) WatchGroup

func (mr *MockRegistryMockRecorder) WatchGroup(ctx, groupName any) *gomock.Call

WatchGroup indicates an expected call of WatchGroup.

func (*MockRegistryMockRecorder) WatchGroupNodes

func (mr *MockRegistryMockRecorder) WatchGroupNodes(ctx, groupName any) *gomock.Call

WatchGroupNodes indicates an expected call of WatchGroupNodes.

func (*MockRegistryMockRecorder) WatchServices

func (mr *MockRegistryMockRecorder) WatchServices(ctx any) *gomock.Call

WatchServices indicates an expected call of WatchServices.

type Node

type Node struct {
	ID           string            `json:"id"`
	ExporterType string            `json:"exporter_type"`
	Port         int               `json:"port"`
	MetricsPath  string            `json:"metrics_path"`
	Labels       map[string]string `json:"labels"`
	Status       string            `json:"status"`
	LastSeen     time.Time         `json:"last_seen"`
}

Node represents a single exporter instance

type Registry

type Registry interface {
	ServicePath(groupName string) string
	NodePath(groupName string, node Node) string
	RegisterNodeWithRetry(ctx context.Context, groupName string, node Node, ttl time.Duration, done chan<- struct{}, errChan chan error)
	DeleteNode(ctx context.Context, groupName string, node Node) error
	GetNodes(ctx context.Context, groupPath string) ([]Node, error)
	GetClient() *clientv3.Client
	GetEtcdBasePath() string
	WatchServices(ctx context.Context) (<-chan WatchEvent, error)
	WatchGroup(ctx context.Context, groupName string) (<-chan WatchEvent, error)
	WatchGroupNodes(ctx context.Context, groupName string) (<-chan WatchEvent, error)
}

Registry interface defines the methods needed by ServiceGroup

type ServiceGroup

type ServiceGroup struct {
	Registry Registry
	Name     string
	Spec     ServiceGroupSpec
}

ServiceGroup represents an active service group and its operations

func (*ServiceGroup) Configure

func (g *ServiceGroup) Configure(spec ServiceGroupSpec) error

Configure updates the group's configuration both locally and in etcd

func (*ServiceGroup) Delete

func (g *ServiceGroup) Delete(ctx context.Context) error

Delete removes the service group and all its nodes

func (*ServiceGroup) GetNodes

func (g *ServiceGroup) GetNodes(ctx context.Context) ([]Node, error)

GetNodes returns all nodes in this group

func (*ServiceGroup) RegisterNode

func (g *ServiceGroup) RegisterNode(ctx context.Context, node Node, ttl time.Duration) (<-chan struct{}, <-chan error, error)

RegisterNode registers a new node in this group

type ServiceGroupData

type ServiceGroupData struct {
	Name    string           `json:"name"`    // Unique group identifier
	Spec    ServiceGroupSpec `json:"spec"`    // Group configuration
	Created time.Time        `json:"created"` // When group was created
}

ServiceGroupData represents the stored group data

type ServiceGroupSpec

type ServiceGroupSpec struct {
	Username     string            `json:"username"`                // Auth username
	Password     string            `json:"password"`                // Auth password
	CommonLabels map[string]string `json:"common_labels,omitempty"` // Labels applied to all nodes
}

ServiceGroupSpec defines the configuration for a service group

type WatchEvent

type WatchEvent struct {
	Type      WatchEventType `json:"type"`
	GroupName string         `json:"group_name"`
	Node      *Node          `json:"node,omitempty"`
}

WatchEvent represents a change event from etcd

type WatchEventType

type WatchEventType string

WatchEventType represents the type of watch event

const (
	EventTypeCreate WatchEventType = "create"
	EventTypeUpdate WatchEventType = "update"
	EventTypeDelete WatchEventType = "delete"
)

Jump to

Keyboard shortcuts

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