Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(357)

Unified Diff: environs/filestorage/filestorage.go

Issue 13632056: Reduce unnecessary s3 timeouts (Closed)
Patch Set: Reduce unnecessary s3 timeouts Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: environs/filestorage/filestorage.go
=== modified file 'environs/filestorage/filestorage.go'
--- environs/filestorage/filestorage.go 2013-09-12 05:04:40 +0000
+++ environs/filestorage/filestorage.go 2013-09-18 07:13:09 +0000
@@ -11,7 +11,7 @@
"path/filepath"
"sort"
- "launchpad.net/juju-core/environs"
+ "launchpad.net/juju-core/environs/storage"
"launchpad.net/juju-core/utils"
)
@@ -23,7 +23,7 @@
// newFileStorageReader returns a new storage reader for
// a directory inside the local file system.
-func NewFileStorageReader(path string) (environs.StorageReader, error) {
+func NewFileStorageReader(path string) (storage.StorageReader, error) {
p := filepath.Clean(path)
fi, err := os.Stat(p)
if err != nil {
@@ -39,7 +39,7 @@
return filepath.Join(f.path, name)
}
-// Get implements environs.StorageReader.Get.
+// Get implements storage.StorageReader.Get.
func (f *fileStorageReader) Get(name string) (io.ReadCloser, error) {
filename := f.fullPath(name)
file, err := os.Open(filename)
@@ -49,7 +49,7 @@
return file, nil
}
-// List implements environs.StorageReader.List.
+// List implements storage.StorageReader.List.
func (f *fileStorageReader) List(prefix string) ([]string, error) {
// Add one for the missing path separator.
pathlen := len(f.path) + 1
@@ -73,21 +73,26 @@
return list, nil
}
-// URL implements environs.StorageReader.URL.
+// URL implements storage.StorageReader.URL.
func (f *fileStorageReader) URL(name string) (string, error) {
return "file://" + filepath.Join(f.path, name), nil
}
-// ConsistencyStrategy implements environs.StorageReader.ConsistencyStrategy.
-func (f *fileStorageReader) ConsistencyStrategy() utils.AttemptStrategy {
+// ConsistencyStrategy implements storage.StorageReader.ConsistencyStrategy.
+func (f *fileStorageReader) DefaultConsistencyStrategy() utils.AttemptStrategy {
return utils.AttemptStrategy{}
}
+// ShouldRetry is specified in the StorageReader interface.
+func (f *fileStorageReader) ShouldRetry(err error) bool {
+ return false
+}
+
type fileStorageWriter struct {
fileStorageReader
}
-func NewFileStorageWriter(path string) (environs.Storage, error) {
+func NewFileStorageWriter(path string) (storage.Storage, error) {
reader, err := NewFileStorageReader(path)
if err != nil {
return nil, err
@@ -114,5 +119,5 @@
}
func (f *fileStorageWriter) RemoveAll() error {
- return environs.RemoveAll(f)
+ return storage.RemoveAll(f)
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b