tempdir

package
v15.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartCleaning

func StartCleaning(locator storage.Locator, storages []config.Storage, d time.Duration)

StartCleaning starts tempdir cleanup in a goroutine.

Types

type Dir

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

Dir is a storage-scoped temporary directory.

func New

func New(ctx context.Context, storageName string, locator storage.Locator) (Dir, error)

New returns the path of a new temporary directory for the given storage. The directory is removed asynchronously with os.RemoveAll when the context expires.

func NewRepository

func NewRepository(ctx context.Context, storageName string, locator storage.Locator) (*gitalypb.Repository, Dir, error)

NewRepository is the same as New, but it returns a *gitalypb.Repository for the created directory as well as the bare path as a string.

func NewWithPrefix

func NewWithPrefix(ctx context.Context, storageName, prefix string, locator storage.Locator) (Dir, error)

NewWithPrefix returns the path of a new temporary directory for the given storage with a specific prefix used to create the temporary directory's name. The directory is removed asynchronously with os.RemoveAll when the context expires.

func NewWithoutContext

func NewWithoutContext(storageName string, locator storage.Locator) (Dir, error)

NewWithoutContext returns a temporary directory for the given storage suitable which is not storage scoped. The temporary directory will thus not get cleaned up when the context expires, but instead when the temporary directory is older than MaxAge.

func (Dir) Path

func (d Dir) Path() string

Path returns the absolute path of the temporary directory.

func (Dir) WaitForCleanup

func (d Dir) WaitForCleanup()

WaitForCleanup waits until the temporary directory got removed via the asynchronous cleanupOnDone call. This is mainly intended for use in tests.

Jump to

Keyboard shortcuts

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