Help us shape the future of Go! Take the 2026 Go Developer Survey

source

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package source provides StateSource implementations for the Mokka Node Agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlPlaneSource

type ControlPlaneSource struct{}

ControlPlaneSource will poll MEP-0001's Control Plane REST API for State updates. The REST contract is not yet defined; Watch blocks until ctx is cancelled. Replace the Watch body when MEP-0001 defines the endpoint.

func NewControlPlaneSource

func NewControlPlaneSource() *ControlPlaneSource

NewControlPlaneSource returns a ControlPlaneSource skeleton.

func (*ControlPlaneSource) Close

func (c *ControlPlaneSource) Close() error

Close is a no-op; the real implementation will close the REST connection.

func (*ControlPlaneSource) Watch

func (c *ControlPlaneSource) Watch(ctx context.Context) <-chan agent.Update

Watch returns a channel that blocks until ctx is cancelled.

type FileSource

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

FileSource watches the profile and the cluster topology document and emits a State update when either changes. It watches the directories holding them: both a ConfigMap swap and an editor's save replace the file's inode, so a watch on the file would hold the one that was just replaced.

func NewFileSource

func NewFileSource(configPath, topologyPath string, resyncInterval time.Duration, log *zap.Logger) *FileSource

NewFileSource returns a FileSource that watches configPath and topologyPath. resyncInterval re-reads both documents regardless of events, covering a host where inotify reports nothing — a profile on NFS, or a watch limit reached. Zero leaves reloads entirely to events.

func (*FileSource) Close

func (f *FileSource) Close() error

Close is a no-op for FileSource; run owns the watcher, and ctx bounds run.

func (*FileSource) Watch

func (f *FileSource) Watch(ctx context.Context) <-chan agent.Update

Watch sends the current State immediately and then pushes updates whenever either watched document changes. The channel is closed when ctx is done.

Jump to

Keyboard shortcuts

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