2017-08-19 14:36:56 +00:00
|
|
|
// Copyright (C) 2016 The Syncthing Authors.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
package fs
|
|
|
|
|
2017-10-20 14:52:55 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
2022-07-26 06:24:58 +00:00
|
|
|
|
|
|
|
"github.com/syncthing/syncthing/lib/protocol"
|
2017-10-20 14:52:55 +00:00
|
|
|
)
|
2017-08-19 14:36:56 +00:00
|
|
|
|
|
|
|
type errorFilesystem struct {
|
|
|
|
err error
|
|
|
|
fsType FilesystemType
|
|
|
|
uri string
|
|
|
|
}
|
|
|
|
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) Chmod(_ string, _ FileMode) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Lchown(_, _, _ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Chtimes(_ string, _ time.Time, _ time.Time) error {
|
2020-04-07 07:31:29 +00:00
|
|
|
return fs.err
|
|
|
|
}
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) Create(_ string) (File, error) { return nil, fs.err }
|
|
|
|
func (fs *errorFilesystem) CreateSymlink(_, _ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) DirNames(_ string) ([]string, error) { return nil, fs.err }
|
|
|
|
func (fs *errorFilesystem) Lstat(_ string) (FileInfo, error) { return nil, fs.err }
|
|
|
|
func (fs *errorFilesystem) Mkdir(_ string, _ FileMode) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) MkdirAll(_ string, _ FileMode) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Open(_ string) (File, error) { return nil, fs.err }
|
2020-04-07 07:31:29 +00:00
|
|
|
func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err }
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) ReadSymlink(_ string) (string, error) { return "", fs.err }
|
|
|
|
func (fs *errorFilesystem) Remove(_ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) RemoveAll(_ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Rename(_, _ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Stat(_ string) (FileInfo, error) { return nil, fs.err }
|
2022-07-28 15:32:45 +00:00
|
|
|
func (*errorFilesystem) SymlinksSupported() bool { return false }
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) Walk(_ string, _ WalkFunc) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Unhide(_ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Hide(_ string) error { return fs.err }
|
|
|
|
func (fs *errorFilesystem) Glob(_ string) ([]string, error) { return nil, fs.err }
|
|
|
|
func (fs *errorFilesystem) SyncDir(_ string) error { return fs.err }
|
2020-04-07 07:31:29 +00:00
|
|
|
func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err }
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) Usage(_ string) (Usage, error) { return Usage{}, fs.err }
|
2020-04-07 07:31:29 +00:00
|
|
|
func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
|
|
|
|
func (fs *errorFilesystem) URI() string { return fs.uri }
|
2022-07-28 15:32:45 +00:00
|
|
|
func (*errorFilesystem) Options() []Option {
|
2021-03-11 14:23:56 +00:00
|
|
|
return nil
|
|
|
|
}
|
2022-07-28 15:32:45 +00:00
|
|
|
func (*errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
|
2019-05-25 19:08:26 +00:00
|
|
|
return nil, nil, fs.err
|
2017-10-20 14:52:55 +00:00
|
|
|
}
|
2022-07-28 15:17:29 +00:00
|
|
|
func (fs *errorFilesystem) PlatformData(_ string) (protocol.PlatformData, error) {
|
2022-07-26 06:24:58 +00:00
|
|
|
return protocol.PlatformData{}, fs.err
|
|
|
|
}
|
2021-05-03 10:28:25 +00:00
|
|
|
|
2022-07-28 15:32:45 +00:00
|
|
|
func (*errorFilesystem) underlying() (Filesystem, bool) {
|
2021-05-03 10:28:25 +00:00
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
2022-07-28 15:32:45 +00:00
|
|
|
func (*errorFilesystem) wrapperType() filesystemWrapperType {
|
2021-05-03 10:28:25 +00:00
|
|
|
return filesystemWrapperTypeError
|
|
|
|
}
|