submission

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateSubmission        = "CreateSubmission"
	CancelSubmission        = "CancelSubmission"
	DeleteSubmission        = "DeleteSubmission"
	CascadeDeleteSubmission = "CascadeDeleteSubmission"
	SyncSubmission          = "SyncSubmission"

	CreateRuns = "CreateRuns"
	SubmitRun  = "SubmitRun"
	SyncRun    = "SyncRun"
	CancelRun  = "CancelRun"
	DeleteRun  = "DeleteRun"
)
View Source
const WESTag = "wes"

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelHandler

type CancelHandler struct {
	// contains filtered or unexported fields
}

func NewCancelHandler

func NewCancelHandler(repository Repository, eventbus eventbus.EventBus, runReadModel run.ReadModel) *CancelHandler

func (*CancelHandler) Handle

func (h *CancelHandler) Handle(ctx context.Context, event *EventSubmission) (err error)

type CascadeDeleteHandler

type CascadeDeleteHandler struct {
	// contains filtered or unexported fields
}

func NewCascadeDeleteHandler

func NewCascadeDeleteHandler(repository Repository, eventbus eventbus.EventBus, submissionReadModel submissionquery.ReadModel) *CascadeDeleteHandler

func (*CascadeDeleteHandler) Handle

type CascadeDeleteSubmissionEvent

type CascadeDeleteSubmissionEvent struct {
	WorkspaceID string
	Workflow    *string
}

func NewEventCascadeDeleteSubmission

func NewEventCascadeDeleteSubmission(workspaceID string, workflow *string) *CascadeDeleteSubmissionEvent

func NewEventCascadeDeleteSubmissionFromPayload

func NewEventCascadeDeleteSubmissionFromPayload(data []byte) (*CascadeDeleteSubmissionEvent, error)

func (*CascadeDeleteSubmissionEvent) Delay

func (*CascadeDeleteSubmissionEvent) EventType

func (e *CascadeDeleteSubmissionEvent) EventType() string

func (*CascadeDeleteSubmissionEvent) Payload

func (e *CascadeDeleteSubmissionEvent) Payload() []byte

type CreateEvent

type CreateEvent struct {
	WorkspaceID             string
	SubmissionID            string
	SourceWorkflowID        string
	SourceWorkflowVersionID string
	SourceDataModelID       *string
	SourceDataModelRowIDs   []string
}

func NewCreateEvent

func NewCreateEvent(workspaceID, submissionID, workflowID, workflowVersionID string, sourceDataModelID *string, sourceDataModelRowIDs []string) *CreateEvent

func NewCreateEventFromPayload

func NewCreateEventFromPayload(data []byte) (*CreateEvent, error)

func (*CreateEvent) Delay

func (e *CreateEvent) Delay() time.Duration

func (*CreateEvent) EventType

func (e *CreateEvent) EventType() string

func (*CreateEvent) Payload

func (e *CreateEvent) Payload() []byte

type CreateHandler

type CreateHandler struct {
	// contains filtered or unexported fields
}

func NewCreateHandler

func NewCreateHandler(repository Repository, eventbus eventbus.EventBus, workflowClient grpc.WorkflowClient) *CreateHandler

func (*CreateHandler) Handle

func (h *CreateHandler) Handle(ctx context.Context, event *CreateEvent) (err error)

type CreateSubmissionParam

type CreateSubmissionParam struct {
	Name              string
	Description       *string
	WorkflowID        string
	WorkflowVersionID string
	WorkspaceID       string
	DataModelID       *string
	DataModelRowIDs   []string
	Type              string
	Inputs            map[string]interface{}
	Outputs           map[string]interface{}
	ExposedOptions    ExposedOptions
}

CreateSubmissionParam use to create Submission

type DeleteHandler

type DeleteHandler struct {
	// contains filtered or unexported fields
}

func NewDeleteHandler

func NewDeleteHandler(repository Repository, eventbus eventbus.EventBus, runReadModel run.ReadModel) *DeleteHandler

func (*DeleteHandler) Handle

func (h *DeleteHandler) Handle(ctx context.Context, event *EventSubmission) (err error)

type EventCreateRuns

type EventCreateRuns struct {
	WorkspaceID     string
	SubmissionID    string
	InputsTemplate  map[string]interface{}
	OutputsTemplate map[string]interface{}
	SubmisstionType string // filePath or dataModel
	DataModelID     *string
	DataModelRowIDs []string

	RunConfig *RunConfig
}

func NewEventCreateRunFromPayload

func NewEventCreateRunFromPayload(data []byte) (*EventCreateRuns, error)

func NewEventCreateRuns

func NewEventCreateRuns(workspaceID, submissionID, submissionType string, inputs, outputs map[string]interface{}, dataModelID *string, DataModelRowIDs []string, runConfig *RunConfig) *EventCreateRuns

func (*EventCreateRuns) Delay

func (e *EventCreateRuns) Delay() time.Duration

func (*EventCreateRuns) EventType

