macresources

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package macresources publishes bounded Mac CPU, memory, and network observations.

Index

Constants

View Source
const (
	PluginID        = "dev.bsbctl.mac-resources"
	PluginVersion   = "0.1.0"
	AppID           = "mac-resources"
	ChannelSummary  = "summary"
	ChannelPressure = "pressure"
	ChannelLive     = "live"
)

Variables

View Source
var ErrUnsupported = errors.New("mac resources collection requires macOS with cgo enabled")

Functions

func DefinitionForVersion

func DefinitionForVersion(version string) pluginsdk.Definition

DefinitionForVersion binds immutable release metadata into the child handshake.

Types

type Collector

type Collector interface {
	Sample(context.Context) (RawSample, error)
}

func NewNativeCollector

func NewNativeCollector() Collector

type Config

type Config struct {
	SampleInterval                time.Duration
	SummaryInterval               time.Duration
	WarningPercent                float64
	CriticalPercent               float64
	SustainSamples                int
	RecoveryMarginPercent         float64
	NetworkCapacityBytesPerSecond float64
}

type Handler

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

func New

func New(host Host) *Handler

func (*Handler) EndSession

func (h *Handler) EndSession(ctx context.Context, request protocol.SessionEndRequest) error

func (*Handler) HandleSessionInput

func (h *Handler) HandleSessionInput(ctx context.Context, request protocol.SessionInputRequest) (protocol.SessionInputResult, error)

func (*Handler) Health

func (*Handler) ReplaceInstances

func (h *Handler) ReplaceInstances(ctx context.Context, configured []protocol.Instance) error

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context) error

func (*Handler) StartSession

func (h *Handler) StartSession(ctx context.Context, request protocol.SessionStartRequest) error

type Host

type RawSample

type RawSample struct {
	CPUTotal      uint64
	CPUIdle       uint64
	MemoryPercent float64
	RXBytes       uint64
	TXBytes       uint64
	NetworkSet    uint64
	CollectedAt   time.Time
}

type Ticker

type Ticker interface {
	C() <-chan time.Time
	Stop()
}

Jump to

Keyboard shortcuts

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