aggregate

package
v0.0.0-...-a23f117 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FMLManagerConnectionInfo

type FMLManagerConnectionInfo struct {
	Connected  bool
	Endpoint   string
	ServerName string
}

FMLManagerConnectionInfo contains FML connection info, loaded from the "site" context

type JobAggregate

type JobAggregate struct {
	Job                      *entity.Job
	Initiator                *entity.JobParticipant
	Participants             map[string]*entity.JobParticipant
	JobRepo                  repo.JobRepository
	ParticipantRepo          repo.JobParticipantRepository
	FMLManagerConnectionInfo FMLManagerConnectionInfo
	JobContext               JobContext
}

JobAggregate holds the job info and all the joined participants

func (*JobAggregate) ApproveJob

func (aggregate *JobAggregate) ApproveJob() error

ApproveJob mark the job as approved and notify FML manager

func (*JobAggregate) GenerateConfig

func (aggregate *JobAggregate) GenerateConfig() (string, string, error)

GenerateConfig returns the FATE job conf and dsl

func (*JobAggregate) GenerateGeneralTrainingConf

func (aggregate *JobAggregate) GenerateGeneralTrainingConf(hostUuidList []string) (string, error)

GenerateGeneralTrainingConf returns a string which contains the general conf information of a training job, including "dsl_version", "initiator", "role" and "job_parameters".

func (*JobAggregate) GeneratePredictingJobParticipants

func (aggregate *JobAggregate) GeneratePredictingJobParticipants() ([]*entity.JobParticipant, error)

GeneratePredictingJobParticipants returns a list of participant that should join new predicting job based on the job

func (*JobAggregate) GenerateReaderConfigMaps

func (aggregate *JobAggregate) GenerateReaderConfigMaps(hostUuidList []string) (hostMap,
	guestMap map[string]interface{})

GenerateReaderConfigMaps returns maps whose key is index, and values are the reader's configurations, in specific, the table name and namespaces for each party.

func (*JobAggregate) GetDataResultDownloadRequest

func (aggregate *JobAggregate) GetDataResultDownloadRequest() (*http.Request, error)

GetDataResultDownloadRequest returns a request object to be used to download the result data

func (*JobAggregate) HandleJobApprovalResponse

func (aggregate *JobAggregate) HandleJobApprovalResponse(siteUUID string, approved bool) error

HandleJobApprovalResponse process job approval response

func (*JobAggregate) HandleJobStatusUpdate

func (aggregate *JobAggregate) HandleJobStatusUpdate(newJobStatus *entity.Job, participantStatusMap map[string]entity.JobParticipantStatus) error

HandleJobStatusUpdate process job status update. If the job becomes running, then a monitoring routine will be started

func (*JobAggregate) HandleRemoteJobCreation

func (aggregate *JobAggregate) HandleRemoteJobCreation() error

HandleRemoteJobCreation handles creation of job initiated by other sites

func (*JobAggregate) RefreshJob

func (aggregate *JobAggregate) RefreshJob() error

RefreshJob checks the FATE job status

func (*JobAggregate) RejectJob

func (aggregate *JobAggregate) RejectJob() error

RejectJob mark the job as rejected and notify the FML manager

func (*JobAggregate) SubmitJob

func (aggregate *JobAggregate) SubmitJob() error

SubmitJob submits the job to the FATE system

type JobContext

type JobContext struct {
	AutoApprovalEnabled bool
	CurrentSiteUUID     string
}

JobContext contains necessary context for working with a job

type ProjectAggregate

type ProjectAggregate struct {
	Project         *entity.Project
	Participant     *entity.ProjectParticipant
	ProjectData     *entity.ProjectData
	ProjectRepo     repo.ProjectRepository
	ParticipantRepo repo.ProjectParticipantRepository
	InvitationRepo  repo.ProjectInvitationRepository
	DataRepo        repo.ProjectDataRepository
}

ProjectAggregate is the aggregation of the concept of a "project" We tried to follow the practice suggested by many DDD articles, however we made some simplification - we typically only manipulate with only one "project data" or one "project participant" for a project. And if there are bulk changes, we simply work with the "repo" to persist the change as there is no special business logics to construct a complete "project".

func (*ProjectAggregate) AssociateLocalData

func (aggregate *ProjectAggregate) AssociateLocalData(localDataAssociationCtx *ProjectLocalDataAssociationContext) error

AssociateLocalData associates local data into the project

func (*ProjectAggregate) CloseProject

func (aggregate *ProjectAggregate) CloseProject(fmlManagerConnectionInfo *FMLManagerConnectionInfo) error

CloseProject closes the current project managed by current site

func (*ProjectAggregate) CountParticipant

func (aggregate *ProjectAggregate) CountParticipant() (int64, error)

CountParticipant returns number of participants in the current project

func (*ProjectAggregate) CreateOrUpdateData

func (aggregate *ProjectAggregate) CreateOrUpdateData(newData *entity.ProjectData) error

CreateOrUpdateData creates the associated data record or updates its status

func (*ProjectAggregate) CreateOrUpdateParticipant

