server

package
v0.56.0-beta-2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 27 Imported by: 1 module, 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

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