Documentation
¶
Overview ¶
The commmon package provides structs and functions for external code to interact with this gateway service.
Index ¶
- Constants
- func GetKVMServiceAddress(runtimePath string) (string, error)
- func GetMessageBusAddress(runtimePath string) (string, error)
- func GetPublicKey(runtimePath string) (*ecdsa.PublicKey, error)
- func PrintEventTypesAsMarkdown(sourceID, version string, eventTypes []EventType)
- func PublishEventInSocket(ctx context.Context, SourceID string, Name string, ...) (*http.Response, error)
- func StartIntelGpuMonitor()
- type AppManageService
- type EventType
- type IntelGpuSample
- type IntelGpuStat
- type ManagementService
- type NotifyService
- type NvidiaGPUInfo
- type PropertyType
- type ShareService
Constants ¶
const ( AppManageURLFilename = "app-management.url" APIComposeInfo = "/v2/app_management/compose" APIComposeStatus = "/v2/app_management/compose" )
const ( ManagementURLFilename = "management.url" StaticURLFilename = "static.url" APIGatewayRoutes = "/v1/gateway/routes" APIGatewayPort = "/v1/gateway/port" )
const ( MessageBusAddressFilename = "message-bus.url" APIMessageBus = "/v2/message_bus" )
const ( NimoOSURLFilename = "nimoos.url" APINimoOSNotify = "/v1/notify" )
const (
)
const KVMServiceAddressFilename = "kvm-service.url"
const (
UserServiceAddressFilename = "user-service.url"
)
Variables ¶
This section is empty.
Functions ¶
func GetKVMServiceAddress ¶
func GetMessageBusAddress ¶
func PublishEventInSocket ¶
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 ShareService ¶
type ShareService interface {
}
func NewShareService ¶
func NewShareService(runtimePath string) ShareService