models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType string

EventType represents the type of notification event

const (
	EventTypeRegister   EventType = "register"
	EventTypeUnregister EventType = "unregister"
	EventTypeUpdate     EventType = "update"
	EventTypeReconcile  EventType = "reconcile"
)

type ManagerConfig

type ManagerConfig struct {
	// Manager HTTP server settings
	ServerPort int `json:"server_port"`

	// Health check settings
	HealthCheckInterval time.Duration `json:"health_check_interval"` // How often to check health
	HealthCheckTimeout  time.Duration `json:"health_check_timeout"`  // Timeout for health check HTTP call
	HealthCheckRetry    int           `json:"health_check_retry"`    // Number of retries before marking unhealthy

	// Notification settings
	NotificationInterval time.Duration `json:"notification_interval"` // Periodic reconcile interval
	NotificationTimeout  time.Duration `json:"notification_timeout"`  // Timeout for notification HTTP call

	// Event queue settings
	EventQueueSize int `json:"event_queue_size"` // Event queue buffer size
}

ManagerConfig contains configuration for the governance manager

func DefaultConfig

func DefaultConfig() *ManagerConfig

DefaultConfig returns a default configuration

type NotificationPayload

type NotificationPayload struct {
	ServiceName string    `json:"service_name"`
	EventType   EventType `json:"event_type"`
	Timestamp   time.Time `json:"timestamp"`
	Pods        []PodInfo `json:"pods"`
}

NotificationPayload is sent to subscribers when service changes occur

type PodInfo

type PodInfo struct {
	PodName   string         `json:"pod_name"`
	Status    ServiceStatus  `json:"status"`
	Providers []ProviderInfo `json:"providers"`
}

PodInfo represents information about a pod in the notification

type Protocol

type Protocol string

Protocol represents the communication protocol type

const (
	ProtocolHTTP Protocol = "http"
	ProtocolTCP  Protocol = "tcp"
	ProtocolPFCP Protocol = "pfcp"
	ProtocolGTP  Protocol = "gtp"
	ProtocolUDP  Protocol = "udp"
)

type ProviderInfo

type ProviderInfo struct {
	Protocol Protocol `json:"protocol"`
	IP       string   `json:"ip"`
	Port     int      `json:"port"`
}

ProviderInfo contains the endpoint information for a service provider

type ServiceInfo

type ServiceInfo struct {
	ServiceName     string
	PodName         string
	Providers       []ProviderInfo
	HealthCheckURL  string
	NotificationURL string
	Subscriptions   []string
	Status          ServiceStatus
	LastHealthCheck time.Time
	RegisteredAt    time.Time
}

ServiceInfo represents the internal service information stored in registry

func (*ServiceInfo) GetKey

func (s *ServiceInfo) GetKey() string

GetKey returns a unique key for the service (service_name:pod_name)

type ServiceRegistration

type ServiceRegistration struct {
	ServiceName     string         `json:"service_name"`
	PodName         string         `json:"pod_name"`
	Providers       []ProviderInfo `json:"providers"`
	HealthCheckURL  string         `json:"health_check_url"`
	NotificationURL string         `json:"notification_url"`
	Subscriptions   []string       `json:"subscriptions"` // List of service groups to subscribe
}

ServiceRegistration represents a service registration request

type ServiceStatus

type ServiceStatus string

ServiceStatus represents the health status of a service

const (
	StatusHealthy   ServiceStatus = "healthy"
	StatusUnhealthy ServiceStatus = "unhealthy"
	StatusUnknown   ServiceStatus = "unknown"
)

Jump to

Keyboard shortcuts

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