files

package
v0.0.0-...-1d573b9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeMetadata

func DecodeMetadata(metadata string) (map[string]string, error)

func EncodeMetadata

func EncodeMetadata(metadata map[string]string) string

Types

type File

type File struct {
	ID                string
	CreatedAt         time.Time
	OriginalURL       string
	OriginalExpiresAt null.Time
	ExpiresAt         null.Time
	Size              int
	Hash              null.String
	ContentType       null.String
	Metadata          map[string]string
}

func (*File) Download

func (f *File) Download(fm *FileManager) (downloadFileResult, error)

type FileManager

type FileManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFileManager

func NewFileManager(db *db.Database, sftp *sftp.SFTPClient) *FileManager

func (*FileManager) GetFile

func (fm *FileManager) GetFile(id string) (*File, error)

func (*FileManager) ProcessFile

func (fm *FileManager) ProcessFile(req FileProcessRequest) *FileQueueEntry

func (*FileManager) StartWorkers

func (fm *FileManager) StartWorkers()

func (*FileManager) StopWorkers

func (fm *FileManager) StopWorkers()

func (*FileManager) WaitForFile

func (fm *FileManager) WaitForFile(id string)

type FileProcessRequest

type FileProcessRequest struct {
	OriginalURL       string
	OriginalExpiresAt null.Time
	ExpiresAt         null.Time         `json:"expires_at"`
	Size              null.Int          `json:"size"`
	MaxSize           null.Int          `json:"max_size"`
	Metadata          map[string]string `json:"metadata"`
}

type FileQueueEntry

type FileQueueEntry struct {
	ID                string
	OriginalURL       string
	OriginalExpiresAt null.Time
	ExpiresAt         null.Time
	Size              null.Int
	MaxSize           null.Int
	Metadata          map[string]string

	Done chan struct{}
}

Jump to

Keyboard shortcuts

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