Skip to content

Commit

Permalink
new(events): add sleep to the helper interface
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
  • Loading branch information
leogr committed Apr 14, 2020
1 parent 16cddc2 commit a2a6f8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions events/interfaces.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package events

import (
"time"

logger "github.com/sirupsen/logrus"
"k8s.io/cli-runtime/pkg/resource"
)
Expand All @@ -12,14 +14,17 @@ type Helper interface {
// that already contains default fields for the current action.
Log() *logger.Entry

// Sleep pauses the current goroutine for at least the given duration and logs that.
Sleep(time.Duration)

// Cleanup registers a function to be called when the action complete or later.
// Cleanup functions registered from within the same action will be called in last added,
// first called order.
Cleanup(f func(), args ...interface{})

// SpawnAs respawns the process as name and run another action.
// An action cannot spawn itself to avoid an infinite loop.
SpawnAs(name string, action string) error
// An action must not spawn itself to avoid an infinite loop.
SpawnAs(name string, action string, args ...string) error

// ResourceBuilder returns a k8s' resource.Builder.
ResourceBuilder() *resource.Builder
Expand Down

0 comments on commit a2a6f8c

Please sign in to comment.