system

package
v0.1.0-a667989 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUUID

func GenerateUUID() string

func NewDetachedContext

func NewDetachedContext(parent context.Context) context.Context

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.

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.

Jump to

Keyboard shortcuts

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