filestore

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 10 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 string, content []byte) (string, error) // Add creates a file with name & content 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
}

FileStore defines interface to store file

func NewFileLocalStore

func NewFileLocalStore(dir string) FileStore

NewFileLocalStore create new local file store

func NewFileMemoryStore

func NewFileMemoryStore() FileStore

NewFileMemoryStore create new memory 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 maximun 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 maximun TTL

func (*Timeout) Add added in v1.1.6

func (t *Timeout) Add(name string, content []byte) (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) Pop added in v1.1.6

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

func (*Timeout) Push added in v1.1.6

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

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