Documentation ¶
Index ¶
- func Debug(service Service, title string, data interface{})
- func DumpObject(d interface{})
- func DumpObjectDebug(d interface{})
- func DumpObjectInfo(d interface{})
- func EnsureDataDir(path string) (string, error)
- func Error(service Service, title string, err error)
- func ExpandTarBuffer(buf *bytes.Buffer, localPath string) error
- func GetDataDir(path string) string
- func GetServiceBadge(service Service) string
- func GetServiceString(service Service, st string) string
- func GetTarBuffer(localPath string) (*bytes.Buffer, error)
- func Info(service Service, title string, data interface{})
- func NewDetachedContext(parent context.Context) context.Context
- func RunCommand(name string, args []string, workingDir string) error
- func SetupLogging()
- func Trace(service Service, title string, data interface{})
- func WriteFile(path string, data []byte) error
- type CleanupManager
- type CommandContext
- type ControlLoop
- type Service
- type ServiceLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpObject ¶
func DumpObject(d interface{})
func DumpObjectDebug ¶
func DumpObjectDebug(d interface{})
func DumpObjectInfo ¶
func DumpObjectInfo(d interface{})
func EnsureDataDir ¶
func GetDataDir ¶
func GetServiceBadge ¶
func GetServiceString ¶
func NewDetachedContext ¶
NewDetachedContext produces a new context that has a separate cancellation mechanism from its parent. This should be used when having to continue using a context after it has been canceled, such as cleaning up Docker resources after the context has been canceled but want to keep work associated with the same trace.
func SetupLogging ¶
func SetupLogging()
Types ¶
type CleanupManager ¶
type CleanupManager struct {
// contains filtered or unexported fields
}
CleanupManager provides utilities for ensuring that sub-goroutines can clean up their resources before the main goroutine exits. Can be used to register callbacks for long-running system processes.
func NewCleanupManager ¶
func NewCleanupManager() *CleanupManager
NewCleanupManager returns a new CleanupManager instance.
func (*CleanupManager) Cleanup ¶
func (cm *CleanupManager) Cleanup(ctx context.Context)
Cleanup runs all registered clean-up functions in sub-goroutines and waits for them all to complete before exiting.
func (*CleanupManager) RegisterCallback ¶
func (cm *CleanupManager) RegisterCallback(fn cleanUpWithoutContext)
RegisterCallback registers a clean-up function.
func (*CleanupManager) RegisterCallbackWithContext ¶
func (cm *CleanupManager) RegisterCallbackWithContext(fn cleanUpWithContext)
RegisterCallbackWithContext registers a clean-up function. The context passed is guaranteed not to be already canceled.
type CommandContext ¶
type CommandContext struct { CommandContext context.Context Ctx context.Context Cm *CleanupManager CancelFunc context.CancelFunc }
func NewCommandContext ¶
func NewCommandContext(cmd *cobra.Command) *CommandContext
func NewSystemContext ¶
func NewSystemContext(ctx context.Context) *CommandContext
func NewTestingContext ¶
func NewTestingContext() *CommandContext
func (*CommandContext) Cleanup ¶
func (cmdContext *CommandContext) Cleanup()
type ControlLoop ¶
type ControlLoop struct {
// contains filtered or unexported fields
}
func NewControlLoop ¶
func (*ControlLoop) Start ¶
func (loop *ControlLoop) Start(runInitially bool) error
func (*ControlLoop) Trigger ¶
func (loop *ControlLoop) Trigger()
type ServiceLogger ¶
type ServiceLogger struct {
// contains filtered or unexported fields
}
func NewServiceLogger ¶
func NewServiceLogger(service Service) *ServiceLogger
func (*ServiceLogger) Debug ¶
func (s *ServiceLogger) Debug(title string, data interface{})
func (*ServiceLogger) Error ¶
func (s *ServiceLogger) Error(title string, err error)
func (*ServiceLogger) Info ¶
func (s *ServiceLogger) Info(title string, data interface{})
func (*ServiceLogger) Trace ¶
func (s *ServiceLogger) Trace(title string, data interface{})