Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSomethingWentWrong = errors.New("Something went wrong") ErrWrongTokenFormat = errors.New("Wrong token format") ErrFileNotFound = errors.New("file not found") ErrWrongFileType = errors.New("wrong file type") ErrNoSpaceLeft = errors.New("no space left in storage") ErrProcessError = errors.New("ProcessFile error") )
Functions ¶
This section is empty.
Types ¶
type BackgroundService ¶
type BackgroundService interface { ProcessTicker(ctx context.Context, wg *sync.WaitGroup, duration time.Duration) ProcessFile(ctx context.Context, file File) error }
func NewBackGroundService ¶
func NewBackGroundService(storage Storage, repo Repository) BackgroundService
type Repository ¶
type Repository interface { Add(ctx context.Context, file *File) error SetProgress(ctx context.Context, fileId string, progress Progress) error GetInfo(ctx context.Context, fileId string) (*File, error) GetFilesToProcess(ctx context.Context) ([]File, error) QueueFiles(ctx context.Context, counter int64) ([]File, error) Close() error }
type Service ¶
type Service interface { Store(ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) (*File, error) Status(ctx context.Context, fileId string) (*StatusData, error) Find(ctx context.Context, fileId string) (*DownloadData, error) }
func NewNoiseRemoverService ¶
func NewNoiseRemoverService(storage Storage, repo Repository) Service
type StatusData ¶
type StatusData struct { FileId string UploadedName string Progress Progress // constants for template ProgressNew Progress ProgressInProgress Progress ProgressCompleted Progress ProgressErrorEncountered Progress }
func NewStatusData ¶
func NewStatusData(fileId, uploadedName string, progress Progress) *StatusData
type Storage ¶
type Storage interface { IsEnoughSpaceLeft() (bool, error) Store(file multipart.File) (fileName string, err error) Find(fileName string) (*DownloadData, error) OpenFileUpFolder(filename string) (*os.File, error) RemoveFileUpFolder(filename string) error CreateFileReadyFolder(filename string) (*os.File, error) OpenFileReadyFolder(filename string) (*os.File, error) RemoveFileReadyFolder(filename string) error }
Click to show internal directories.
Click to hide internal directories.