...

Source file src/sigs.k8s.io/cli-utils/pkg/apply/task/send_event_task.go

Documentation: sigs.k8s.io/cli-utils/pkg/apply/task

     1  // Copyright 2020 The Kubernetes Authors.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package task
     5  
     6  import (
     7  	"sigs.k8s.io/cli-utils/pkg/apply/event"
     8  	"sigs.k8s.io/cli-utils/pkg/apply/taskrunner"
     9  )
    10  
    11  // SendEventTask is an implementation of the Task interface
    12  // that will send the provided event on the eventChannel when
    13  // executed.
    14  type SendEventTask struct {
    15  	Event event.Event
    16  }
    17  
    18  // Start start a separate goroutine that will send the
    19  // event and then push a TaskResult on the taskChannel to
    20  // signal to the taskrunner that the task is completed.
    21  func (s *SendEventTask) Start(taskContext *taskrunner.TaskContext) {
    22  	go func() {
    23  		taskContext.SendEvent(s.Event)
    24  		taskContext.TaskChannel() <- taskrunner.TaskResult{}
    25  	}()
    26  }
    27  
    28  // ClearTimeout doesn't do anything as SendEventTask doesn't support
    29  // timeouts.
    30  func (s *SendEventTask) ClearTimeout() {}
    31  

View as plain text