2017-08-19 07:36:56 -07: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 07:52:55 -07:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
2022-07-25 23:24:58 -07:00
|
|
|
|
|
|
|
"github.com/syncthing/syncthing/lib/protocol"
|
2017-10-20 07:52:55 -07:00
|
|
|
)
|
2017-08-19 07:36:56 -07:00
|
|
|
|
|
|
|
type errorFilesystem struct {
|
|
|
|
err error
|
|
|
|
fsType FilesystemType
|
|
|
|
uri string
|
|
|
|
}
|
|
|
|
|
2022-07-28 08:17:29 -07: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 00:31:29 -07:00
|
|
|
return fs.err
|
|
|
|
}
|
2022-09-14 00:50:55 -07: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) GetXattr(_ string, _ XattrFilter) ([]protocol.Xattr, error) {
|
|
|
|
return nil, fs.err
|
|
|
|
}
|
|
|
|
func (fs *errorFilesystem) SetXattr(_ string, _ []protocol.Xattr, _ XattrFilter) error {
|
|
|
|
return fs.err
|
|
|
|
}
|
2022-07-28 08:17:29 -07:00
|
|
|
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 00:31:29 -07:00
|
|
|
func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err }
|
2022-07-28 08:17:29 -07: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 08:32:45 -07:00
|
|
|
func (*errorFilesystem) SymlinksSupported() bool { return false }
|
2022-07-28 08:17:29 -07: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 00:31:29 -07:00
|
|
|
func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err }
|
2022-07-28 08:17:29 -07:00
|
|
|
func (fs *errorFilesystem) Usage(_ string) (Usage, error) { return Usage{}, fs.err }
|
2020-04-07 00:31:29 -07:00
|
|
|
func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
|
|
|
|
func (fs *errorFilesystem) URI() string { return fs.uri }
|
2022-07-28 08:32:45 -07:00
|
|
|
func (*errorFilesystem) Options() []Option {
|
2021-03-11 07:23:56 -07:00
|
|
|
return nil
|
|
|
|
}
|
2022-07-28 08:32:45 -07:00
|
|
|
func (*errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
|
2022-07-28 08:17:29 -07:00
|
|
|
func (fs *errorFilesystem) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
|
2019-05-25 12:08:26 -07:00
|
|
|
return nil, nil, fs.err
|
2017-10-20 07:52:55 -07:00
|
|
|
}
|
2022-09-14 00:50:55 -07:00
|
|
|
func (fs *errorFilesystem) PlatformData(_ string, _, _ bool, _ XattrFilter) (protocol.PlatformData, error) {
|
2022-07-25 23:24:58 -07:00
|
|
|
return protocol.PlatformData{}, fs.err
|
|
|
|
}
|
2021-05-03 03:28:25 -07:00
|
|
|
|
2022-07-28 08:32:45 -07:00
|
|
|
func (*errorFilesystem) underlying() (Filesystem, bool) {
|
2021-05-03 03:28:25 -07:00
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
2022-07-28 08:32:45 -07:00
|
|
|
func (*errorFilesystem) wrapperType() filesystemWrapperType {
|
2021-05-03 03:28:25 -07:00
|
|
|
return filesystemWrapperTypeError
|
|
|
|
}
|