func (e *EventCreateRuns) EventType() string

func (*EventCreateRuns) Payload

func (e *EventCreateRuns) Payload() []byte

type EventRun

type EventRun struct {
	RunID         string
	EventTyp      string
	DelayDuration time.Duration
}

func NewEventCancelRun

func NewEventCancelRun(runID string) *EventRun

func NewEventDeleteRun

func NewEventDeleteRun(runID string) *EventRun

func NewEventRunFromPayload

func NewEventRunFromPayload(data []byte) (*EventRun, error)

func NewEventSyncRun

func NewEventSyncRun(runID string, delayDuration time.Duration) *EventRun

func (*EventRun) Delay

func (e *EventRun) Delay() time.Duration

func (*EventRun) EventType

func (e *EventRun) EventType() string

func (*EventRun) Payload

func (e *EventRun) Payload() []byte

type EventSubmission

type EventSubmission struct {
	SubmissionID  string
	Event         string
	DelayDuration time.Duration
}

func NewCancelSubmissionEvent

func NewCancelSubmissionEvent(submissionID string, duration time.Duration) *EventSubmission

func NewDeleteSubmissionEvent

func NewDeleteSubmissionEvent(submissionID string, duration time.Duration) *EventSubmission

func NewEventFromPayload

func NewEventFromPayload(data []byte) (*EventSubmission, error)

func NewSyncSubmissionEvent

func NewSyncSubmissionEvent(submissionID string) *EventSubmission

func (*EventSubmission) Delay

func (e *EventSubmission) Delay() time.Duration

func (*EventSubmission) EventType

func (e *EventSubmission) EventType() string

func (*EventSubmission) Payload

func (e *EventSubmission) Payload() []byte

type EventSubmitRun

type EventSubmitRun struct {
	RunID     string
	RunConfig *RunConfig
}

func NewEventSubmitRun

func NewEventSubmitRun(runID string, runConfig *RunConfig) *EventSubmitRun

func NewEventSubmitRunFromPayload

func NewEventSubmitRunFromPayload(data []byte) (*EventSubmitRun, error)

func (*EventSubmitRun) Delay

func (e *EventSubmitRun) Delay() time.Duration

func (*EventSubmitRun) EventType

func (e *EventSubmitRun) EventType() string

func (*EventSubmitRun) Payload

func (e *EventSubmitRun) Payload() []byte

type ExposedOptions

type ExposedOptions struct {
	ReadFromCache bool `wes:"read_from_cache"`
}

type Factory

type Factory struct{}

Factory workspace factory.

func NewSubmissionFactory

func NewSubmissionFactory(_ context.Context) *Factory

NewSubmissionFactory return a workspace factory.

func (*Factory) CreateWithSubmissionParam

func (fac *Factory) CreateWithSubmissionParam(param CreateSubmissionParam) (*Submission, error)

CreateWithSubmissionParam ...

type Repository

type Repository interface {
	Save(ctx context.Context, s *Submission) error
	Get(ctx context.Context, id string) (*Submission, error)
	Delete(ctx context.Context, s *Submission) error
	SoftDelete(ctx context.Context, s *Submission) error
}

Repository allows to get/save events from/to event store.

type RunConfig

type RunConfig struct {
	Language                 string
	WorkflowContents         map[string]string
	MainWorkflowFilePath     string
	WorkflowEngineParameters map[string]interface{}
	Version                  string
}

type Service

type Service interface {
	Get(context.Context, string) (*Submission, error)
	Upsert(context.Context, *Submission) error
	Create(context.Context, *Submission) error
	Update(context.Context, *Submission) error
	Delete(ctx context.Context, id string) error
	SoftDelete(ctx context.Context, id string) error
	Cancel(ctx context.Context, id string) error
	CheckWorkspaceExist(ctx context.Context, workspaceID string) error
	CheckSubmissionExist(ctx context.Context, workspaceID, submissionName string) error
}

func NewService

func NewService(grpcFactory grpc.Factory, repo Repository, eventbus eventbus.EventBus, submissionReadModel submissionquery.ReadModel, runReadModel run.ReadModel) Service

type Submission

type Submission struct {
	ID                string
	Name              string
	Description       *string
	WorkflowID        string
	WorkflowVersionID string
	WorkspaceID       string
	DataModelID       *string
	DataModelRowIDs   []string
	Type              string
	Inputs            map[string]interface{}
	Outputs           map[string]interface{}
	ExposedOptions    ExposedOptions
	Status            string
	StartTime         time.Time
	FinishTime        *time.Time
}

Submission ...

type SyncHandler

type SyncHandler struct {
	// contains filtered or unexported fields
}

func NewSyncHandler

func NewSyncHandler(repository Repository, runReadModel run.ReadModel, dataModelClient grpc.DataModelClient) *SyncHandler

func (*SyncHandler) Handle

func (h *SyncHandler) Handle(ctx context.Context, event *EventSubmission) (err error)

Jump to

Keyboard shortcuts

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