forked from Elara6331/itd
Updated mock interfaces
This commit is contained in:
parent
4a18622d37
commit
e4f8d0b551
73
fuse/mock.go
73
fuse/mock.go
@ -1,8 +1,40 @@
|
||||
package main
|
||||
import (
|
||||
"io/fs"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrFileNotExists = errors.New("file does not exist")
|
||||
ErrFileReadOnly = errors.New("file is read only")
|
||||
ErrFileWriteOnly = errors.New("file is write only")
|
||||
ErrInvalidOffset = errors.New("invalid file offset")
|
||||
ErrOffsetChanged = errors.New("offset has already been changed")
|
||||
ErrReadOpen = errors.New("only one file can be opened for reading at a time")
|
||||
ErrWriteOpen = errors.New("only one file can be opened for writing at a time")
|
||||
ErrNoRemoveRoot = errors.New("refusing to remove root directory")
|
||||
)
|
||||
|
||||
type Device struct {
|
||||
|
||||
}
|
||||
type FS struct {
|
||||
}
|
||||
|
||||
|
||||
type File struct {
|
||||
fs *FS
|
||||
path string
|
||||
offset uint32
|
||||
offsetCh chan uint32
|
||||
length uint32
|
||||
amtLeft uint32
|
||||
amtTferd uint32
|
||||
isReadOnly bool
|
||||
isWriteOnly bool
|
||||
offsetChanged bool
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (i *Device) HeartRate() (uint8, error) {
|
||||
return 10, nil
|
||||
@ -33,3 +65,42 @@ func (i *Device) Address() string {
|
||||
func (i *Device) Version() (string, error) {
|
||||
return "1.11.0", nil
|
||||
}
|
||||
|
||||
func (blefs *FS) ReadDir(path string) ([]fs.DirEntry, error) {
|
||||
var out []fs.DirEntry
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (blefs *FS) Mkdir(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (blefs *FS) Stat(path string) (fs.FileInfo, error) {
|
||||
return nil, ErrFileNotExists
|
||||
}
|
||||
|
||||
func (blefs *FS) Rename(old, new string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (blefs *FS) Remove(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (blefs *FS) Open(path string) (*File, error) {
|
||||
return &File{}, nil
|
||||
}
|
||||
func (blefs *FS) Create(path string, size uint32) (*File, error) {
|
||||
return &File{}, nil
|
||||
}
|
||||
func (fl *File) Read(b []byte) (n int, err error) {
|
||||
return 0, ErrFileWriteOnly
|
||||
}
|
||||
func (fl *File) Write(b []byte) (n int, err error) {
|
||||
return 0, ErrFileWriteOnly
|
||||
}
|
||||
func (fl *File) Close() error {
|
||||
return nil
|
||||
}
|
||||
// func (fl *File) Stat() (fs.FileInfo, error) {
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user