Incorporated PR feedback; call S3 for IsFastListing() #322

This commit is contained in:
Mark Feit
2018-01-18 08:34:33 -05:00
parent 8aaca37a2b
commit b52d6b3f7f

View File

@@ -32,6 +32,7 @@ type WasabiStorage struct {
storageDir string storageDir string
key string key string
secret string secret string
client *http.Client
} }
// See the Storage interface in duplicacy_storage.go for function // See the Storage interface in duplicacy_storage.go for function
@@ -66,6 +67,7 @@ func CreateWasabiStorage(
storageDir: storageDir, storageDir: storageDir,
key: accessKey, key: accessKey,
secret: secretKey, secret: secretKey,
client: &http.Client{},
} }
wasabi.DerivedStorage = wasabi wasabi.DerivedStorage = wasabi
@@ -129,12 +131,11 @@ func (storage *WasabiStorage) MoveFile(
request.Header.Add("Host", storage.endpoint) request.Header.Add("Host", storage.endpoint)
request.Header.Add("Overwrite", "true") request.Header.Add("Overwrite", "true")
client := &http.Client{} response, error := storage.client.Do(request)
response, error := client.Do(request)
if error != nil { if error != nil {
return error return error
} }
defer response.Body.Close()
if response.StatusCode != 200 { if response.StatusCode != 200 {
return errors.New(response.Status) return errors.New(response.Status)
@@ -182,7 +183,7 @@ func (storage *WasabiStorage) IsStrongConsistent() bool {
} }
func (storage *WasabiStorage) IsFastListing() bool { func (storage *WasabiStorage) IsFastListing() bool {
return true return storage.s3.IsFastListing()
} }
func (storage *WasabiStorage) EnableTestMode() { func (storage *WasabiStorage) EnableTestMode() {