implemented os file interface acstraction
This commit is contained in:
parent
23528fe28e
commit
ad41ddbe54
11 changed files with 223 additions and 92 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue