Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerRegistry ¶
type HandlerRegistry struct {
// contains filtered or unexported fields
}
HandlerRegistry manages handlers for all supported major job run versions.
func NewHandlerRegistry ¶
func NewHandlerRegistry(majorVersionToHandlers map[uint64]TaskHandler) *HandlerRegistry
NewHandlerRegistry creates a new HandlerRegistry using the given major job run version to handler mappings. If the given map does not contain every supported major job run version, the function will perform a fatal log operation.
func (*HandlerRegistry) HandlerForTaskReqMsg ¶
func (h *HandlerRegistry) HandlerForTaskReqMsg(taskReqMsg *taskpb.TaskReqMsg) (TaskHandler, *common.AgentError)
HandlerForTaskReqMsg gets the appropriate handler for the given task request message. If the handler registry is unable to parse the job run version contained in the taskReqMsg or the registry does not contain the proper handler, an AgentError is returned.
type TaskHandler ¶
type TaskHandler interface { // Do handles the TaskReqMsg and returns a TaskRespMsg. Do(ctx context.Context, taskReqMsg *taskpb.TaskReqMsg, reqStart time.Time) *taskpb.TaskRespMsg }
TaskHandler is an interface to handle different task types.
type TaskProcessor ¶
type TaskProcessor struct { TaskSub *pubsub.Subscription ProgressTopic *pubsub.Topic Handlers *HandlerRegistry StatsTracker *stats.Tracker }
TaskProcessor processes tasks of a certain type. It listens to subscription TaskSub, delegates to the Handler to do the work, and send progress messages to ProgressTopic.
func NewCopyProcessor ¶
func NewCopyProcessor(sc *storage.Client, hc *http.Client, sub *pubsub.Subscription, topic *pubsub.Topic, st *stats.Tracker) *TaskProcessor
NewCopyProcessor returns a TaskProcessor for handling Copy tasks. Run the Process func on the newly returned TaskProcessor to begin processing tasks.
func NewListProcessor ¶
func NewListProcessor(sc *storage.Client, sub *pubsub.Subscription, topic *pubsub.Topic, st *stats.Tracker) *TaskProcessor
NewListProcessor returns a TaskProcessor for handling List tasks. Run the Process func on the newly returned TaskProcessor to begin processing tasks.
func (*TaskProcessor) Process ¶
func (tp *TaskProcessor) Process(ctx context.Context)
Process handles taskReqMsgs sent by the DCP for the given PubSub subscription and handler. This is a blocking function.