From 2756849a1bf54a61dbd3dcad68ef82c09d96b4fb Mon Sep 17 00:00:00 2001 From: JeshuaRen <270813223@qq.com> Date: Tue, 8 Jul 2025 16:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=94=E7=94=A8=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdks/scheduler/app_models.go | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sdks/scheduler/app_models.go diff --git a/sdks/scheduler/app_models.go b/sdks/scheduler/app_models.go new file mode 100644 index 0000000..77d5c97 --- /dev/null +++ b/sdks/scheduler/app_models.go @@ -0,0 +1,41 @@ +package schsdk + +import ( + "gitlink.org.cn/cloudream/common/pkgs/types" + "gitlink.org.cn/cloudream/common/utils/serder" +) + +type AppInfo interface { + GetAppID() string +} + +var AppInfoTypeUnion = types.NewTypeUnion[AppInfo]( + (*FederatedLearningAppInfo)(nil), + (*OtherAppInfo)(nil), +) + +var _ = serder.UseTypeUnionInternallyTagged(&JobInfoTypeUnion, "type") + +type AppInfoBase struct { + ID string `json:"id"` +} + +func (i *AppInfoBase) GetAppID() string { + return i.ID +} + +type FederatedLearningAppInfo struct { + serder.Metadata `union:"federatedLearning"` + AppInfoBase + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` +} + +type OtherAppInfo struct { + serder.Metadata `union:"other"` + AppInfoBase + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` +}