process

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ProcessActivityName = "process"
View Source
const ProcessEventActivityName = "process-event"

Variables

This section is empty.

Functions

This section is empty.

Types

type AlreadyCompletedError

type AlreadyCompletedError struct {
	ID string
}

AlreadyCompletedError is returned if a process the user is trying to mutate has already completed.

func (AlreadyCompletedError) AlreadyCompleted

func (AlreadyCompletedError) AlreadyCompleted() bool

AlreadyCompleted tells a client that this error is related to a process already being completed. Can be used to translate the error to eg. status code.

func (AlreadyCompletedError) Details

func (e AlreadyCompletedError) Details() []interface{}

Details returns error details.

func (AlreadyCompletedError) Error

func (AlreadyCompletedError) Error() string

Error implements the error interface.

func (AlreadyCompletedError) ServiceError

func (AlreadyCompletedError) ServiceError() bool

ServiceError tells the transport layer whether this error should be translated into the transport format or an internal error should be returned instead.

type ErrorHandler

type ErrorHandler = common.ErrorHandler

ErrorHandler handles an error.

type Logger

type Logger = common.Logger

Logger is the fundamental interface for all log operations.

type MockWorkflowService

type MockWorkflowService struct {
	mock.Mock
}

MockWorkflowService is an autogenerated mock for the WorkflowService type.

func (*MockWorkflowService) CancelProcess

func (_m *MockWorkflowService) CancelProcess(ctx context.Context, id string) (err error)

CancelProcess provides a mock function.

func (*MockWorkflowService) GetProcess

func (_m *MockWorkflowService) GetProcess(ctx context.Context, id string) (process pipeline.Process, err error)

GetProcess provides a mock function.

func (*MockWorkflowService) ListProcesses

func (_m *MockWorkflowService) ListProcesses(ctx context.Context, query pipeline.Process) (processes []pipeline.Process, err error)

ListProcesses provides a mock function.

func (*MockWorkflowService) LogProcess

func (_m *MockWorkflowService) LogProcess(ctx context.Context, proc pipeline.Process) (process pipeline.Process, err error)

LogProcess provides a mock function.

func (*MockWorkflowService) LogProcessEvent

func (_m *MockWorkflowService) LogProcessEvent(ctx context.Context, proc pipeline.ProcessEvent) (processEvent pipeline.ProcessEvent, err error)

LogProcessEvent provides a mock function.

func (*MockWorkflowService) SignalProcess

func (_m *MockWorkflowService) SignalProcess(ctx context.Context, id string, signal string, value interface{}) (err error)

SignalProcess provides a mock function.

type NoopLogger

type NoopLogger = common.NoopLogger

NoopLogger is a logger that discards every log event.

type NotFoundError

type NotFoundError struct {
	ID string
}

NotFoundError is returned if a process cannot be found.

func (NotFoundError) Details

func (e NotFoundError) Details() []interface{}

Details returns error details.

func (NotFoundError) Error

func (NotFoundError) Error() string

Error implements the error interface.

func (NotFoundError) NotFound

func (NotFoundError) NotFound() bool

NotFound tells a client that this error is related to a resource being not found. Can be used to translate the error to eg. status code.

func (NotFoundError) ServiceError

func (NotFoundError) ServiceError() bool

ServiceError tells the transport layer whether this error should be translated into the transport format or an internal error should be returned instead.

type Process

type Process = pipeline.Process

Process represents an pipeline process.

type ProcessActivity

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

func NewProcessActivity

func NewProcessActivity(service Service) ProcessActivity

func (ProcessActivity) ExecuteProcess

func (a ProcessActivity) ExecuteProcess(ctx context.Context, input ProcessActivityInput) error

func (ProcessActivity) ExecuteProcessEvent

func (a ProcessActivity) ExecuteProcessEvent(ctx context.Context, input ProcessEventActivityInput) error

type ProcessActivityInput

type ProcessActivityInput struct {
	ID           string
	ParentID     string
	OrgID        int32
	Type         string
	Log          string
	ResourceID   string
	ResourceType string
	Status       Status
	StartedAt    time.Time
	FinishedAt   *time.Time
}

type ProcessEvent

type ProcessEvent = pipeline.ProcessEvent

ProcessEvent represents an pipeline process event.

type ProcessEventActivityInput

type ProcessEventActivityInput struct {
	ProcessID string
	Type      string
	Log       string
	Status    Status
	Timestamp time.Time
}

type ProcessStatus

type ProcessStatus = pipeline.ProcessStatus

ProcessStatus represents an pipeline process/event status.

type Service

type Service interface {
	// LogProcess create a process entry
	LogProcess(ctx context.Context, proc Process) (process Process, err error)

	// LogProcessEvent create a process event
	LogProcessEvent(ctx context.Context, proc ProcessEvent) (processEvent ProcessEvent, err error)

	// ListProcesses lists access processes visible for a user.
	ListProcesses(ctx context.Context, query Process) (processes []Process, err error)

	// GetProcess returns a single process.
	GetProcess(ctx context.Context, id string) (process Process, err error)
}

Service provides access to pipeline processes.

func NewService

func NewService(store Store) Service

NewService returns a new Service.

type Status

type Status string
const (
	Running  Status = "running"
	Failed   Status = "failed"
	Finished Status = "finished"
)

type Store

type Store interface {
	// ListProcesses lists the process in the for a given organization.
	ListProcesses(ctx context.Context, query Process) ([]Process, error)

	// LogProcess adds a process entry.
	LogProcess(ctx context.Context, p Process) error

	// GetProcess gets a process entry.
	GetProcess(ctx context.Context, id string) (Process, error)

	// LogProcessEvent adds a process event to a process.
	LogProcessEvent(ctx context.Context, p ProcessEvent) error
}

Store persists access processes in a persistent store.

type WorkflowService

type WorkflowService interface {
	Service

	// CancelProcess cancels a single process.
	CancelProcess(ctx context.Context, id string) (err error)

	// SignalProcess sends a signal to a single process.
	SignalProcess(ctx context.Context, id string, signal string, value interface{}) (err error)
}

func NewWorkflowService

func NewWorkflowService(store Store, workflowClient workflowClient) WorkflowService

NewWorkflowService returns a new WorkflowService.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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