Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #34

Merged
merged 3 commits into from
Sep 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions filestore/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@ func New(config *config.Config) *Filestore {

// todo implement this
func (f *Filestore) CreateFolder(path, name string) (*types.Response, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
return f.config.Transport.CreateFolder(ctx, f.config.Project, path, name, f.config.Token)
}

func (f *Filestore) DeleteFile(path string, meta interface{}) (*types.Response, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
return f.config.Transport.DeleteFile(ctx, meta, f.config.Project, path, f.config.Token)
}

func (f *Filestore) ListFiles(listWhat, path string) (*types.Response, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()
return f.config.Transport.List(ctx, f.config.Project, listWhat, path, f.config.Token)
}

func (f *Filestore) UploadFile(path, name string, meta interface{}, reader io.Reader) (*types.Response, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()
return f.config.Transport.UploadFile(ctx, f.config.Project, path, name, meta, reader, f.config.Token)
}

func (f *Filestore) DownloadFile(path string, writer io.Writer) error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()
return f.config.Transport.DownloadFile(ctx, f.config.Project, path, writer, f.config.Token)
}

func (f *Filestore) DoesFileOrFolderExists(path string) (*types.Response, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
return f.config.Transport.DoesExists(ctx, f.config.Project, path, f.config.Token)
}