external

package
v1.9.4-alpha2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

The commmon package provides structs and functions for external code to interact with this gateway service.

Index

Constants

View Source
const (
	AppManageURLFilename = "app-management.url"
	APIComposeInfo       = "/v2/app_management/compose"
	APIComposeStatus     = "/v2/app_management/compose"
)
View Source
const (
	ManagementURLFilename = "management.url"
	StaticURLFilename     = "static.url"
	APIGatewayRoutes      = "/v1/gateway/routes"
	APIGatewayPort        = "/v1/gateway/port"
)
View Source
const (
	MessageBusAddressFilename = "message-bus.url"
	APIMessageBus             = "/v2/message_bus"
)
View Source
const (
	NimoOSURLFilename = "nimoos.url"
	APINimoOSNotify   = "/v1/notify"
)
View Source
const (
	APINimoOSShare = "/v1/samba/shares"
)
View Source
const KVMServiceAddressFilename = "kvm-service.url"
View Source
const (
	UserServiceAddressFilename = "user-service.url"
)

Variables

This section is empty.

Functions

func GetKVMServiceAddress

func GetKVMServiceAddress(runtimePath string) (string, error)

func GetMessageBusAddress

func GetMessageBusAddress(runtimePath string) (string, error)

func GetPublicKey

func GetPublicKey(runtimePath string) (*ecdsa.PublicKey, error)

func PrintEventTypesAsMarkdown

func PrintEventTypesAsMarkdown(sourceID, version string, eventTypes []EventType)

func PublishEventInSocket

func PublishEventInSocket(ctx context.Context, SourceID string, Name string, properties map[string]string) (*http.Response, error)

func StartIntelGpuMonitor

func StartIntelGpuMonitor()

StartIntelGpuMonitor spawns intel_gpu_top in the background and keeps the most recent sample in memory. Safe to call multiple times; only the first call has any effect. If intel_gpu_top is not installed the call is a no-op.

Types

type AppManageService

type AppManageService interface {
	GetAppInfo(storeId string) (model.ComposeAppWithStoreInfo, error)
	PutAppStatus(storeId string, status string) (bool, error)
}

func NewAppManageService

func NewAppManageService(RuntimePath string) (AppManageService, error)

type EventType

type EventType struct {
	Name             string
	SourceID         string
	PropertyTypeList []PropertyType
}

type IntelGpuSample

type IntelGpuSample struct {
	Frequency struct {
		Actual float64 `json:"actual"`
	} `json:"frequency"`
	Power struct {
		GPU float64 `json:"GPU"`
	} `json:"power"`
	Engines map[string]struct {
		Busy float64 `json:"busy"`
	} `json:"engines"`
}

IntelGpuSample mirrors the per-tick JSON object that `intel_gpu_top -J` emits. Only the fields we surface are decoded; extra keys are ignored.

type IntelGpuStat

type IntelGpuStat struct {
	UtilizationGpu float64   `json:"utilization_gpu"`
	PowerW         float64   `json:"power_w"`
	FreqMHz        float64   `json:"freq_mhz"`
	Updated        time.Time `json:"-"`
}

IntelGpuStat is the rolling snapshot consumed by NimoOS service callers.

func GetIntelGpuStat

func GetIntelGpuStat() (IntelGpuStat, bool)

GetIntelGpuStat returns the latest snapshot. The boolean is false if the monitor never started (intel_gpu_top missing) or the cache is stale (>5s old).

type ManagementService

type ManagementService interface {
	CreateRoute(route *model.Route) error
	ChangePort(request *model.ChangePortRequest) error
	GetPort() (error, string)
}

func NewManagementService

func NewManagementService(RuntimePath string) (ManagementService, error)

type NotifyService

type NotifyService interface {
	SendNotify(path string, message interface{}) error
	SendSystemStatusNotify(message map[string]interface{}) error
}

func NewNotifyService

func NewNotifyService(runtimePath string) NotifyService

type NvidiaGPUInfo

type NvidiaGPUInfo struct {
	Index         int
	UUID          string
	DriverVersion string
	Name          string
	GPUSerial     string
}

func NvidiaGPUInfoList

func NvidiaGPUInfoList() ([]NvidiaGPUInfo, error)

func NvidiaGPUInfoListWithSMI

func NvidiaGPUInfoListWithSMI() ([]NvidiaGPUInfo, error)

type PropertyType

type PropertyType struct {
	Name        string
	Description *string
	Example     *string
}

type ShareService

type ShareService interface {
	DeleteShare(id string) error
}

func NewShareService

func NewShareService(runtimePath string) ShareService

Jump to

Keyboard shortcuts

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