Compare commits

...
8 Commits
Author SHA1 Message Date
Nick Craig-Wood cfdb48c864 Version v1.07 2014-12-23 11:26:32 +00:00
Nick Craig-Wood 14567952b3 google cloud storage: Fix memory leak - fixes #17
This was the same problem as issue #5 (which affected google drive)
2014-12-23 11:03:34 +00:00
Nick Craig-Wood 2b052671e2 swift: Add docs for tentant 2014-12-12 20:38:35 +00:00
Nick Craig-Wood 439a126af6 Version v1.06 2014-12-12 20:13:03 +00:00
Nick Craig-Wood 0fb35f081a Use new location of Google API package - fixes #16 2014-12-12 20:02:08 +00:00
Nick Craig-Wood 9ba25c7219 Test with go 1.4 too 2014-12-12 19:27:14 +00:00
Nick Craig-Wood af9c447146 Fix "Couldn't find home directory" on OSX - fixes #15 2014-12-12 19:18:23 +00:00
Nick Craig-Wood ee6b39aa6c Add tenant parameter for swift - fixes #13 2014-12-12 15:26:08 +00:00
10 changed files with 97 additions and 56 deletions

No files matched your search

+2 -1
View File
@@ -3,7 +3,8 @@ language: go
go:
- 1.1.2
- 1.2.2
- 1.3
- 1.3.3
- 1.4
- tip
script:
+6
View File
@@ -261,6 +261,12 @@ Bugs
Changelog
---------
* v1.07 - 2014-12-23
* google cloud storage: fix memory leak
* v1.06 - 2014-12-12
* Fix "Couldn't find home directory" on OSX
* swift: Add tenant parameter
* Use new location of Google API packages
* v1.05 - 2014-08-09
* Improved tests and consequently lots of minor fixes
* core: Fix race detected by go race detector
+18 -18
View File
@@ -2,34 +2,34 @@
title: "Rclone downloads"
description: "Download rclone binaries for your OS."
type: page
date: "2014-08-09"
date: "2014-12-23"
---
Rclone Download v1.05
Rclone Download v1.07
=====================
* Windows
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-windows-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-windows-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-windows-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-windows-amd64.zip)
* OSX
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-osx-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-osx-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-osx-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-osx-amd64.zip)
* Linux
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-linux-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-linux-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.05-linux-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-linux-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-linux-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.07-linux-arm.zip)
* FreeBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-freebsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-freebsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.05-freebsd-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-freebsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-freebsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.07-freebsd-arm.zip)
* NetBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-netbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-netbsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.05-netbsd-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-netbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-netbsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.07-netbsd-arm.zip)
* OpenBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-openbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.05-openbsd-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-openbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.07-openbsd-amd64.zip)
* Plan 9
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.05-plan9-386.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.07-plan9-386.zip)
Older downloads can be found [here](http://downloads.rclone.org/)
+3
View File
@@ -52,12 +52,15 @@ Choose a number from below, or type in your own value
* Memset Memstore UK v2
5) https://auth.storage.memset.com/v2.0
auth> 1
Tenant name - optional
tenant>
Remote config
--------------------
[remote]
user = user_name
key = password_or_api_key
auth = https://auth.api.rackspacecloud.com/v1.0
tenant =
--------------------
y) Yes this is OK
e) Edit this remote
+4 -28
View File
@@ -21,13 +21,13 @@ import (
"log"
"mime"
"net/http"
"os"
"path"
"strings"
"sync"
"time"
"code.google.com/p/google-api-go-client/drive/v2"
"google.golang.org/api/drive/v2"
"github.com/ncw/rclone/fs"
"github.com/ncw/rclone/googleauth"
"github.com/ogier/pflag"
@@ -602,30 +602,6 @@ func (f *FsDrive) ListDir() fs.DirChan {
return out
}
// seekWrapper wraps an io.Reader with a basic Seek for
// code.google.com/p/google-api-go-client/googleapi
// to detect the length (see getReaderSize function)
type seekWrapper struct {
in io.Reader
size int64
}
// Read bytes from the object - see io.Reader
func (file *seekWrapper) Read(p []byte) (n int, err error) {
return file.in.Read(p)
}
// Seek - minimal implementation for Google Drive's length detection
func (file *seekWrapper) Seek(offset int64, whence int) (int64, error) {
switch whence {
case os.SEEK_CUR:
return 0, nil
case os.SEEK_END:
return file.size, nil
}
return 0, nil
}
// Put the object
//
// This assumes that the object doesn't not already exists - if you
@@ -662,7 +638,7 @@ func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64
}
// Make the API request to upload metadata and file data.
in = &seekWrapper{in: in, size: size}
in = &fs.SeekWrapper{In: in, Size: size}
info, err = f.svc.Files.Insert(info).Media(in).Do()
if err != nil {
return o, fmt.Errorf("Upload failed: %s", err)
@@ -871,7 +847,7 @@ func (o *FsObjectDrive) Update(in io.Reader, modTime time.Time, size int64) erro
}
// Make the API request to upload metadata and file data.
in = &seekWrapper{in: in, size: size}
in = &fs.SeekWrapper{In: in, Size: size}
info, err := o.drive.svc.Files.Update(info.Id, info).SetModifiedDate(true).Media(in).Do()
if err != nil {
return fmt.Errorf("Update failed: %s", err)
+14 -4
View File
@@ -56,11 +56,21 @@ type ConfigInfo struct {
func configHome() string {
// Find users home directory
usr, err := user.Current()
if err != nil {
log.Printf("Couldn't find home directory: %v", err)
return ""
if err == nil {
return usr.HomeDir
}
return usr.HomeDir
// Fall back to reading $HOME - work around user.Current() not
// working for cross compiled binaries on OSX.
// https://github.com/golang/go/issues/6376
home := os.Getenv("HOME")
if home != "" {
return home
}
log.Printf("Couldn't find home directory or read HOME environment variable.")
log.Printf("Defaulting to storing config in current directory.")
log.Printf("Use -config flag to workaround.")
log.Printf("Error was: %v", err)
return ""
}
// Loads the config file
+39
View File
@@ -0,0 +1,39 @@
package fs
import (
"io"
"os"
)
// SeekWrapper wraps an io.Reader with a basic Seek method which
// returns the Size attribute.
//
// This is used for google.golang.org/api/googleapi/googleapi.go
// to detect the length (see getReaderSize function)
//
// Without this the getReaderSize function reads the entire file into
// memory to find its length.
type SeekWrapper struct {
In io.Reader
Size int64
}
// Read bytes from the object - see io.Reader
func (file *SeekWrapper) Read(p []byte) (n int, err error) {
return file.In.Read(p)
}
// Seek - minimal implementation for Google API length detection
func (file *SeekWrapper) Seek(offset int64, whence int) (int64, error) {
switch whence {
case os.SEEK_CUR:
return 0, nil
case os.SEEK_END:
return file.Size, nil
}
return 0, nil
}
// Interfaces that SeekWrapper implements
var _ io.Reader = (*SeekWrapper)(nil)
var _ io.Seeker = (*SeekWrapper)(nil)
+1 -1
View File
@@ -1,3 +1,3 @@
package fs
const Version = "v1.05"
const Version = "v1.07"
+6 -4
View File
@@ -24,8 +24,8 @@ import (
"strings"
"time"
"code.google.com/p/google-api-go-client/googleapi"
"code.google.com/p/google-api-go-client/storage/v1"
"google.golang.org/api/googleapi"
"google.golang.org/api/storage/v1"
"github.com/ncw/rclone/fs"
"github.com/ncw/rclone/googleauth"
@@ -359,8 +359,9 @@ func (f *FsStorage) ListDir() fs.DirChan {
// The new object may have been created if an error is returned
func (f *FsStorage) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs.Object, error) {
// Temporary FsObject under construction
fs := &FsObjectStorage{storage: f, remote: remote}
return fs, fs.Update(in, modTime, size)
o := &FsObjectStorage{storage: f, remote: remote}
in = &fs.SeekWrapper{In: in, Size: size}
return o, o.Update(in, modTime, size)
}
// Mkdir creates the bucket if it doesn't exist
@@ -562,6 +563,7 @@ func (o *FsObjectStorage) Update(in io.Reader, modTime time.Time, size int64) er
Updated: modTime.Format(timeFormatOut), // Doesn't get set
Metadata: metadataFromModTime(modTime),
}
in = &fs.SeekWrapper{In: in, Size: size}
newObject, err := o.storage.svc.Objects.Insert(o.storage.bucket, &object).Media(in).Name(object.Name).PredefinedAcl(o.storage.objectAcl).Do()
if err != nil {
return err
+4
View File
@@ -44,6 +44,9 @@ func init() {
Help: "Memset Memstore UK v2",
Value: "https://auth.storage.memset.com/v2.0",
}},
}, {
Name: "tenant",
Help: "Tenant name - optional",
},
// snet = flag.Bool("swift-snet", false, "Use internal service network") // FIXME not implemented
},
@@ -111,6 +114,7 @@ func swiftConnection(name string) (*swift.Connection, error) {
ApiKey: apiKey,
AuthUrl: authUrl,
UserAgent: fs.UserAgent,
Tenant: fs.ConfigFile.MustValue(name, "tenant"),
}
err := c.Authenticate()
if err != nil {