server

package
v0.57.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndexReplacePlaceholder = `<!--INJECT GENERATED CODE HERE FROM BACKEND-->`

Functions

func CreateKHIServer

func CreateKHIServer(engine *gin.Engine, inspectionServer *coreinspection.InspectionTaskServer, serverConfig *ServerConfig) *gin.Engine

Types

type GetInspectionFeatureResponse

type GetInspectionFeatureResponse struct {
	Features []coreinspection.FeatureListItem `json:"features"`
}

type GetInspectionTypesResponse

type GetInspectionTypesResponse struct {
	Types []*coreinspection.InspectionType `json:"types"`
}

GetInspectionTypesResponse is the type of the response for /api/v3/inspection/types

type GetInspectionsResponse

type GetInspectionsResponse struct {
	Inspections map[string]SerializedMetadata `json:"inspections"`
	ServerStat  *ServerStat                   `json:"serverStat"`
}

GetInspectionsResponse is the type of the response for /api/v3/inspection

type PatchInspectionFeatureRequest

type PatchInspectionFeatureRequest struct {
	Features map[string]bool `json:"features"`
}

type PatchInspectionRequest added in v0.51.0

type PatchInspectionRequest struct {
	Name string `json:"name"`
}

type PostInspectionDryRunRequest

type PostInspectionDryRunRequest = map[string]any

type PostInspectionResponse

type PostInspectionResponse struct {
	InspectionID string `json:"inspectionID"`
}

type PutInspectionFeatureRequest

type PutInspectionFeatureRequest struct {
	Features []string `json:"features"`
}

type PutInspectionFeatureResponse

type PutInspectionFeatureResponse struct {
}

type ResourceMonitor

type ResourceMonitor interface {
	// GetUsedMemory returns the current memory usage of the server process in bytes.
	GetUsedMemory() uint64

	// GetTotalMemory returns the total physical memory of the server in bytes.
	GetTotalMemory() uint64
}

ResourceMonitor provides methods to monitor server resources.

type ResourceMonitorImpl

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

ResourceMonitorImpl is the real implementation of ResourceMonitor.

func (*ResourceMonitorImpl) GetTotalMemory added in v0.53.0

func (r *ResourceMonitorImpl) GetTotalMemory() uint64

GetTotalMemory returns the total physical memory using gopsutil. The result is cached after the first call.

func (*ResourceMonitorImpl) GetUsedMemory

func (r *ResourceMonitorImpl) GetUsedMemory() uint64

GetUsedMemory returns the current memory usage using runtime.MemStats (Alloc).

type ResourceMonitorMock

type ResourceMonitorMock struct {
	UsedMemory  uint64
	TotalMemory uint64
}

ResourceMonitorMock is a mock implementation of ResourceMonitor for testing.

func (*ResourceMonitorMock) GetTotalMemory added in v0.53.0

func (r *ResourceMonitorMock) GetTotalMemory() uint64

GetTotalMemory returns the mocked total memory.

func (*ResourceMonitorMock) GetUsedMemory

func (r *ResourceMonitorMock) GetUsedMemory() uint64

GetUsedMemory returns the mocked used memory.

type SerializedMetadata

type SerializedMetadata = map[string]any

type ServerConfig

type ServerConfig struct {
	ViewerMode       bool
	StaticFolderPath string
	ResourceMonitor  ResourceMonitor
	ServerBasePath   string
	UploadFileStore  *upload.UploadFileStore
}

type ServerFactory

type ServerFactory struct {
	Options []option.Option
	// contains filtered or unexported fields
}

ServerFactory is responsible for creating and configuring Gin engine instances.

var DefaultServerFactory *ServerFactory = &ServerFactory{}

DefaultServerFactory is the default instance of ServerFactory. This instance Options will be modified to extend the behavior of the gin server.

func (*ServerFactory) AddOptions

func (s *ServerFactory) AddOptions(opt ...option.Option)

AddOptions adds one or more Option instances to the factory's configuration.

func (*ServerFactory) CreateInstance

func (s *ServerFactory) CreateInstance(mode string) (*gin.Engine, error)

CreateInstance creates a new Gin engine and applies all registered options to it. It returns the configured Gin engine or an error if any option fails to apply.

type ServerStat

type ServerStat struct {
	CurrentMemoryUsage uint64 `json:"currentMemoryUsage"`
	TotalMemory        uint64 `json:"totalMemory"`
}

ServerStat represents the memory statistics of the server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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