Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateUUID ¶
func GenerateUUID() string
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.
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.