errorfs.go 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright (C) 2016 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. package fs
  7. import (
  8. "context"
  9. "time"
  10. "github.com/syncthing/syncthing/lib/protocol"
  11. )
  12. type errorFilesystem struct {
  13. err error
  14. fsType FilesystemType
  15. uri string
  16. }
  17. func (fs *errorFilesystem) Chmod(_ string, _ FileMode) error { return fs.err }
  18. func (fs *errorFilesystem) Lchown(_, _, _ string) error { return fs.err }
  19. func (fs *errorFilesystem) Chtimes(_ string, _ time.Time, _ time.Time) error {
  20. return fs.err
  21. }
  22. func (fs *errorFilesystem) Create(_ string) (File, error) { return nil, fs.err }
  23. func (fs *errorFilesystem) CreateSymlink(_, _ string) error { return fs.err }
  24. func (fs *errorFilesystem) DirNames(_ string) ([]string, error) { return nil, fs.err }
  25. func (fs *errorFilesystem) GetXattr(_ string, _ XattrFilter) ([]protocol.Xattr, error) {
  26. return nil, fs.err
  27. }
  28. func (fs *errorFilesystem) SetXattr(_ string, _ []protocol.Xattr, _ XattrFilter) error {
  29. return fs.err
  30. }
  31. func (fs *errorFilesystem) Lstat(_ string) (FileInfo, error) { return nil, fs.err }
  32. func (fs *errorFilesystem) Mkdir(_ string, _ FileMode) error { return fs.err }
  33. func (fs *errorFilesystem) MkdirAll(_ string, _ FileMode) error { return fs.err }
  34. func (fs *errorFilesystem) Open(_ string) (File, error) { return nil, fs.err }
  35. func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err }
  36. func (fs *errorFilesystem) ReadSymlink(_ string) (string, error) { return "", fs.err }
  37. func (fs *errorFilesystem) Remove(_ string) error { return fs.err }
  38. func (fs *errorFilesystem) RemoveAll(_ string) error { return fs.err }
  39. func (fs *errorFilesystem) Rename(_, _ string) error { return fs.err }
  40. func (fs *errorFilesystem) Stat(_ string) (FileInfo, error) { return nil, fs.err }
  41. func (*errorFilesystem) SymlinksSupported() bool { return false }
  42. func (fs *errorFilesystem) Walk(_ string, _ WalkFunc) error { return fs.err }
  43. func (fs *errorFilesystem) Unhide(_ string) error { return fs.err }
  44. func (fs *errorFilesystem) Hide(_ string) error { return fs.err }
  45. func (fs *errorFilesystem) Glob(_ string) ([]string, error) { return nil, fs.err }
  46. func (fs *errorFilesystem) SyncDir(_ string) error { return fs.err }
  47. func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err }
  48. func (fs *errorFilesystem) Usage(_ string) (Usage, error) { return Usage{}, fs.err }
  49. func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
  50. func (fs *errorFilesystem) URI() string { return fs.uri }
  51. func (*errorFilesystem) Options() []Option {
  52. return nil
  53. }
  54. func (*errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
  55. func (fs *errorFilesystem) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
  56. return nil, nil, fs.err
  57. }
  58. func (fs *errorFilesystem) PlatformData(_ string, _, _ bool, _ XattrFilter) (protocol.PlatformData, error) {
  59. return protocol.PlatformData{}, fs.err
  60. }
  61. func (*errorFilesystem) underlying() (Filesystem, bool) {
  62. return nil, false
  63. }
  64. func (*errorFilesystem) wrapperType() filesystemWrapperType {
  65. return filesystemWrapperTypeError
  66. }