filestore

package
v0.0.0-...-ed43dd5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 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

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

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

type Timeout

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

Timeout is a file system with a maximun TTL

func (*Timeout) Add

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

func (*Timeout) Get

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

func (*Timeout) Len

func (t *Timeout) Len() int

func (*Timeout) Less

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

func (*Timeout) New

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

func (*Timeout) Pop

func (t *Timeout) Pop() interface{}

func (*Timeout) Push

func (t *Timeout) Push(x interface{})

func (*Timeout) Remove

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

func (*Timeout) Swap

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