Documentation ¶
Overview ¶
Package types is a generated GoMock package.
Index ¶
- type MockRegistry
- func (m *MockRegistry) DeleteNode(ctx context.Context, groupName string, node Node) error
- func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
- func (m *MockRegistry) GetClient() *clientv3.Client
- func (m *MockRegistry) GetEtcdBasePath() string
- func (m *MockRegistry) GetNodes(ctx context.Context, groupPath string) ([]Node, error)
- func (m *MockRegistry) NodePath(groupName string, node Node) string
- func (m *MockRegistry) RegisterNodeWithRetry(ctx context.Context, groupName string, node Node, ttl time.Duration, ...)
- func (m *MockRegistry) ServicePath(groupName string) string
- func (m *MockRegistry) WatchGroup(ctx context.Context, groupName string) (<-chan WatchEvent, error)
- func (m *MockRegistry) WatchGroupNodes(ctx context.Context, groupName string) (<-chan WatchEvent, error)
- func (m *MockRegistry) WatchServices(ctx context.Context) (<-chan WatchEvent, error)
- type MockRegistryMockRecorder
- func (mr *MockRegistryMockRecorder) DeleteNode(ctx, groupName, node any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetClient() *gomock.Call
- func (mr *MockRegistryMockRecorder) GetEtcdBasePath() *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNodes(ctx, groupPath any) *gomock.Call
- func (mr *MockRegistryMockRecorder) NodePath(groupName, node any) *gomock.Call
- func (mr *MockRegistryMockRecorder) RegisterNodeWithRetry(ctx, groupName, node, ttl, done, errChan any) *gomock.Call
- func (mr *MockRegistryMockRecorder) ServicePath(groupName any) *gomock.Call
- func (mr *MockRegistryMockRecorder) WatchGroup(ctx, groupName any) *gomock.Call
- func (mr *MockRegistryMockRecorder) WatchGroupNodes(ctx, groupName any) *gomock.Call
- func (mr *MockRegistryMockRecorder) WatchServices(ctx any) *gomock.Call
- type Node
- type Registry
- type ServiceGroup
- func (g *ServiceGroup) Configure(spec ServiceGroupSpec) error
- func (g *ServiceGroup) Delete(ctx context.Context) error
- func (g *ServiceGroup) GetNodes(ctx context.Context) ([]Node, error)
- func (g *ServiceGroup) RegisterNode(ctx context.Context, node Node, ttl time.Duration) (<-chan struct{}, <-chan error, error)
- type ServiceGroupData
- type ServiceGroupSpec
- type WatchEvent
- type WatchEventType
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 ¶
DeleteNode mocks base method.
func (*MockRegistry) EXPECT ¶
func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
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) 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" )