add sftpfs storage backend

Fixes #224
This commit is contained in:
Nicola Murino
2020-12-12 10:31:09 +01:00
parent 4d5494912d
commit a6985075b9
43 changed files with 3556 additions and 1767 deletions

View File

@@ -31,7 +31,7 @@ import (
type S3Fs struct {
connectionID string
localTempDir string
config S3FsConfig
config *S3FsConfig
svc *s3.S3
ctxTimeout time.Duration
ctxLongTimeout time.Duration
@@ -47,11 +47,11 @@ func NewS3Fs(connectionID, localTempDir string, config S3FsConfig) (Fs, error) {
fs := &S3Fs{
connectionID: connectionID,
localTempDir: localTempDir,
config: config,
config: &config,
ctxTimeout: 30 * time.Second,
ctxLongTimeout: 300 * time.Second,
}
if err := ValidateS3FsConfig(&fs.config); err != nil {
if err := fs.config.Validate(); err != nil {
return fs, err
}
awsConfig := aws.NewConfig()
@@ -542,7 +542,7 @@ func (fs *S3Fs) GetRelativePath(name string) string {
if rel == "." {
rel = ""
}
if !strings.HasPrefix(rel, "/") {
if !path.IsAbs(rel) {
return "/" + rel
}
if fs.config.KeyPrefix != "" {
@@ -697,3 +697,8 @@ func (fs *S3Fs) GetMimeType(name string) (string, error) {
}
return *obj.ContentType, err
}
// Close closes the fs
func (*S3Fs) Close() error {
return nil
}