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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. type AppInstanceID int64
  8. type ParticipantID string
  9. type AppSetInfo struct {
  10. Apps []AppInfo `json:"apps"`
  11. }
  12. type AppInfo interface {
  13. GetLocalJobID() string
  14. GetAppInstanceID() int64
  15. }
  16. var AppInfoTypeUnion = types.NewTypeUnion[AppInfo](
  17. (*FederatedLearningAppInfo)(nil),
  18. (*OtherAppInfo)(nil),
  19. )
  20. var _ = serder.UseTypeUnionInternallyTagged(&AppInfoTypeUnion, "type")
  21. type AppInfoBase struct {
  22. LocalJobID string `json:"localJobID"`
  23. AppInstanceID int64 `json:"appInstanceID"` // 应用实例ID
  24. }
  25. func (i *AppInfoBase) GetLocalJobID() string {
  26. return i.LocalJobID
  27. }
  28. func (i *AppInfoBase) GetAppInstanceID() int64 {
  29. return i.AppInstanceID
  30. }
  31. // FederatedLearningAppInfo 云际联邦学习应用信息
  32. type FederatedLearningAppInfo struct {
  33. serder.Metadata `union:"federatedLearning"`
  34. AppInfoBase
  35. Type string `json:"type"`
  36. AppInstanceID AppInstanceID `json:"appInstanceID"`
  37. Name string `json:"name"`
  38. Description string `json:"description"`
  39. ParticipantCount int `json:"participantCount"` //参与者人数
  40. JobInfo JobInfo `json:"jobInfo"` //作业信息
  41. Role string `json:"role"` //角色,initiator/participant
  42. IsDataReturn bool `json:"isDataReturn"` // 是否需要数据回源
  43. ParticipantInfo ParticipantInfo `json:"participantInfo"`
  44. ParticipantIDs []ParticipantID `json:"participantIDs"` //参与者ID列表
  45. JoinedCount int64 `json:"joinedCount"` //已经参与的人数
  46. }
  47. type ParticipantInfo struct {
  48. DatasetBindID cdssdk.ObjectID `json:"datasetBindID"` //数据集绑定id
  49. }
  50. type OtherAppInfo struct {
  51. serder.Metadata `union:"other"`
  52. AppInfoBase
  53. Type string `json:"type"`
  54. Name string `json:"name"`
  55. Description string `json:"description"`
  56. }