filestore

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore interface {
	Add(name, path string) (string, error) // Add creates a file with path to the storage, returns id
	Remove(string) bool                    // Remove deletes a file by id
	Get(string) (string, envexec.File)     // Get file by id, nil if not exists
	List() map[string]string               // List return all file ids to original name
	New() (*os.File, error)                // Create a temporary file to the file store, can be added through Add to save it
}

FileStore defines interface to store file

func NewFileLocalStore

func NewFileLocalStore(dir string) FileStore

NewFileLocalStore create new local file store

func NewTimeout added in v1.1.6

func NewTimeout(fs FileStore, timeout time.Duration, checkInterval time.Duration) FileStore

NewTimeout creates a timeout file system with maximum TTL for a file

type Timeout added in v1.1.6

type Timeout struct {
	FileStore
	// contains filtered or unexported fields
}

Timeout is a file system with a maximum TTL

func (*Timeout) Add added in v1.1.6

func (t *Timeout) Add(name, path string) (string, error)

func (*Timeout) Get added in v1.1.6

func (t *Timeout) Get(id string) (string, envexec.File)

func (*Timeout) Len added in v1.1.6

func (t *Timeout) Len() int

func (*Timeout) Less added in v1.1.6

func (t *Timeout) Less(i, j int) bool

func (*Timeout) New added in v1.3.0

func (t *Timeout) New() (*os.File, error)

func (*Timeout) Pop added in v1.1.6

func (t *Timeout) Pop() any

func (*Timeout) Push added in v1.1.6

func (t *Timeout) Push(x any)

func (*Timeout) Remove added in v1.1.6

func (t *Timeout) Remove(id string) bool

func (*Timeout) Swap added in v1.1.6

func (t *Timeout) Swap(i, j int)

Jump to

Keyboard shortcuts

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