atomicfile

package
v0.0.0-...-5a61b9d Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package atomicfile defines file operations for safely writing files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveFile

func SaveFile(ctx context.Context, o Object, t File) error

SaveFile downloads object data and saves it to the given temp file.

Types

type File

type File interface {
	// Name returns the file name.
	Name() string
	// Create allocates a new safefile.File that writes to a temporary file.
	Create(perm os.FileMode) (*safefile.File, error)
	// Commit closes the underlying temporary file and renames it to the File.Name().
	Commit() error
}

A File abstracts operations on a temporary file.

func New

func New(filename string) File

New creates a new temporary File.

type Object

type Object interface {
	// Name returns the Object name.
	ObjectName() string
	// Copy writes the Object data to the given writer.
	Copy(ctx context.Context, w io.Writer) error
}

Object abstracts a data source.

Jump to

Keyboard shortcuts

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