You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

app_models.go 2.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package schsdk
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/types"
  4. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  5. "gitlink.org.cn/cloudream/common/utils/serder"
  6. )
  7. const (
  8. Role = "role"
  9. RoleServer = "server"
  10. RoleClient = "client"
  11. )
  12. type AppInstanceID int64
  13. type ClientID string
  14. type AppSetInfo struct {
  15. Apps []AppInfo `json:"apps"`
  16. }
  17. type AppInfo interface {
  18. GetLocalJobID() string
  19. GetAppInstanceID() int64
  20. }
  21. var AppInfoTypeUnion = types.NewTypeUnion[AppInfo](
  22. (*FederatedLearningAppInfo)(nil),
  23. (*OtherAppInfo)(nil),
  24. )
  25. var _ = serder.UseTypeUnionInternallyTagged(&AppInfoTypeUnion, "type")
  26. type AppInfoBase struct {
  27. LocalJobID string `json:"localJobID"`
  28. AppInstanceID int64 `json:"appInstanceID"` // 应用实例ID
  29. }
  30. func (i *AppInfoBase) GetLocalJobID() string {
  31. return i.LocalJobID
  32. }
  33. func (i *AppInfoBase) GetAppInstanceID() int64 {
  34. return i.AppInstanceID
  35. }
  36. // FederatedLearningAppInfo 云际联邦学习应用信息
  37. type FederatedLearningAppInfo struct {
  38. serder.Metadata `union:"federatedLearning"`
  39. AppInfoBase
  40. Type string `json:"type"`
  41. AppInstanceID AppInstanceID `json:"appInstanceID"`
  42. Name string `json:"name"`
  43. Description string `json:"description"`
  44. ClientCount int `json:"clientCount"` //参与者人数
  45. ServerJobInfo JobInfo `json:"serverJobInfo"` //服务端作业信息
  46. ClientJobInfo JobInfo `json:"clientJobInfo"` //客户端作业信息
  47. Role string `json:"role"` //角色,server/client
  48. IsDataReturn bool `json:"isDataReturn"` //是否需要数据回源
  49. DatasetBindID cdssdk.ObjectID `json:"datasetBindID"` //数据集绑定ID
  50. ClientIDs []ClientID `json:"clientIDs"` //参与者ID列表
  51. JoinedCount int64 `json:"joinedCount"` //已经参与的人数
  52. }
  53. type OtherAppInfo struct {
  54. serder.Metadata `union:"other"`
  55. AppInfoBase
  56. Type string `json:"type"`
  57. Name string `json:"name"`
  58. Description string `json:"description"`
  59. }