rollback

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package rollback provides a friendly interface for rolling back partial state when parent tasks fail.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rollback

type Rollback struct {
	// contains filtered or unexported fields
}

Rollback wraps a deferred cleanup task that can be cancelled if the parent task succeeds.

func New

func New(runnable func()) *Rollback

New creates a new Rollback with code to be run to cleanup a dirty state.

func (*Rollback) Done

func (r *Rollback) Done()

Done should be deferred immediately after creating a Rollback. It will run the cleanup task if the parent task fails to call OK.

func (*Rollback) OK

func (r *Rollback) OK()

OK should be called when the parent task succeeds. It will prevent the cleanup task from running.

Jump to

Keyboard shortcuts

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