Documentation
¶
Index ¶
- type ActionInfo
- type ActionType
- type CreateMaterialEdgeReq
- type CreateMaterialEdgeResp
- type CreateMaterialReq
- type CreateMaterialResp
- type DataParam
- type DelMachineReq
- type DelMachineRes
- type DeviceAction
- type DeviceActionReq
- type DeviceActionResp
- type DeviceParamTemplate
- type DownloadMaterial
- type DownloadMaterialResp
- type Edge
- type EdgeNode
- type GraphEdge
- type GraphNodeReq
- type HandleData
- type InnerBaseConfig
- type LabWS
- type MachineStatus
- type MachineStatusReq
- type MachineStatusRes
- type Material
- type MaterialData
- type MaterialEdge
- type MaterialQueryReq
- type MaterialQueryResp
- type MaterialReq
- type MaterialResp
- type Node
- type ResourceHandleTemplate
- type ResourceInfo
- type ResourceReq
- type ResourceResp
- type ResourceTemplate
- type ResourceTemplateInfo
- type ResourceTemplateReq
- type ResourceTemplateResp
- type ResourceTemplates
- type SaveGrapReq
- type Service
- type StartMachineReq
- type StartMachineRes
- type StopMachineReq
- type StopMachineRes
- type TemplateReq
- type TemplateResp
- type UpdateMaterialData
- type UpdateMaterialDeviceNotify
- type UpdateMaterialReq
- type UpdateMaterialResNotify
- type UpdateNodeInfo
- type UpdatePair
- type UpsertMaterialReq
- type UpsertMaterialResp
- type WSDelNodeEdges
- type WSEdge
- type WSGraph
- type WSHandle
- type WSNode
- type WSNodeEdges
- type WSNodes
- type WSUpdateNode
- type WSUpdateNodeEdge
- type WSUpdateNodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionInfo ¶
type ActionInfo struct {
Name string `json:"name"`
Type string `json:"type"`
Schema datatypes.JSON `json:"schema" swaggertype:"object"`
Goal datatypes.JSON `json:"goal" swaggertype:"object"`
GoalDefault datatypes.JSON `json:"goal_default" swaggertype:"object"`
Feedback datatypes.JSON `json:"feedback" swaggertype:"object"`
Result datatypes.JSON `json:"result" swaggertype:"object"`
}
ActionInfo 动作信息
type ActionType ¶
type ActionType string
const ( FetchGraph ActionType = "fetch_graph" FetchTemplate ActionType = "fetch_template" TemplateDetail ActionType = "template_detail" SaveGraph ActionType = "save_graph" CreateNode ActionType = "create_node" UpdateNode ActionType = "update_node" BatchDelNode ActionType = "batch_del_nodes" BatchCreateEdge ActionType = "batch_create_edges" BatchDelEdge ActionType = "batch_del_edges" UpdateNodeData ActionType = "update_node_data" // 只更更新 data UpdateNodeResData ActionType = "update_material_resource_data" UpdateNodeCreate ActionType = "update_node_create" )
type CreateMaterialEdgeReq ¶
type CreateMaterialEdgeReq struct {
Edges []*MaterialEdge `json:"edges"`
}
type CreateMaterialEdgeResp ¶
type CreateMaterialEdgeResp struct {
UUID uuid.UUID `json:"uuid"`
SourceNodeUUID uuid.UUID `json:"source_node_uuid"`
TargetNodeUUID uuid.UUID `json:"target_node_uuid"`
SourceHandle string `json:"source_handle"`
TargetHandle string `json:"target_handle"`
}
TODO: 后续是否添加边的映射关系
type CreateMaterialReq ¶
type CreateMaterialReq struct {
Nodes []*Material `json:"nodes"`
}
==================== 新版带 uuid 版本
type CreateMaterialResp ¶
type DelMachineReq ¶
type DelMachineRes ¶
type DelMachineRes struct{}
type DeviceAction ¶
type DeviceActionReq ¶
type DeviceActionResp ¶
type DeviceActionResp struct {
Name string `json:"name"`
Actions []*DeviceAction `json:"actions"`
}
type DeviceParamTemplate ¶
type DownloadMaterial ¶
type DownloadMaterialResp ¶
type DownloadMaterialResp struct {
Nodes []*Node `json:"nodes"`
}
type Edge ¶
type Edge struct {
SourceUUID uuid.UUID `json:"source_uuid"`
TargetUUID uuid.UUID `json:"target_uuid"`
Source string `json:"source"`
Target string `json:"target"`
// FIXME: 下面两个字段命令 unilab 需要修改命名称
SourceHandle string `json:"sourceHandle"`
TargetHandle string `json:"targetHandle"`
Type string `json:"type"`
}
type EdgeNode ¶
type EdgeNode struct {
UUID uuid.UUID `json:"uuid"`
ParentUUID uuid.UUID `json:"parent_uuid"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description *string `json:"description"`
Class string `json:"class"`
Status string `json:"status"`
Type model.DEVICETYPE `json:"type"`
Config datatypes.JSON `json:"config" swaggertype:"object"`
Schema datatypes.JSON `json:"schema" swaggertype:"object"`
Data datatypes.JSON `json:"data" swaggertype:"object"`
Pose model.Pose `json:"pose"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
Icon string `json:"icon"`
Extra datatypes.JSON `json:"extra,omitempty" swaggertype:"object"`
}
type GraphNodeReq ¶
type HandleData ¶
type InnerBaseConfig ¶
type MachineStatus ¶
type MachineStatus string
const ( UnknowStatus MachineStatus = "unknown" Deleted MachineStatus = "deleted" Stoped MachineStatus = "stopped" Stoping MachineStatus = "stopping" Building MachineStatus = "building" Running MachineStatus = "running" Pending MachineStatus = "pending" NotExist MachineStatus = "not_exist" )
type MachineStatusReq ¶
type MachineStatusRes ¶
type MachineStatusRes struct {
Status MachineStatus
}
type Material ¶
type Material struct {
UUID uuid.UUID `json:"uuid" binding:"required"` // 有可能是 edge 编造 || 云端的
ParentUUID uuid.UUID `json:"parent_uuid"`
DeviceID string `json:"id" binding:"required"` // 实际是数据库的 name
Name string `json:"name" binding:"required"` // 实际是数据库的 display name
Type model.DEVICETYPE `json:"type" binding:"required"`
Class string `json:"class" binding:"required"`
Children []string `json:"children,omitempty"`
Parent string `json:"parent" default:""`
Pose datatypes.JSONType[model.Pose] `json:"pose" swaggertype:"object"`
Config datatypes.JSON `json:"config" swaggertype:"object"`
Data datatypes.JSON `json:"data" swaggertype:"object"`
// FIXME: 这块后续要优化掉,从 reg 获取
Schema datatypes.JSON `json:"schema" swaggertype:"object"`
Description *string `json:"description,omitempty"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
Position model.Position `json:"position"`
Position3D *model.Position `json:"position_3d,omitempty"`
Icon string `json:"icon,omitempty"`
}
type MaterialData ¶
type MaterialData struct {
Header string `json:"header"`
Handles []*HandleData `json:"handles"`
Params []*DataParam `json:"params"`
Executors []any `json:"executors"`
NodeCardIcon string `json:"node_card_icon"`
}
type MaterialEdge ¶
type MaterialQueryReq ¶
type MaterialQueryResp ¶
type MaterialQueryResp struct {
Nodes []*EdgeNode `json:"nodes"`
}
type MaterialReq ¶
type MaterialResp ¶
type MaterialResp struct {
ID string `json:"id"`
CloudUUID uuid.UUID `json:"cloud_uuid"`
Type string `json:"type"`
Data any `json:"data" swaggertype:"object"`
Position model.Position `json:"position"`
Status string `json:"status"`
Minimized bool `json:"minimized"`
Disabled bool `json:"disabled"`
Version string `json:"version"`
DragHandle string `json:"dragHandle"`
DeviceID string `json:"device_id"`
Name string `json:"name"`
ExperimentEnv int64 `json:"experiment_env"`
Description *string `json:"description"`
Collapsed bool `json:"collapsed"`
Width float32 `json:"width"`
Height float32 `json:"height"`
ChildNodesUUID []string `json:"child_nodes_uuid"`
ParentNodeUUID string `json:"parent_node_uuid"`
EqType string `json:"eq_type"`
Dirs []string `json:"dirs"`
Config datatypes.JSON `json:"config" swaggertype:"object"`
Parent string `json:"parent"`
Children []string `json:"children"`
Class string `json:"class,omitempty"`
}
type Node ¶
type Node struct {
UUID uuid.UUID `json:"uuid"`
ParentUUID uuid.UUID `json:"parent_uuid"`
DeviceID string `json:"id" binding:"required"` // 实际是数据库的 name
Name string `json:"name" binding:"required"` // 实际是数据库的 display name
Type model.DEVICETYPE `json:"type" binding:"required"`
Class string `json:"class" binding:"required"`
Children []string `json:"children,omitempty"`
Parent string `json:"parent" default:""`
Pose datatypes.JSONType[model.Pose] `json:"pose" swaggertype:"object"`
Config datatypes.JSON `json:"config" swaggertype:"object"`
Data datatypes.JSON `json:"data" swaggertype:"object"`
// FIXME: 这块后续要优化掉,从 reg 获取
Schema datatypes.JSON `json:"schema" swaggertype:"object"`
Description *string `json:"description,omitempty"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
Position model.Position `json:"position"`
Position3D *model.Position `json:"position_3d,omitempty"`
Extra datatypes.JSON `json:"extra,omitempty" swaggertype:"object"`
}
type ResourceHandleTemplate ¶
type ResourceInfo ¶
type ResourceReq ¶
type ResourceReq struct {
LabUUID uuid.UUID `json:"lab_uuid" form:"lab_uuid" uri:"lab_uuid"`
Type model.DEVICETYPE `json:"type" form:"type" uri:"type"`
}
type ResourceResp ¶
type ResourceResp struct {
ResourceNameList []*ResourceInfo `json:"resource_name_list"`
}
type ResourceTemplate ¶
type ResourceTemplateInfo ¶
type ResourceTemplateInfo struct {
UUID uuid.UUID `json:"uuid"`
Name string `json:"name"`
Icon string `json:"icon"`
Description *string `json:"description"`
ResourceType string `json:"resource_type"`
Language string `json:"language"`
Version string `json:"version"`
Module string `json:"module"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
DataSchema datatypes.JSON `json:"data_schema" swaggertype:"object"`
ConfigSchema datatypes.JSON `json:"config_schema" swaggertype:"object"`
Tags []string `json:"tags"`
Actions []*ActionInfo `json:"actions"` // 该资源支持的动作列表
MaterialCount int `json:"material_count"` // 该资源实例化的物料数量
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
ResourceTemplateInfo 资源模板详细信息
type ResourceTemplateReq ¶
type ResourceTemplateReq struct {
LabUUID uuid.UUID `json:"lab_uuid" form:"lab_uuid" uri:"lab_uuid" binding:"required"`
}
ResourceTemplateReq 获取资源模板详细信息的请求
type ResourceTemplateResp ¶
type ResourceTemplateResp struct {
Templates []*ResourceTemplateInfo `json:"templates"`
}
ResourceTemplateResp 资源模板列表响应
type ResourceTemplates ¶
type ResourceTemplates struct {
Templates []*ResourceTemplate `json:"templates"`
}
type SaveGrapReq ¶
type Service ¶
type Service interface {
CreateMaterial(ctx context.Context, req *GraphNodeReq) error
SaveMaterial(ctx context.Context, req *SaveGrapReq) error
LabMaterial(ctx context.Context, req *MaterialReq) ([]*MaterialResp, error)
BatchUpdateMaterial(ctx context.Context, req *UpdateMaterialReq) error
BatchUpdateUniqueName(ctx context.Context, req *UpdateMaterialReq) error
CreateEdge(ctx context.Context, req *GraphEdge) error
OnWSMsg(ctx context.Context, s *melody.Session, b []byte) error
OnWSConnect(ctx context.Context, s *melody.Session) error
OnMaterialNotify(ctx context.Context, msg string) error
DownloadMaterial(ctx context.Context, req *DownloadMaterial) (*GraphNodeReq, error)
GetMaterialTemplate(ctx context.Context, req *TemplateReq) (*TemplateResp, error)
ResourceList(ctx context.Context, req *ResourceReq) (*ResourceResp, error)
ResourceTemplateList(ctx context.Context, req *ResourceTemplateReq) (*ResourceTemplateResp, error)
DeviceAction(ctx context.Context, req *DeviceActionReq) (*DeviceActionResp, error)
// edge 相关接口
EdgeCreateMaterial(ctx context.Context, req *CreateMaterialReq) ([]*CreateMaterialResp, error)
EdgeUpsertMaterial(ctx context.Context, req *UpsertMaterialReq) ([]*UpsertMaterialResp, error)
EdgeCreateEdge(ctx context.Context, req *CreateMaterialEdgeReq) error
EdgeQueryMaterial(ctx context.Context, req *MaterialQueryReq) (*MaterialQueryResp, error)
EdgeDownloadMaterial(ctx context.Context) (*DownloadMaterialResp, error)
}
type StartMachineReq ¶
type StartMachineRes ¶
type StopMachineReq ¶
type StopMachineRes ¶
type StopMachineRes struct{}
type TemplateReq ¶
type TemplateResp ¶
type TemplateResp struct {
Handles []*ResourceHandleTemplate `json:"handles"`
UUID uuid.UUID `json:"uuid"`
ParentUUID uuid.UUID `json:"parent_uuid"`
Name string `json:"name"`
UserID string `json:"user_id"`
Header string `json:"header"`
Version string `json:"version"`
Icon string `json:"icon"`
Description *string `json:"description"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
Module string `json:"module"`
Language string `json:"language"`
StatusTypes datatypes.JSON `json:"status_types" swaggertype:"object"`
Tags datatypes.JSONSlice[string] `json:"tags" swaggertype:"array,string"`
DataSchema datatypes.JSON `json:"data_schema" swaggertype:"object"`
ConfigSchema datatypes.JSON `json:"config_schema" swaggertype:"object"`
ResourceType string `json:"resource_type"`
ConfigInfos datatypes.JSONSlice[model.ResourceConfig] `json:"config_infos,omitempty" swaggertype:"array,object"`
Pose datatypes.JSONType[model.Pose] `json:"pose" swaggertype:"object"`
}
type UpdateMaterialData ¶
type UpdateMaterialDeviceNotify ¶
type UpdateMaterialDeviceNotify struct {
Action string `json:"action"`
Data []*UpdateMaterialData `json:"data"`
}
type UpdateMaterialReq ¶
type UpdateMaterialReq struct {
Nodes []*Node `json:"nodes"`
}
type UpdateMaterialResNotify ¶
type UpdateNodeInfo ¶
type UpdatePair ¶
type UpdatePair struct {
ReqNode *Node
DBNode *model.MaterialNode
}
type UpsertMaterialReq ¶
type UpsertMaterialResp ¶
type WSHandle ¶
type WSHandle struct {
// NodeUUID uuid.UUID `json:"node_uuid"`
UUID uuid.UUID `json:"uuid"`
Name string `json:"name"`
Side string `json:"side"`
DisplayName string `json:"display_name"`
Type string `json:"type"`
IOType string `json:"io_type"`
Source string `json:"source"`
Key string `json:"key"`
}
前端获取 materials 相关数据
type WSNode ¶
type WSNode struct {
UUID uuid.UUID `json:"uuid"`
ParentUUID uuid.UUID `json:"parent_uuid"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description *string `json:"description"`
Type model.DEVICETYPE `json:"type"`
ResTemplateUUID uuid.UUID `json:"res_template_uuid"`
ResTemplateName string `json:"res_template_name"`
InitParamData datatypes.JSON `json:"init_param_data" swaggertype:"object"`
Schema datatypes.JSON `json:"schema,omitempty" swaggertype:"object"`
Data datatypes.JSON `json:"data" swaggertype:"object"`
PlateWellDatas map[string]datatypes.JSON `json:"plate_well_datas" swaggertype:"object"`
Status string `json:"status"`
Header string `json:"header"`
Pose datatypes.JSONType[model.Pose] `json:"pose" swaggertype:"object"`
Model datatypes.JSON `json:"model" swaggertype:"object"`
Icon string `json:"icon"`
Handles []*WSHandle `json:"handles"`
}
type WSUpdateNode ¶
type WSUpdateNode struct {
UUID uuid.UUID `json:"uuid"`
ParentUUID *uuid.UUID `json:"parent_uuid,omitempty"`
DisplayName *string `json:"display_name,omitempty"`
Description *string `json:"description,omitempty"`
InitParamData *datatypes.JSON `json:"init_param_data,omitempty"`
Data *datatypes.JSON `json:"data,omitempty"`
Pose *datatypes.JSONType[model.Pose] `json:"pose,omitempty"`
Schema *datatypes.JSON `json:"schema,omitempty"`
Extra *datatypes.JSON `json:"extra,omitempty"`
}
更新节点
Click to show internal directories.
Click to hide internal directories.