mirror of
https://github.com/rclone/rclone.git
synced 2024-11-27 10:50:03 +08:00
194 lines
12 KiB
Go
194 lines
12 KiB
Go
|
// Code generated by vfsgen; DO NOT EDIT.
|
|||
|
|
|||
|
// +build !dev
|
|||
|
|
|||
|
package sharefile
|
|||
|
|
|||
|
import (
|
|||
|
"bytes"
|
|||
|
"compress/gzip"
|
|||
|
"fmt"
|
|||
|
"io"
|
|||
|
"io/ioutil"
|
|||
|
"net/http"
|
|||
|
"os"
|
|||
|
pathpkg "path"
|
|||
|
"time"
|
|||
|
)
|
|||
|
|
|||
|
// tzdata statically implements the virtual filesystem provided to vfsgen.
|
|||
|
var tzdata = func() http.FileSystem {
|
|||
|
fs := vfsgen۰FS{
|
|||
|
"/": &vfsgen۰DirInfo{
|
|||
|
name: "/",
|
|||
|
modTime: time.Date(2019, 9, 12, 14, 55, 27, 600751842, time.UTC),
|
|||
|
},
|
|||
|
"/America": &vfsgen۰DirInfo{
|
|||
|
name: "America",
|
|||
|
modTime: time.Date(2019, 9, 12, 14, 55, 27, 600751842, time.UTC),
|
|||
|
},
|
|||
|
"/America/New_York": &vfsgen۰CompressedFileInfo{
|
|||
|
name: "New_York",
|
|||
|
modTime: time.Date(2019, 7, 2, 0, 44, 57, 0, time.UTC),
|
|||
|
uncompressedSize: 3536,
|
|||
|
|
|||
|
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xd6\x7f\x54\xd5\xf5\x1d\xc7\xf1\xaf\x4a\x6a\x28\xa1\x2b\x9a\xa6\xb1\xa6\xdb\x08\x13\xf0\x47\xe4\x2f\xb6\x68\xc9\x18\xda\x0d\xd3\x4b\x22\x39\xfc\xd4\x20\x0e\xea\xc6\x67\xfd\x20\xdc\x0c\xdb\xb4\x18\x9e\xd3\xdc\x4e\x1e\xd8\x56\xe7\x36\x53\x94\x5c\x44\x0a\x38\xc9\x76\xfd\xc5\xc8\xe3\x8e\xab\xb8\x66\xd8\x8f\xeb\x5b\xa7\x77\x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cc\x4d\x95\x9e\xfb\xfa\xcf\x9f\x31\x13\x0a\x4e\xb9\x89\xcb\x9b\xe5\x1b\x99\x1d\xee\x9b\xf3\x7e\x23\xdf\x4a\xda\xea\x52\x26\x3d\x2c\x29\xd1\x83\x36\x35\xbe\x40\x52\xc3\x0d\x76\xd2\xd9\x19\x72\x4b\xb0\xc6\x4e\x0e\xf9\x4d\x5a\xa0\xdc\xa6\xb7\xdc\x66\x32\xaa\xe7\xdb\x29\xcf\x8c\x31\x53\xcb\xca\xdc\xb4\x87\x2e\x99\xe9\xb9\x79\xee\xd6\x85\xef\x9b\xcc\x94\x5b\xdc\x6d\xd3\x82\x66\xc6\xb0\x04\x37\x73\xdc\xbb\x32\x33\x72\xde\xcd\x1a\x78\x4d\x66\x77\xbe\xe5\xe6\xbc\x17\x90\xac\xe6\x4f\xec\xb7\xf7\x3c\x21\xdf\xd9\xf0\xa6\xbd\xfd\xd9\x07\x24\xbb\x62\xa7\xbd\x63\xdd\x1a\xf3\xdd\xfc\x8d\xf6\xce\x92\xfb\xcd\xdc\x8c\x4a\x9b\x33\xf7\x4e\x93\xd3\xd7\xe8\x72\xd3\x96\x49\x6e\x68\xbd\xcb\x4b\xb8\x43\xf2\x5a\x56\xba\x79\x3d\x13\x65\xfe\x73\xb5\xf6\xae\x63\xd9\xc6\xb7\x7a\x85\xbd\x7b\xd7\x04\x93\xbf\xd4\x67\x17\xd4\xc5\x99\x7b\xb2\x32\xec\xc2\x47\x23\x66\xd1\xf8\xd1\xd6\x5f\x70\xc8\xf8\x07\xfa\xec\xbd\x99\xdb\xcd\xbd\x67\x12\x5d\x61\x72\xa7\x14\x76\xf4\xba\x25\xd1\x46\x29\xda\x12\x72\xf7\x85\xd7\xcb\xd2\x75\x6d\xee\x07\xc1\x95\x52\x5c\x52\xef\x96\x05\xee\x16\xe3\x6b\xb5\xf7\xd7\xac\x30\x0f\xa4\xd5\xd9\x1f\x96\xf9\x4c\x49\x42\x95\x2d\xcd\xcd\x30\xa5\x3d\x45\xb6\x2c\x65\xb4\x29\x3b\x92\x65\xcb\x87\xf6\x99\xf2\xa6\x64\xbb\x3c\xf2\xb6\x59\x51\x37\xdb\xad\x7c\xa3\x57\x7e\x54\x39\xde\xfd\xb8\x39\x24\x15\x05\x51\x67\x37\xb4\xc9\x4f\x32\xc5\x3d\x54\x51\x2f\x0f\x27\x1d\x70\x8f\xe4\xaf\x92\x47\xa2\x27\x6c\xe5\xcc\x3a\x53\x19\xde\x6f\xab\xc6\x54\x99\xaa\xe0\x66\
|
|||
|
},
|
|||
|
}
|
|||
|
fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
|
|||
|
fs["/America"].(os.FileInfo),
|
|||
|
}
|
|||
|
fs["/America"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
|
|||
|
fs["/America/New_York"].(os.FileInfo),
|
|||
|
}
|
|||
|
|
|||
|
return fs
|
|||
|
}()
|
|||
|
|
|||
|
type vfsgen۰FS map[string]interface{}
|
|||
|
|
|||
|
func (fs vfsgen۰FS) Open(path string) (http.File, error) {
|
|||
|
path = pathpkg.Clean("/" + path)
|
|||
|
f, ok := fs[path]
|
|||
|
if !ok {
|
|||
|
return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
|
|||
|
}
|
|||
|
|
|||
|
switch f := f.(type) {
|
|||
|
case *vfsgen۰CompressedFileInfo:
|
|||
|
gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
|
|||
|
if err != nil {
|
|||
|
// This should never happen because we generate the gzip bytes such that they are always valid.
|
|||
|
panic("unexpected error reading own gzip compressed bytes: " + err.Error())
|
|||
|
}
|
|||
|
return &vfsgen۰CompressedFile{
|
|||
|
vfsgen۰CompressedFileInfo: f,
|
|||
|
gr: gr,
|
|||
|
}, nil
|
|||
|
case *vfsgen۰DirInfo:
|
|||
|
return &vfsgen۰Dir{
|
|||
|
vfsgen۰DirInfo: f,
|
|||
|
}, nil
|
|||
|
default:
|
|||
|
// This should never happen because we generate only the above types.
|
|||
|
panic(fmt.Sprintf("unexpected type %T", f))
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
|
|||
|
type vfsgen۰CompressedFileInfo struct {
|
|||
|
name string
|
|||
|
modTime time.Time
|
|||
|
compressedContent []byte
|
|||
|
uncompressedSize int64
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
|
|||
|
return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
|
|||
|
return f.compressedContent
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
|
|||
|
func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
|
|||
|
|
|||
|
// vfsgen۰CompressedFile is an opened compressedFile instance.
|
|||
|
type vfsgen۰CompressedFile struct {
|
|||
|
*vfsgen۰CompressedFileInfo
|
|||
|
gr *gzip.Reader
|
|||
|
grPos int64 // Actual gr uncompressed position.
|
|||
|
seekPos int64 // Seek uncompressed position.
|
|||
|
}
|
|||
|
|
|||
|
func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
|
|||
|
if f.grPos > f.seekPos {
|
|||
|
// Rewind to beginning.
|
|||
|
err = f.gr.Reset(bytes.NewReader(f.compressedContent))
|
|||
|
if err != nil {
|
|||
|
return 0, err
|
|||
|
}
|
|||
|
f.grPos = 0
|
|||
|
}
|
|||
|
if f.grPos < f.seekPos {
|
|||
|
// Fast-forward.
|
|||
|
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
|
|||
|
if err != nil {
|
|||
|
return 0, err
|
|||
|
}
|
|||
|
f.grPos = f.seekPos
|
|||
|
}
|
|||
|
n, err = f.gr.Read(p)
|
|||
|
f.grPos += int64(n)
|
|||
|
f.seekPos = f.grPos
|
|||
|
return n, err
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
|
|||
|
switch whence {
|
|||
|
case io.SeekStart:
|
|||
|
f.seekPos = 0 + offset
|
|||
|
case io.SeekCurrent:
|
|||
|
f.seekPos += offset
|
|||
|
case io.SeekEnd:
|
|||
|
f.seekPos = f.uncompressedSize + offset
|
|||
|
default:
|
|||
|
panic(fmt.Errorf("invalid whence value: %v", whence))
|
|||
|
}
|
|||
|
return f.seekPos, nil
|
|||
|
}
|
|||
|
func (f *vfsgen۰CompressedFile) Close() error {
|
|||
|
return f.gr.Close()
|
|||
|
}
|
|||
|
|
|||
|
// vfsgen۰DirInfo is a static definition of a directory.
|
|||
|
type vfsgen۰DirInfo struct {
|
|||
|
name string
|
|||
|
modTime time.Time
|
|||
|
entries []os.FileInfo
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
|
|||
|
return 0, fmt.Errorf("cannot Read from directory %s", d.name)
|
|||
|
}
|
|||
|
func (d *vfsgen۰DirInfo) Close() error { return nil }
|
|||
|
func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
|
|||
|
|
|||
|
func (d *vfsgen۰DirInfo) Name() string { return d.name }
|
|||
|
func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
|
|||
|
func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
|
|||
|
func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
|
|||
|
func (d *vfsgen۰DirInfo) IsDir() bool { return true }
|
|||
|
func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
|
|||
|
|
|||
|
// vfsgen۰Dir is an opened dir instance.
|
|||
|
type vfsgen۰Dir struct {
|
|||
|
*vfsgen۰DirInfo
|
|||
|
pos int // Position within entries for Seek and Readdir.
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
|
|||
|
if offset == 0 && whence == io.SeekStart {
|
|||
|
d.pos = 0
|
|||
|
return 0, nil
|
|||
|
}
|
|||
|
return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
|
|||
|
}
|
|||
|
|
|||
|
func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
|
|||
|
if d.pos >= len(d.entries) && count > 0 {
|
|||
|
return nil, io.EOF
|
|||
|
}
|
|||
|
if count <= 0 || count > len(d.entries)-d.pos {
|
|||
|
count = len(d.entries) - d.pos
|
|||
|
}
|
|||
|
e := d.entries[d.pos : d.pos+count]
|
|||
|
d.pos += count
|
|||
|
return e, nil
|
|||
|
}
|