io

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyRecursive

func CopyRecursive(fs afero.Fs, dst string, src string, fileMode os.FileMode, dirMode os.FileMode) error

CopyRecursive copies the contents of the src directory to the dst directory, recursively. Equivilant to to `cp -R src dst`

Types

type TransactionWriter

type TransactionWriter struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

TransactionWriter implements a tranasactional, file-backed io.WriteCloser. Calls to Write() are captured in a temporary file, which will replace the target file path only upon Commit().

func NewTransactionWriter

func NewTransactionWriter(fs afero.Fs, path string) (*TransactionWriter, error)

NewTransactionWriter returns a TransactionWriter implementing io.WritCloser. The caller is responsible for calling either Abort() or Commit(). If Commit() is not called, the target file is not created/replaced.

func (*TransactionWriter) Abort

func (tw *TransactionWriter) Abort() error

Abort aborts an in-progress transaction and cleans up any temporary files. This method is safe to call multiple times. Not currently thread-safe.

func (*TransactionWriter) Commit

func (tw *TransactionWriter) Commit() error

Commit commits an in-progress transaction and cleans up any temporary files. This method is safe to call multiple times. Not currently thread-safe.

Jump to

Keyboard shortcuts

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