Implement Hubic storage system - fixes #200

This commit is contained in:
Nick Craig-Wood 2015-11-08 15:29:58 +00:00
parent 5023050d95
commit fcea3777c0
14 changed files with 469 additions and 8 deletions

View file

@ -159,16 +159,13 @@ func swiftConnection(name string) (*swift.Connection, error) {
return c, nil
}
// NewFs contstructs an Fs from the path, container:path
func NewFs(name, root string) (fs.Fs, error) {
// NewFsWithConnection contstructs an Fs from the path, container:path
// and authenticated connection
func NewFsWithConnection(name, root string, c *swift.Connection) (fs.Fs, error) {
container, directory, err := parsePath(root)
if err != nil {
return nil, err
}
c, err := swiftConnection(name)
if err != nil {
return nil, err
}
f := &Fs{
name: name,
c: *c,
@ -196,6 +193,15 @@ func NewFs(name, root string) (fs.Fs, error) {
return f, nil
}
// NewFs contstructs an Fs from the path, container:path
func NewFs(name, root string) (fs.Fs, error) {
c, err := swiftConnection(name)
if err != nil {
return nil, err
}
return NewFsWithConnection(name, root, c)
}
// Return an FsObject from a path
//
// May return nil if an error occurred