File operations
This commit is contained in:
parent
4015bc3896
commit
892908fcf5
5 changed files with 260 additions and 8 deletions
18
fs/local.go
18
fs/local.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/barakmich/kubelwagen"
|
||||
|
|
@ -12,14 +13,17 @@ import (
|
|||
)
|
||||
|
||||
type LocalFs struct {
|
||||
base string
|
||||
open map[int]*os.File
|
||||
sync.Mutex
|
||||
base string
|
||||
nextfile int
|
||||
openfiles map[int]*os.File
|
||||
}
|
||||
|
||||
func NewLocalFs(path string) *LocalFs {
|
||||
return &LocalFs{
|
||||
base: path,
|
||||
open: make(map[int]*os.File),
|
||||
base: path,
|
||||
nextfile: 1,
|
||||
openfiles: make(map[int]*os.File),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,10 +65,8 @@ func (fs *LocalFs) Handle(r *kubelwagen.Request) *kubelwagen.Response {
|
|||
return out
|
||||
case kubelwagen.MethodAccess:
|
||||
return fs.serveFromErr(r, syscall.Access(fs.getPath(r), r.Mode))
|
||||
}
|
||||
return &kubelwagen.Response{
|
||||
ID: r.ID,
|
||||
Code: fuse.ENOSYS,
|
||||
default:
|
||||
return fs.handleFile(r)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue