node

package
v0.1.9 Latest Latest
Warning

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

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

Documentation

Overview

Package node provides DTOs for node-related API operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Commands

func (h *Handler) Commands(c *gin.Context)

Commands alias for route compatibility

func (*Handler) Drain

func (h *Handler) Drain(c *gin.Context)

Drain handles the request to drain a node

func (*Handler) GetMeta

func (h *Handler) GetMeta(c *gin.Context)

GetMeta handles the request to get node metadata

func (*Handler) List

func (h *Handler) List(c *gin.Context)

List handles the request to list nodes

func (*Handler) ListCommands

func (h *Handler) ListCommands(c *gin.Context)

ListCommands handles the request to list node commands

func (*Handler) Restart

func (h *Handler) Restart(c *gin.Context)

Restart handles the request to restart a node

func (*Handler) Undrain

func (h *Handler) Undrain(c *gin.Context)

Undrain handles the request to undrain a node

func (*Handler) UpdateMeta

func (h *Handler) UpdateMeta(c *gin.Context)

UpdateMeta handles the request to update node metadata

type Node

type Node struct {
	ID        string      `json:"id"`
	Name      string      `json:"name"`
	Type      string      `json:"type"` // server, agent
	Status    string      `json:"status"`
	IP        string      `json:"ip"`
	Port      int         `json:"port"`
	Resources interface{} `json:"resources"`
	UpdatedAt string      `json:"updatedAt"`
}

Node represents a node in the system.

type NodeActionRequest

type NodeActionRequest struct {
	ID string `uri:"id"`
}

NodeActionRequest represents a request for node action.

type NodeCommand

type NodeCommand struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

NodeCommand represents a command that can be executed on a node.

type NodeCommandsRequest

type NodeCommandsRequest struct {
}

NodeCommandsRequest represents a request to list node commands.

type NodeCommandsResponse

type NodeCommandsResponse struct {
	Items []NodeCommand `json:"items"`
}

NodeCommandsResponse represents the response for listing node commands.

type NodeDrainRequest

type NodeDrainRequest struct {
	ID      string `uri:"id"`
	Timeout int    `json:"timeout"` // 秒
}

NodeDrainRequest represents a request to drain a node.

type NodeMetaRequest

type NodeMetaRequest struct {
	ID string `uri:"id"`
}

NodeMetaRequest represents a request to get node metadata.

type NodeMetaResponse

type NodeMetaResponse struct {
	Meta interface{} `json:"meta"`
}

NodeMetaResponse represents the response for getting node metadata.

type NodeMetaUpdateRequest

type NodeMetaUpdateRequest struct {
	ID   string      `uri:"id"`
	Meta interface{} `json:"meta"`
}

NodeMetaUpdateRequest represents a request to update node metadata.

type NodesListRequest

type NodesListRequest struct {
	Type   string `form:"type"`
	Status string `form:"status"`
}

NodesListRequest represents a request to list nodes.

type NodesListResponse

type NodesListResponse struct {
	Items []Node `json:"items"`
}

NodesListResponse represents the response for listing nodes.

type ObjectInfo

type ObjectInfo struct {
	Key          string `json:"key"`
	Size         int64  `json:"size"`
	LastModified string `json:"last_modified"`
	ETag         string `json:"etag"`
	StorageClass string `json:"storage_class"`
}

ObjectInfo represents information about a storage object.

type ObjectsData

type ObjectsData struct {
	Objects     []ObjectInfo `json:"objects"`
	Prefixes    []string     `json:"prefixes"`
	IsTruncated bool         `json:"is_truncated"`
	NextMarker  string       `json:"next_marker"`
}

ObjectsData represents a paginated list of storage objects.

type Service

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

func NewService

func NewService(svcCtx *svc.ServiceContext) *Service

func (*Service) Drain

func (s *Service) Drain(ctx context.Context, req *NodeDrainRequest) error

Drain drains a node

func (*Service) GetMeta

func (s *Service) GetMeta(ctx context.Context, req *NodeMetaRequest) (*NodeMetaResponse, error)

GetMeta returns the metadata of a node

func (*Service) List

List returns the list of nodes

func (*Service) ListCommands

func (s *Service) ListCommands(ctx context.Context, req *NodeCommandsRequest) (*NodeCommandsResponse, error)

ListCommands returns the list of available node commands

func (*Service) Restart

func (s *Service) Restart(ctx context.Context, req *NodeActionRequest) error

Restart restarts a node

func (*Service) Undrain

func (s *Service) Undrain(ctx context.Context, req *NodeActionRequest) error

Undrain undrains a node

func (*Service) UpdateMeta

func (s *Service) UpdateMeta(ctx context.Context, req *NodeMetaUpdateRequest) (*NodeMetaResponse, error)

UpdateMeta updates the metadata of a node

Jump to

Keyboard shortcuts

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