taskservice

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package taskservice implements TES task operations over readers, events, and compute backends.

Index

Constants

View Source
const InternalCallKey contextKey = "internalCall"

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	tesrpc.UnimplementedTaskServiceServer
	Name          string
	Event         events.Writer
	Compute       compute.Computer
	Read          taskpolicy.ReadOnlyServer
	Log           *logger.Logger
	Config        *config.Config
	Plugin        proto.Authorize
	PluginManager *pluginmanager.Manager
	// contains filtered or unexported fields
}

Service is a wrapper which handles common TES Task Service operations, such as initializing a task when CreateTask is called. The Service is backed by two parts: a read API which provides the GetTask and ListTasks endpoints, and a write API which implements the events.Writer interface. Task creation and cancelation is managed by writing events to underlying event writer.

This makes it easier to define task service backends for new databases, and ensures that common operations are handled consistently, such as setting IDs, handling 404s, GetServiceInfo, etc.

func (*Service) CancelTask

func (ts *Service) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)

CancelTask cancels a task

func (*Service) Close

func (ts *Service) Close()

Close waits for in-flight submissions, then closes owned plugin processes once.

func (*Service) CreateTask

func (ts *Service) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)

CreateTask provides an HTTP/gRPC endpoint for creating a task. This is part of the TES implementation.

func (*Service) DoPluginAction

func (ts *Service) DoPluginAction(ctx context.Context, task *tes.Task, taskType proto.Type) (*proto.JobResponse, error)

LoadPlugins loads plugins for a task.

func (*Service) GetServiceInfo

func (ts *Service) GetServiceInfo(ctx context.Context, info *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)

GetServiceInfo returns service metadata.

func (*Service) GetTask

func (ts *Service) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask calls GetTask on the underlying tes.ReadOnlyServer. If the underlying server returns tes.ErrNotFound, Service will handle returning the appropriate gRPC error.

func (*Service) HandleDoPluginAction

func (ts *Service) HandleDoPluginAction(ctx context.Context, task *tes.Task, taskType proto.Type) (*proto.JobResponse, error)

func (*Service) ListTasks

func (ts *Service) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks calls ListTasks on the underlying tes.ReadOnlyServer.

Jump to

Keyboard shortcuts

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