controllerServer

package
v0.0.0-...-73a9268 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMasterGetSlaveStatusResponseData

type ActionMasterGetSlaveStatusResponseData struct {
	Remaining []uint64 `json:"remaining"`
	Removed   []uint64 `json:"removed"`
}

type ControllerServer

type ControllerServer struct {
	controller.GenericController
}

func (*ControllerServer) ActionMasterGetSlaveStatus

func (c *ControllerServer) ActionMasterGetSlaveStatus(r *gin.Context)

ActionMasterGetSlaveStatus 当前节点(从节点)收到主节点获取本节点(从节点)状态请求。(仅对等网络有效)

func (*ControllerServer) ActionMasterNotifySlaveToSwitchSuperior

func (c *ControllerServer) ActionMasterNotifySlaveToSwitchSuperior(r *gin.Context)

ActionMasterNotifySlaveToSwitchSuperior 当前节点(从节点)收到主节点发起向另一节点切换主节点身份请求。(仅对等网络有效)

func (*ControllerServer) ActionMasterNotifySlaveToTakeover

func (c *ControllerServer) ActionMasterNotifySlaveToTakeover(r *gin.Context)

ActionMasterNotifySlaveToTakeover 当前节点(从节点)收到主节点发起接替自己主节点身份请求。(仅对等网络有效)

func (*ControllerServer) ActionSlaveGetMasterStatus

func (c *ControllerServer) ActionSlaveGetMasterStatus(r *gin.Context)

ActionSlaveGetMasterStatus 从节点发起获取主节点(自己)状态的请求。 应当返回请求节点的 r.Request.Host、r.ClientIP() 和 r.Request.RemoteAddr 供远程节点校验。

func (*ControllerServer) ActionSlaveNotifyMasterAddSelf

func (c *ControllerServer) ActionSlaveNotifyMasterAddSelf(r *gin.Context)

ActionSlaveNotifyMasterAddSelf 从节点通知主节点(自己)添加其为从节点。 从节点应当发来 models.FreshNodeInfo 信息。 TODO: 校验从节点发来的 models.FreshNodeInfo 信息。

方法必须为 PUT,Header 的 Content-Type 必须为 application/json。

参数必须包含:

1. port: 请求加入从节点的端口号。

2. host: 请求加入从节点的域(IP地址)。可以是IPv4或IPv6。该信息仅供判断是否与本机收到的客户端IP一致,并不会登记为实际 host 。

3. name: 请求加入从节点的名称。

4. node_version: 请求加入从节点的版本号。

当接受了从节点等级请求后,响应码为 200 OK。响应体为 JSON 字符串,格式和说明参见 node.NotifyMasterToAddSelfAsSlaveResponseData。 若请求有误,则返回具体错误信息。

func (*ControllerServer) ActionSlaveNotifyMasterModifySelf

func (c *ControllerServer) ActionSlaveNotifyMasterModifySelf(r *gin.Context)

ActionSlaveNotifyMasterModifySelf 从节点通知主节点(自己)修改自身信息。 TODO:可以修改的项待定。

func (*ControllerServer) ActionSlaveNotifyMasterRemoveSelf

func (c *ControllerServer) ActionSlaveNotifyMasterRemoveSelf(r *gin.Context)

ActionSlaveNotifyMasterRemoveSelf 从节点通知主节点(自己)退出。

方法必须为 DELETE。

参数必须包含:

1. id: 请求退出从节点的ID。

2. port: 请求退出从节点的端口号。

3. name: 请求退出从节点的名称。

4. node_version: 请求退出从节点的版本。

以上四个参数必须与实际一直才能删除。

func (*ControllerServer) ActionStart

func (c *ControllerServer) ActionStart(r *gin.Context)

func (*ControllerServer) ActionStatus

func (c *ControllerServer) ActionStatus(r *gin.Context)

ActionStatus 服务器状态。仅用于未知节点获取当前节点信息。

func (*ControllerServer) ActionStop

func (c *ControllerServer) ActionStop(r *gin.Context)

func (*ControllerServer) RegisterActions

func (c *ControllerServer) RegisterActions(r *gin.Engine)

Jump to

Keyboard shortcuts

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