filesystemtype.go 885 B

12345678910111213141516171819202122232425262728293031323334353637
  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 config
  7. import "github.com/syncthing/syncthing/lib/fs"
  8. type FilesystemType string
  9. const (
  10. FilesystemTypeBasic FilesystemType = "basic"
  11. FilesystemTypeFake FilesystemType = "fake"
  12. )
  13. func (t FilesystemType) ToFS() fs.FilesystemType {
  14. return fs.FilesystemType(string(t))
  15. }
  16. func (t FilesystemType) String() string {
  17. return string(t)
  18. }
  19. func (t FilesystemType) MarshalText() ([]byte, error) {
  20. return []byte(t), nil
  21. }
  22. func (t *FilesystemType) UnmarshalText(bs []byte) error {
  23. *t = FilesystemType(string(bs))
  24. return nil
  25. }
  26. func (t *FilesystemType) ParseDefault(str string) error {
  27. return t.UnmarshalText([]byte(str))
  28. }