Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Copy(file string) error
	Prune(deadline time.Time, pruningPrefix string) (*PruneStats, error)
	Name() string
}

Backend is an interface for defining functions which all storage providers support.

type Log

type Log func(logType LogLevel, context string, msg string, params ...any)

type LogLevel

type LogLevel int
const (
	LogLevelInfo LogLevel = iota
	LogLevelWarning
)

type PruneStats

type PruneStats struct {
	Total  uint
	Pruned uint
}

PruneStats is a wrapper struct for returning stats after pruning

type StorageBackend

type StorageBackend struct {
	DestinationPath string
	Log             Log
}

StorageBackend is a generic type of storage. Everything here are common properties of all storage types.

func (*StorageBackend) DoPrune

func (b *StorageBackend) DoPrune(context string, lenMatches, lenCandidates int, deadline time.Time, doRemoveFiles func() error) error

DoPrune holds general control flow that applies to any kind of storage. Callers can pass in a thunk that performs the actual deletion of files.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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