Description:"Builds a stackable unification remote, which can appear to merge the contents of several remotes",
NewFs:NewFs,
Options:[]fs.Option{{
Name:"remotes",
Help:"List of space separated remotes.\nCan be 'remotea:test/dir remoteb:', '\"remotea:test/space dir\" remoteb:', etc.\nThe last remote is used to write to.",
Required:true,
}},
}
fs.Register(fsi)
}
// Options defines the configuration for this backend
typeOptionsstruct{
Remotesfs.SpaceSepList`config:"remotes"`
}
// Fs represents a remote acd server
typeFsstruct{
namestring// name of this remote
features*fs.Features// optional features
optOptions// options for this Fs
rootstring// the path we are working on
remotes[]fs.Fs// slice of remotes
}
// Name of the remote (as passed into NewFs)
func(f*Fs)Name()string{
returnf.name
}
// Root of the remote (as passed into NewFs)
func(f*Fs)Root()string{
returnf.root
}
// String converts this Fs to a string
func(f*Fs)String()string{
returnfmt.Sprintf("union root '%s'",f.root)
}
// Features returns the optional features of this Fs
func(f*Fs)Features()*fs.Features{
returnf.features
}
// Rmdir removes the root directory of the Fs object
func(f*Fs)Rmdir(dirstring)error{
returnf.remotes[len(f.remotes)-1].Rmdir(dir)
}
// Hashes returns hash.HashNone to indicate remote hashing is unavailable
func(f*Fs)Hashes()hash.Set{
// This could probably be set if all remotes share the same hashing algorithm
returnhash.Set(hash.None)
}
// Mkdir makes the root directory of the Fs object
func(f*Fs)Mkdir(dirstring)error{
returnf.remotes[len(f.remotes)-1].Mkdir(dir)
}
// Put in to the remote path with the modTime given of the given size
//
// May create the object even if it returns an error - if so
// will return the object and the error, otherwise will return