func (aggregate *ProjectAggregate) CreateOrUpdateParticipant(newParticipant *entity.ProjectParticipant) error

CreateOrUpdateParticipant creates a participant record in the repo or update its status

func (*ProjectAggregate) CreateOrUpdateProject

func (aggregate *ProjectAggregate) CreateOrUpdateProject() error

CreateOrUpdateProject creates the project in the repo or update its status

func (*ProjectAggregate) CreateRemoteProjectData

func (aggregate *ProjectAggregate) CreateRemoteProjectData(context *ProjectRemoteDataAssociationContext) error

CreateRemoteProjectData creates remote data association

func (*ProjectAggregate) CreateRemoteProjectParticipants

func (aggregate *ProjectAggregate) CreateRemoteProjectParticipants(participants []entity.ProjectParticipant) error

CreateRemoteProjectParticipants adds the passed participants into the repo

func (*ProjectAggregate) DeleteRemoteProjectData

func (aggregate *ProjectAggregate) DeleteRemoteProjectData(context *ProjectRemoteDataDismissalContext) error

DeleteRemoteProjectData deletes remote data association

func (*ProjectAggregate) DismissAssociatedLocalData

func (aggregate *ProjectAggregate) DismissAssociatedLocalData(context *ProjectLocalDataDismissalContext) error

DismissAssociatedLocalData dismisses local data association

func (*ProjectAggregate) InviteParticipant

func (aggregate *ProjectAggregate) InviteParticipant(invitationContext *ProjectInvitationContext) error

InviteParticipant send project invitation to certain site

func (*ProjectAggregate) JoinProject

func (aggregate *ProjectAggregate) JoinProject(fmlManagerConnectionInfo *FMLManagerConnectionInfo) error

JoinProject joins the project by sending invitation response

func (*ProjectAggregate) LeaveProject

func (aggregate *ProjectAggregate) LeaveProject(fmlManagerConnectionInfo *FMLManagerConnectionInfo) error

LeaveProject leave the current remote project

func (*ProjectAggregate) ListParticipant

func (aggregate *ProjectAggregate) ListParticipant(all bool, fmlManagerConnectionInfo *FMLManagerConnectionInfo) ([]entity.ProjectParticipant, error)

ListParticipant returns participants of the current project, or all participant in FML manager

func (*ProjectAggregate) ProcessInvitation

func (aggregate *ProjectAggregate) ProcessInvitation(invitation *entity.ProjectInvitation, siteUUID string) error

ProcessInvitation handle's invitation request from FML manager and saves it into repo

func (*ProjectAggregate) RejectProject

func (aggregate *ProjectAggregate) RejectProject(fmlManagerConnectionInfo *FMLManagerConnectionInfo) error

RejectProject reject to join the project by sending the invitation response

func (*ProjectAggregate) RemoveParticipant

func (aggregate *ProjectAggregate) RemoveParticipant(siteUUID string, fmlManagerConnectionInfo *FMLManagerConnectionInfo) error

RemoveParticipant removes a joined participant or revoke an invitation to a pending site

func (*ProjectAggregate) SyncDataAssociation

func (aggregate *ProjectAggregate) SyncDataAssociation(context *ProjectSyncContext) error

SyncDataAssociation sync the data association info with the fml manager

func (*ProjectAggregate) SyncParticipant

func (aggregate *ProjectAggregate) SyncParticipant(context *ProjectSyncContext) error

SyncParticipant sync the participant status from fml manager

type ProjectInvitationContext

type ProjectInvitationContext struct {
	FMLManagerConnectionInfo *FMLManagerConnectionInfo
	SiteUUID                 string
	SitePartyID              uint
	SiteName                 string
	SiteDescription          string
}

ProjectInvitationContext is the context we use to issue project invitation

type ProjectLocalDataAssociationContext

type ProjectLocalDataAssociationContext struct {
	FMLManagerConnectionInfo *FMLManagerConnectionInfo
	LocalData                *entity.ProjectData
}

ProjectLocalDataAssociationContext is the context we use to create new local data association

type ProjectLocalDataDismissalContext

type ProjectLocalDataDismissalContext struct {
	FMLManagerConnectionInfo *FMLManagerConnectionInfo
}

ProjectLocalDataDismissalContext is the context we use to dismiss data association

type ProjectRemoteDataAssociationContext

type ProjectRemoteDataAssociationContext struct {
	LocalSiteUUID  string
	RemoteDataList []entity.ProjectData
}

ProjectRemoteDataAssociationContext is the context we use to create remote data association

type ProjectRemoteDataDismissalContext

type ProjectRemoteDataDismissalContext struct {
	LocalSiteUUID      string
	RemoteDataUUIDList []string
}

ProjectRemoteDataDismissalContext is the context we use to dismiss remote data association

type ProjectSyncContext

type ProjectSyncContext struct {
	FMLManagerConnectionInfo *FMLManagerConnectionInfo
	LocalSiteUUID            string
}

ProjectSyncContext is the context we use to sync project info with fml-manager

Jump to

Keyboard shortcuts

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