service

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobApprovalResponse

type JobApprovalResponse struct {
	Initiator     JobParticipantConnectionInfo
	Participants  map[string]JobParticipantConnectionInfo
	ApprovingSite *entity.JobParticipant
	Approved      bool
	JobUUID       string
}

JobApprovalResponse contains the info needed to process the job approval response

type JobCreationRequest

type JobCreationRequest struct {
	Job          *entity.Job
	Initiator    JobParticipantSiteInfo
	Participants map[string]JobParticipantSiteInfo
}

JobCreationRequest holds the job info and all the joined participants

type JobParticipantConnectionInfo

type JobParticipantConnectionInfo struct {
	ExternalHost string
	ExternalPort uint
	HTTPS        bool
	ServerName   string
}

JobParticipantConnectionInfo contains connection info to the participating site

type JobParticipantSiteInfo

type JobParticipantSiteInfo struct {
	*entity.JobParticipant
	JobParticipantConnectionInfo
}

JobParticipantSiteInfo contains more detailed info of a participating site

type JobParticipantStatusInfo

type JobParticipantStatusInfo struct {
	entity.JobParticipantStatus
	JobParticipantConnectionInfo
}

JobParticipantStatusInfo contains job participating status and the site connection info

type JobService

type JobService struct {
	JobRepo         repo.JobRepository
	ParticipantRepo repo.JobParticipantRepository
}

JobService processes job related requests

func (*JobService) HandleJobApprovalResponse

func (s *JobService) HandleJobApprovalResponse(response *JobApprovalResponse) error

HandleJobApprovalResponse process job approval response

func (*JobService) HandleJobStatusUpdate

func (s *JobService) HandleJobStatusUpdate(context *JobStatusUpdateContext) error

HandleJobStatusUpdate process job status update

func (*JobService) HandleNewJobCreation

func (s *JobService) HandleNewJobCreation(request *JobCreationRequest) error

HandleNewJobCreation process job creation request

type JobStatusUpdateContext

type JobStatusUpdateContext struct {
	JobUUID              string
	NewJobStatus         *entity.Job
	ParticipantStatusMap map[string]JobParticipantStatusInfo
	RequestJson          string
}

JobStatusUpdateContext contains info needed to update a job status

type ProjectInvitationRequest

type ProjectInvitationRequest struct {
	InvitationUUID string
	Project        *entity.Project
	ManagingSite   *ProjectParticipantSiteInfo
	TargetSite     *ProjectParticipantSiteInfo
	AssociatedData []entity.ProjectData
}

ProjectInvitationRequest is an invitation for asking a site to join a project

type ProjectParticipantSiteInfo

type ProjectParticipantSiteInfo struct {
	Name         string
	Description  string
	UUID         string
	PartyID      uint
	ExternalHost string
	ExternalPort uint
	HTTPS        bool
	ServerName   string
}

ProjectParticipantSiteInfo contains more detailed info of a participating site

type ProjectService

type ProjectService struct {
	ProjectRepo     repo.ProjectRepository
	InvitationRepo  repo.ProjectInvitationRepository
	ParticipantRepo repo.ProjectParticipantRepository
	ProjectDataRepo repo.ProjectDataRepository
}

ProjectService is the service to handle project related requests

func (*ProjectService) HandleDataAssociation

func (s *ProjectService) HandleDataAssociation(newData *entity.ProjectData, otherSiteList []ProjectParticipantSiteInfo) error

HandleDataAssociation sends the new data association to other participating sites

func (*ProjectService) HandleDataDismissal

func (s *ProjectService) HandleDataDismissal(projectUUID, dataUUID string, otherSiteList []ProjectParticipantSiteInfo) error

HandleDataDismissal sends data dismissal event to other participating site

func (*ProjectService) HandleInvitationAcceptance

func (s *ProjectService) HandleInvitationAcceptance(req *ProjectInvitationRequest, otherSiteList []ProjectParticipantSiteInfo) error

HandleInvitationAcceptance updates the status in the DB and send the participants info to the joined sites

func (*ProjectService) HandleInvitationRejection

func (s *ProjectService) HandleInvitationRejection(req *ProjectInvitationRequest) error

HandleInvitationRejection updates the DB status and redirect the response to the owner site

func (*ProjectService) HandleInvitationRequest

func (s *ProjectService) HandleInvitationRequest(req *ProjectInvitationRequest) error

HandleInvitationRequest creates/updates repo records and forward the invitation to the target site

func (*ProjectService) HandleInvitationRevocation

func (s *ProjectService) HandleInvitationRevocation(req *ProjectInvitationRequest) error

HandleInvitationRevocation updates the DB status and redirect the response to the target site

func (*ProjectService) HandleParticipantDismissal

func (s *ProjectService) HandleParticipantDismissal(projectUUID string, targetSite ProjectParticipantSiteInfo, otherSiteList []ProjectParticipantSiteInfo) error

HandleParticipantDismissal sends the dismissal to the target site and update the participant status in the repo and send such update to other sites

func (*ProjectService) HandleParticipantInfoUpdate

func (s *ProjectService) HandleParticipantInfoUpdate(newSiteInfo ProjectParticipantSiteInfo, allSites []ProjectParticipantSiteInfo) error

HandleParticipantInfoUpdate updates the site info in the repo and send such update to impacted sites

func (*ProjectService) HandleParticipantLeaving

func (s *ProjectService) HandleParticipantLeaving(projectUUID, siteUUID string, otherSiteList []ProjectParticipantSiteInfo) error

HandleParticipantLeaving updates the participant status in the repo and send such update to impacted sites

func (*ProjectService) HandleParticipantUnregistration

func (s *ProjectService) HandleParticipantUnregistration(siteUUID string, allSites []ProjectParticipantSiteInfo) error

HandleParticipantUnregistration changes the status of all the impacted project on one of its participants unregistration

func (*ProjectService) HandleProjectClosing

func (s *ProjectService) HandleProjectClosing(projectUUID string, otherSiteList []ProjectParticipantSiteInfo) error

HandleProjectClosing updates project status and sends the event to other site

type SiteService

type SiteService struct {
	// SiteRepo is the repository for persisting site info
	SiteRepo repo.SiteRepository
}

func (*SiteService) HandleSiteRegistration

func (s *SiteService) HandleSiteRegistration(site *entity.Site) error

HandleSiteRegistration creates or updates the site info

func (*SiteService) HandleSiteUnregistration

func (s *SiteService) HandleSiteUnregistration(siteUUID string) error

Jump to

Keyboard shortcuts

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