implemented os file interface acstraction

This commit is contained in:
ston1th 2022-04-02 14:08:59 +02:00
commit ad41ddbe54
11 changed files with 223 additions and 92 deletions

View file

@ -3,6 +3,7 @@
package fs
import (
"cachefs/pkg/provider"
"errors"
"io"
"os"
@ -45,7 +46,7 @@ func (dc *DirCache) Set(name string, dce *DirCacheEntry) {
type Dir struct {
log logr.Logger
f *os.File
f provider.File
dc *DirCache
}
@ -57,7 +58,7 @@ func (f *Dir) Seek(_ int64, _ int) (int64, error) {
return 0, io.EOF
}
func readDir(f *os.File) (fi []os.FileInfo, err error) {
func readDir(f provider.File) (fi []os.FileInfo, err error) {
ent, err := f.ReadDir(0)
if err != nil {
return