taskservice

package
v0.0.0-...-5dc165e Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Idempotency

type Idempotency interface {
	GetTaskStatusByID(ctx context.Context, taskID string) (taskentity.IntegrationDeliveryStatus, error)
	SaveTaskStatus(ctx context.Context, taskID string, status taskentity.IntegrationDeliveryStatus) error
}

type Locker

type Locker interface {
	Lock(ctx context.Context, key string, ttlSeconds int64) (unlock func() error, err error)
}

type Repository

type Repository interface {
	GetTaskByIDWithContext(ctx context.Context, taskID string) (taskentity.Task, error)
	UpsertTaskWithContext(ctx context.Context, taskID string, request param.UpsertTaskRequest) error
}

type Service

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

func New

func New(idempotency Idempotency, repo Repository, l Locker, taskLockTTLSeconds int64) Service

func (Service) GetTaskByID

func (s Service) GetTaskByID(taskID string) (taskentity.Task, error)

func (Service) GetTaskByIDWithContext

func (s Service) GetTaskByIDWithContext(ctx context.Context, taskID string) (taskentity.Task, error)

func (Service) GetTaskStatusByID

func (s Service) GetTaskStatusByID(ctx context.Context, taskID string) (taskentity.IntegrationDeliveryStatus, error)

func (Service) HandleTask

func (s Service) HandleTask(ctx context.Context, newEvent event.ProcessedEvent) error

func (Service) LockTaskByID

func (s Service) LockTaskByID(ctx context.Context, taskID string) (unlock func() error, err error)

func (Service) UpsertTaskAndSaveIdempotency

func (s Service) UpsertTaskAndSaveIdempotency(ctx context.Context, t taskentity.Task) error

Jump to

Keyboard shortcuts

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